Repository navigation
Runs finish or hand back only for a listed reason: one supervisor for every ending - #635
Merged
Merged
Conversation
… every ending Runs kept ending by handing unfinished work to a person: two steps that changed nothing stopped the run with a held draft, a CI fix that met the same failure set needs_input, own-review rounds at their cap asked a person, an error after the work became a held draft. Each loop had its own stall rule and its own hand-back ending, and every earlier fix changed one of them. needs_input is now written only with a HandBack (common::handback), which exists only for a reason on the human-only list: a credential, missing access, a product decision, an ambiguous ticket, someone else holding the work, the usage limit, an approval, or a person's own action. The type that writes the status takes one, and the reason is kept on the wait. supervisor::hand_back_for is the one reading of a stop. Every former hand-back ending now finishes through supervisor::end: - a stop after the work ships: tasks left are deferred with why on the checklist, the pull request gets a Deferred section, and the run goes on to CI and the ready decision; - CI give-ups revert to the last green head, else take out the last planned task, defer it and let CI decide again; only when nothing can come out does the run end failed with what fails; - own-review, planned-work and guard stops finish on their pull request (failed when its CI is red); held drafts on finished runs stay recorded without turning the run into a wait. A step that changed nothing climbs a ladder instead of stopping: one task, fresh context with edits in place, a re-split, the strongest model, defer the task (non-core after three), then ship; near 85% of the spend ceiling it ships. Own-review rounds extend while they fix things, up to twice the cap. Errors after the work get one fresh step, the step-limit continuation covers every pass after the work, and a reply that spent its whole output thinking is taken again with less thinking instead of read as the answer. Tests: the supervisor's rules over every combination, a replay of 217 historical stuck-run shapes (invented names) asserting no run waits unless its blocker is on the list, and a source scan that fails when an ending goes around the supervisor.
This was referenced Nov 12, 2026
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.
Summary
Runs kept ending by handing unfinished work to a person: two steps that changed nothing stopped the run with a held draft, a CI fix that met the same failure set
needs_input, own-review rounds at their cap asked a person to finish, an error after the work became a held draft with "a person should look". Each loop (implement steps, CI fix, own review, planned-work rounds, run guard, ready decision, the error arm) had its own stall rule and its own hand-back ending, and each earlier fix changed one of them, so the class kept coming back.This makes the class structural:
needs_inputcan only be written with aHandBack, and aHandBackexists only for a reason on the human-only list (credential, missing access, product decision, ambiguous ticket, someone else holding the work, usage limit, approval, a person's own action). The compiler enforces it: the one function that writes the status takes one.failedwith the exact cause. None of them waits on a person.Changes
common::handback(new):HumanOnly,HUMAN_ONLY,HandBack(private fields),HandBack::of_judged,human_only_in.run_wait::NeedsInput::needs_inputtakes&HandBackand records its reason on the wait (waiting_on.handback). Every caller now supplies one: the ticket-question stops name what they ask for, the policy approval isApproval, a reopened run isPersonAction.passes::supervisor(new):hand_back_for(the one reading of a stop),decide_end/end(the ending rule, with its rules checked), the stall ladder (next_rung: narrow, fresh context with edits in place, re-split, strongest model, defer, ship; non-core tasks such as readme lines defer after three),may_extend(rounds past a cap while they fix things, up to twice the cap),near_spend_cap(ship at 85% of the spend ceiling),revert_for.passes/mod.rs): a step that changed nothing climbs the ladder instead of returning the stall as an error;DeferandShipwrite(deferred: ...)on the run's checklist (plan_coverage::with_deferred), which every later check reads as settled;Escalateuses the strongest implement model.stop_pr::open_with: a stop that isn't human-only ships (stop_pr::ship): remaining tasks deferred, the pull request opens or is updated with a "Deferred" section (no "Not finished, what you can do"), the run goes toawaiting_ciso the CI fix loop and the ready decision take it like any finished run.resume::hand_off_red_ci(all five CI give-up sites):revert_to_greenfirst: back to the newest green head of the pull request, else the last planned task back to the base branch, deferred and named on the pull request, up to three reverts; CI decides again.resume::wait_on_person(own-review stop, planned-work stop, red-CI completion): completed with what is open listed, or failed with what fails when CI is red; waits only with aHandBack.run_guard: a guard stop with an open pull request finishes it (finish_open_pr); with nothing to open, the run ends failed with the guard's reason.ready: a hold on a finished run stays recorded and named on the pull request; the run turns into a wait only when a person put the pull request back to draft or the reason is on the list.own_review::next: rounds extend past the cap while a round fixed something; the cap message no longer says "handed to a person".agent/anthropic.rs: one rule for a turn cut at the output limit before any tool call, unified with Security update runs: planned by rule, verified in the sandbox, never stuck #634's nudge (continue_after_cutand the thinking-only retry are nowcut_before_acting). It is taken again with one step less thinking and the output-limit note (act now, small edit_file calls), up to three times, instead of being read as the final answer. A reply that only thought is dropped (its cut thinking can't be signed and an assistant turn with no text or call can't be sent back; dropping the last turn leaves earlier thinking blocks round-tripping) and the note goes on the last user turn; a reply that said something stays in history with the note after it. The log records it asoutput_limit(NoteKind::OutputLimit).Shiprung for them at once, so the tasks left are deferred on the checklist with their reason.Verification
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace: pass.supervisor::tests::every_ending_keeps_the_rules: all 64 combinations of open tasks, failing/running CI, blocker, work and ladder state keep the rules (no wait without a listed reason, nothing finished with failing checks or undeferred tasks).supervisor::tests::across_the_replays_only_human_only_blockers_wait: 217 historical stuck-run shapes (invented names, how many tasks done, what stopped them). Through the old outcome rule 214 needed a person. Through the new rules, assuming no further attempt lands: 25 finish, 148 end failed with the cause (nothing to ship), 44 wait, every one on a need from the human-only list. Every run that had more than one task done and stopped on something CoderHelm owns finishes.supervisor::tests::the_four_named_runs_finish_now: a security run stuck on a readme task after 8 of 9, a finished run whose pull request GitHub refused, a run stuck after 7 of 8, a CI fix that gave up after one try.supervisor::tests::no_ending_goes_around_the_supervisor(source scan): fails when a file outside the ending sites writesneeds_input, when aHandBackis made from anything but a listed reason, when a stall returns as an error again, whenhand_off_red_cigives up before reverting, or when an ending site stops reading the supervisor. It fails on the code before this change.common::handbacktests: stalls, red checks, time limits, budgets, tool errors and a too-long body are never read as human-only; access and credential words are.anthropic::tests::a_turn_cut_before_any_call_is_taken_again_not_read_as_the_answer,plan_coverage::tests::a_deferred_task_is_settled_and_listed_with_why,stop_pr::tests::a_run_stopped_mid_work_ships_with_the_rest_deferred,own_review::tests::rounds_go_on_past_the_cap_while_they_fix_things_then_defer_the_rest.