Repository navigation
fix(controller): escalate persistent completes-with-error reconcile cycles to process exit - #110
Conversation
…ycles to process exit The Step watchdog only catches a Step that never returns; a Step failing fast every cycle (saturated jobs index, wedged state lock) reconciled nothing for hours while the process looked alive — the residual outage class of #54 observed in the #93/#98 incidents, both of which recovered on process restart. Track an unbroken run of completed-with-error Steps; at 20 consecutive failures (~10 minutes at the default cadence) log a distinct reconcile-persistent-failure event and exit non-zero so the scheduled task's restart-on-failure policy relaunches a fresh process. Any clean Step resets the streak, so transient errors never approach the threshold. Graceful shutdown is deliberately skipped on this path — it exercises the same failing subsystem. Refs #54 Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebdadfa261
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Reconciler.Step returns an error for a per-target ensure/statistics failure even while the remaining pools keep reconciling; counting those toward the persistent-failure exit would let one misconfigured target consume the scheduled task's bounded restart budget and leave no controller running (Codex review finding on #110). Surface the observation-failed state as ReconcileResult.NewWorkBlocked and key the escalation streak on error+blocked; any clean or partial outcome resets it. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae06bc0f47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ation A failing LoadDesired forces every listener to zero (forcedZero) yet never set observationFailed, so NewWorkBlocked reported false and each such cycle reset the persistent-failure streak instead of advancing it (Codex review finding on #110). Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 15910e52b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Desired-state initialization failure and unsafe-observed-state early returns produced a zero ReconcileResult, so NewWorkBlocked read false and each such cycle reset the escalation streak despite nothing having been reconciled (Codex review finding on #110). Context-cancellation early return stays unmarked — that is lifecycle, not a wedge. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e6fb85350
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The post-capacity-update worker refresh and job-index refresh failures zero admission capacity and record that new work is blocked, but never set observationFailed, so NewWorkBlocked read false and those cycles reset the escalation streak (Codex review finding on #110). Both mutations are safe: the earlier observationFailed consumers (resource zeroing, the cadence goroutine's forcedZero) capture its value before this point. Co-Authored-By: Claude Fable 5 <[email protected]>
Summary
The Step watchdog only catches a Step that never returns. A Step that fails fast every cycle with a globally-blocking observation error — saturated jobs index, wedged state lock — reconciled nothing for hours while the process looked alive: the completes-with-error outage class carved out of #54 as #111, observed in both the #93 and #98 incidents. Both recovered on process restart, which the scheduled task's restart-on-failure policy can supply automatically.
Change
ReconcileResultgainsNewWorkBlocked, set from the reconciler's observation-failed state (failed resource, worker-inventory, desktop, power, desired-state, or job-index observation) — as opposed to per-target errors that leave the remaining pools reconciling.reconcileFailureStreakcounts consecutive Steps that completed with an error while all new work was blocked; any clean or partial outcome resets it. Keying on the blocked flag keeps one persistently misconfigured target (which the live controller retries harmlessly forever) from consuming the scheduled task's bounded restart budget.reconcile-persistent-failureevent and exits non-zero via a sentinel that deliberately does not matchErrControllerRestartRequested.reconciler.Shutdownexercises the same failing subsystem and would hang or fail identically. A fresh process reclaims wedged in-process state and re-adopts surviving worker containers at startup.Scope
The external health watchdog / alerting asks stay open on #54 (they live outside the controller).
Testing
TestReconcileFailureStreakEscalatesOnlyOnUnbrokenBlockedErrorRun,TestReconcileFailureStreakResetsOnAnyCleanStep,TestReconcileFailureStreakIgnoresPartialPerTargetFailures,TestErrReconcilePersistentlyFailingDoesNotClaimRestartExitCode.go build,go vet,gofmtclean; app and controller packages green.Related
Closes #111
🤖 Generated with Claude Code