fix(team): restart_policy=never freezes the role instead of churning replacements - #108
Merged
Conversation
…replacements A never role's failed session dropped out of CountsAsAlive with no RoleHealth entry, so the reconciler replaced it every tick, uncapped and with no backoff: one leaked live pane per ~8s cycle. Never now means the role stops. Both failure paths (health-stale and reaped pane) freeze the role via the existing saturation sentinel, keeping the failed row and pane for post-mortem. Recovery is delete team + re-apply, same as MaxRestarts saturation. Act 1c demo doc updated; the reap path now also emits session.failed for never roles. Includes two gofumpt drift fixes in internal/otel (formatting only). Closes #107 Refs: aae-orc-pyre
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.
A role declared restart_policy = "never" never stayed down: the failed session dropped out of CountsAsAlive with no RoleHealth entry, so the reconciler replaced it every 2s tick, uncapped and with no backoff. Left running, that leaks one live pane per ~8s cycle (238 accumulated tmux windows in one overnight demo environment). Fixing it makes "never" mean what the manifest contract and every operator expecting k8s restartPolicy: Never semantics assume: the role stops.
Contract ruling (operator, 2026-08-05): never = the role goes terminal on first failure. The failed row and its pane stay visible for post-mortem; recovery is delete team + re-apply, identical to MaxRestarts saturation.
Mechanism: both failure paths now freeze the role's BackoffUntil to the existing saturation sentinel, so reconcileRole's backoff gate permanently refuses replacements:
Tests: TestRestartNeverFreezesRole (health path: exactly one failed session survives four repair opportunities; far-future freeze visible in RoleHealthSnapshot) and TestRestartNeverReapFreezesRole (reap path: pane kill + 10min clock advance, still no replacement). Full suite passes; docs/demo.md Act 1c updated to describe terminal behavior instead of presenting the churn as intended.
Also carries two gofumpt drift fixes in internal/otel (formatting only, pre-existing).
Root cause diagnosed in aae-orc-pyre (2026-08-02); dates to PR #21, made visible by PR #83.
Closes #107