fix(operator): stamp apply ErrorMessage from the aggregate failure#345
Merged
morgo merged 1 commit intoJun 15, 2026
Conversation
When the rollout settles to failed, surface the reason from the first failed operation row instead of leaving whatever message the last-driven operation wrote. Under on_failure "continue" the last driver may be a successful sibling, which would otherwise leave the failed verdict with no matching reason.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
aparajon
approved these changes
Jun 15, 2026
975830d
into
kiran01bm/operation-state-first-persistence
27 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When the operator re-derives a parent apply's state from its
apply_operationsrows and the rollout settles tofailed, the apply'sErrorMessageis now surfaced from the aggregate — the first failed operation — instead of whatever message the last-driven operation left behind.Why
The bug:
updateApplyStateFromOperationsre-derivesapplies.statefrom the operation rows but copies the apply struct verbatim and never touchesErrorMessage. So the failure reason is whatever the last operation to write the apply happened to leave. Underon_failure: continuethe rollout keeps driving siblings past a failed deployment, so the last driver is frequently a successful sibling — leaving the apply with afailedverdict and an empty or misleading reason. An operator triaging the failure sees the verdict but not why.The fix: when the derived state is
failed, stampErrorMessagefrom the first failed operation row (deployment order), formatted asdeployment <name> failed: <reason>. The rollout's verdict is the first failure, so the first failed row wins. If no failed operation carries a message, the existing apply message is kept as a fallback rather than blanked.Operation rows already carry their own correct failure message (each operation is persisted from its own tasks), so the aggregate has the right data to surface.
ops: [region-a failed "cutover failed", region-b completed] ─▶ derived = failed
└▶ apply.ErrorMessage = "deployment region-a failed: cutover failed"
(not region-b's empty / last-op message)
Notes
Stacked on #343 (operation-state-first persistence) — review/merge that first. Scoped to the operator's aggregate writer; the tern per-op stamping and single-writer refactor are separate follow-ups.