Skip to content

fix(resume): rebuild a resumed run with the guards it started with - #665

Merged
ion-alpha-dev merged 1 commit into
mainfrom
fix/resume-keeps-run-guards
Nov 3, 2026
Merged

ion-alpha-dev merged 1 commit into
mainfrom
fix/resume-keeps-run-guards

Conversation

@ion-alpha-dev

Copy link
Copy Markdown
Collaborator

What

flynn resume now rebuilds a run with the guards its first assembly recorded: the item verifier (planning), --require-proof, the --max-cost and --max-tokens budget, the --require-approval and --irreversible gates, and fan-out. The run's posture event also lists the actions marked --irreversible, and governed.ReadPosture reads a run's original posture back from its record.

Why

Resume assembled the run from its shell flags alone. A planned goal resumed after a hard kill got a worker with no item verifier, so its first verify step failed the run with goal_no_verifier: goal: verify step dispatched to a worker with no item verifier. The live e2e resume-after-hard-kill scenario hit this on the release candidate binary. The same resume also ran with no spend cap, no approval gate, no outside-action gate and no ledger proof, which is a weaker run than the one the operator started.

How to verify

  • go test -run TestResumeRebuildsTheRunsGuards ./cmd/flynn/ assembles a run with every guard the goal command can set, then assembles its resumption through the same code flynn resume uses, and requires the two postures to be equal. With the guards left out of the resume it fails.
  • go test -run TestReadPostureReturnsTheFirstAssembly ./governed/ checks that every posture field round-trips through the record, and that a later assembly with fewer guards does not replace the original. With the --irreversible actions left out of the record it fails.

Notes for reviewers

  • The first posture on the stream is used, not the latest, because each resume records its own. A resume that had lost a guard would otherwise pass the loss on to the next one.
  • The budget pool is keyed by run id, and budget.Ledger.Open returns the existing pool, so the spend recorded before the kill still counts against the cap.
  • A run that an external agent CLI drove is now refused: resume drives a native model, so continuing that run would change what drives it.
  • governed.Posture gains a field and governed.ReadPosture is new. Both are additions. ./dev/apidiff lists nothing in governed.

flynn resume assembled the run from its shell flags alone. A planned
goal resumed after a crash or kill got a worker with no item verifier,
so its first verify step failed the run with goal_no_verifier. The
same resume also dropped the run's --max-cost and --max-tokens cap,
its --require-approval and --irreversible gates and --require-proof.

Every assembly already records its posture on the run's stream. The
posture now also lists the actions marked --irreversible, and
governed.ReadPosture reads back the first one, which is the run's
original assembly (a resume records its own posture after it).
resumeRun turns that posture into the same drive options: planning
when the verifier was wired, ledger proof, the budget limits (the
existing pool, with its recorded spend, is reopened), the approval
and outside-action gates, and fan-out. A run an external agent CLI
drove is refused, since resume drives a native model.

TestResumeRebuildsTheRunsGuards assembles a run with every guard and
its resumption the way flynn resume does, and requires equal
postures; it fails when the guards are left out. The governed test
round-trips every posture field and fails when one is not recorded.

Signed-off-by: Ion Alpha <[email protected]>
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.37931% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
governed/guard.go 93.25% 6 Missing ⚠️
cmd/flynn/main.go 84.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ion-alpha-dev
ion-alpha-dev merged commit 309c669 into main Nov 3, 2026
34 checks passed
@ion-alpha-dev
ion-alpha-dev deleted the fix/resume-keeps-run-guards branch November 3, 2026 18:59
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant