Repository navigation
Helper and pilot runs end once: HelperRun.apply, PilotRun.State, one trust check - #292
Merged
Merged
Conversation
…trust check A helper's phase changes go through HelperRun.apply, which ignores what no longer applies, so a late turn end or close-out cannot reopen a helper you closed out or move its end. A pilot run is running, ending or ended; the next round waits while one ends, and only its first end counts. PullTrustBook.resolveOnGitHub is the one way the app asks who a PR is from. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mpdreamz
force-pushed
the
fix/run-states
branch
from
November 16, 2026 21:20
919bdc3 to
aa66fb8
Compare
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.
Part 2 of fix/hook-router (code-health plan, PR 13): items 2 to 4. Independent of #290; whichever lands second takes a small rebase in
AppModel.deliver(the trust-resolve block and the one-run-per-PR check).HelperRun.apply(_ event:, at:) -> [Effect]?(HeedCore/Helpers/HelperLifecycle.swift). Every phase change inAppModel+Helpersnow goes through this one function, about 15 sites: ready, turn started, turn ended (read by why it was cancelled: pause, steer, stop), stopped, could not start, turn failed, agent exited, close-out, closed, part ended. It returns what the app does next (finishTurn,steer,recordFailure), or nil when the event no longer applies, in which case nothing changes. The app keeps the side maps (turns, cancelling, clients) as it did.HelpersModel.CancelReasonis nowHelperRun.Cancel, kept under its old name as an alias.turnEndedaftergO(take over) no longer turns the helper back to stopped and runsfinishTurn, which could auto-push. AfinishTurnwhose git read finishes after the close-out no longer overwritesendedAtand the close-out.runTurndoes not start a turn on a helper that failed or was closed out. A failed helper can still be closed out (thrown away), as before.endedAtrather than setting it to the takeover time. Closing out an already closed helper does not relabel it.PilotRun.State:running,ending,ended(Outcome, at:). Before,endedAtandoutcomecould be set separately.endedAtandoutcomeare now read-only views of the state.end(_:at:)counts only the first end.endRunmarks the runendingas it removes the live entry, and the one-run-per-PR check indelivertreats an ending run as busy, so the next round waits until the end has been read (endRunalready delivers what waited). Storage keeps its old format (endedAtandoutcome), plusendingwhile a run ends. A stored end with no outcome reads as interrupted.PullTrustBook.resolveOnGitHub(_:viewer:trustedAuthors:caller:)replaces the fiveresolve { GitHub.pullAuthorship … }blocks in AppModel, +Helpers and +Reviewers. The callers' names in the call log are unchanged.Verified:
swift build(app included) andswift build --build-tests. Targeted tests passed (154 tests in 25 suites): the newHelperLifecycleTestsandPilotRunStateTests, plus Runs, RepoSetup, Helper, HelperApproval, AwaySummary, RunIsolation and Domain.mise run fmtand lint (swiftformat --lint, swiftlint) are clean. Mutation checks: dropping the live guard on a turn's end fails the late-takeover test, and dropping the first-end guard inPilotRun.endfails the ending test. The full suite was not run; per the plan it runs on main at the end. Not checked in the running app.🤖 Generated with Claude Code