Skip to content

Commit 9184ed3

Browse files
committed
🤖 fix: skip stale-generation status writes during retry
When retrying CoderControlPlane status updates, skip writes if the latest resource generation no longer matches `nextStatus.ObservedGeneration`. This prevents older reconciles from overwriting fresher status computed by newer reconciles while still retaining conflict retry behavior. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$1.21`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=1.21 -->
1 parent 7fa58d9 commit 9184ed3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎internal/controller/codercontrolplane_controller.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,12 @@ func (r *CoderControlPlaneReconciler) reconcileStatus(
10871087
return fmt.Errorf("assertion failed: fetched object %s/%s does not match expected %s/%s",
10881088
latest.Namespace, latest.Name, namespacedName.Namespace, namespacedName.Name)
10891089
}
1090+
if nextStatus.ObservedGeneration > 0 && latest.Generation != nextStatus.ObservedGeneration {
1091+
// A newer reconcile has observed a newer generation. Avoid overwriting
1092+
// status with stale data from an older reconcile attempt.
1093+
coderControlPlane.Status = latest.Status
1094+
return nil
1095+
}
10901096
if equality.Semantic.DeepEqual(latest.Status, nextStatus) {
10911097
coderControlPlane.Status = latest.Status
10921098
return nil

0 commit comments

Comments
 (0)