Repository navigation
feat(runtime): report after 64 calls without progress; a stuck child answers its brief (AP3b) - #240
Merged
lg2m merged 3 commits intoOct 5, 2026
Conversation
…answers its brief (AP3b) ADR-0054 § 1-3. A run now counts settled calls since it last produced output. A progress event is: - a successful mutating or external call; - a non-read-only shell command that ran, whatever its exit status; - a successful blocking spawn_agent; - an applied steer or an answered ask_user; - a report. Reads, searches, read-only shell commands and denied calls count but never reset it; runtime rejections are not counted. After 64 such calls the next turn is a stall report. It is the slice checkpoint's kind of turn, with its own notice: tools stay declared, calls are not executed, the run continues, and an empty reply is a missed report. Root runs are never ended by this rule. A model-spawned task that reports three times without other progress gets a final-answer turn instead of its fourth report: - its tools stay declared with ToolChoice::None (ENG-1001; Bedrock rejects tool-free requests over tool history); - calls on it never run; - it completes the run whatever it returns, bypassing Jev, audit and steering. An empty final answer hands the parent the child's latest report, under an interim label; with no report text either, the error is unchanged. Audit children are exempt. The budget-final turn outranks both report kinds. TurnNotice gains stall_report and final_answer. Both are in the unreleased schema 40, so no new migration. ADR-0054 § 3 is amended: tools stay declared, and the turn settles whatever it returns. Linear: ENG-1000
…low-ups (AP3b) Independent review of AP3b: - Blocking: an interrupting steer during a stall report reset the count while the report's notice stayed marked as placed. Sixty-four calls later a report turn went out with no notice: every call was rejected and nothing was persisted. An interrupted final-answer turn also handed the child its tools back. `placed_report: Option<TurnNotice>` now pins the turn's kind until it settles, for retries, truncations and interrupts alike. - A read-only MCP tool (`hints.read_only`) is a read, not progress. - A final-answer turn with calls checks the cost and token bounds before completing; a completed run never overran them. - A report continued after an output cut reaches the parent whole. Each fix has a regression test that fails without it. The ADR and architecture docs describe the interrupt and read-only external rules. The ledger records the benchmarks. Linear: ENG-1000
… (AP3b) Re-review follow-up: a report retried after a mid-stream fault or an interrupt continues 'from where it stopped', but its earlier attempt is stored untruncated, so the parent received only the tail. Every row in a report span is an attempt at the same reply; join them all. Linear: ENG-1000
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Oct 2, 2026
Merged
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.
Slice AP3b of
autonomous-core.md(ADR-0054 § 1–3) · Linear ENG-1000 · Base: #238 (ENG-1001, tool choice none).What changes for users
Runs that stop producing anything now say what they have, and sub-agents that are stuck now answer their parent instead of reading until a bound stops them.
path:line), what is unknown, and the next action. The run then continues. It is the slice checkpoint's kind of turn: tools stay declared, calls in it are not executed, the run continues, and an empty reply is a missed report. A root run is never ended by this rule.spawn_agentresult is its answer. A read child that only reads now answers within 4 × 64 calls, where before it read until a budget or the 256-call slice stopped it. The session-store baseline in ADR-0054 shows why this matters: 41 of 85 long children were silent until their final turn.[interim report: the sub-agent ended without a final answer; this is its latest progress report]. That text is the child's own durable output. With no report text either, the existing error stands.What counts as progress, per ADR-0054 § 1:
spawn_agent;ask_user;Reads, searches, read-only shell commands and read-only MCP tools are never progress. Denied calls count toward the report; runtime rejections don't count at all. Audit children are exempt, since they're already bounded at 8 turns. The budget-final turn outranks both report kinds.
Design
runtime/progress.rs:StallScopewithStallPolicy{Root,Subagent,Exempt};ReportDue{None,Report,FinalAnswer};is_progress(call, catalog entry, result), which reusesapproval::classify. "The shell ran" means the result opens with the shell or exec header, including timeouts.select_tools, overlapped reads, ordered calls.placed_report: Option<TurnNotice>pins a placed report or final-answer turn's kind until it settles. Retries, truncations and interrupts resend the same turn under the same notice, even after an applied steer reset the count.ToolChoice::None(fix(provider): keep tools declared on no-tool-call turns; Bedrock budget-final turns no longer fail #238);budget_exhausted.TurnNoticegainsstall_reportandfinal_answerinmodel_turns.notice. Both are in schema 40, which hasn't shipped in a release (v0.1.5 is schema 39), so there is no new migration. Replay renders them likereportandcontinuation.store.run_latest_report_textwalks notice spans and joins each report's attempts in order. Reports cut by output limits, faults and interrupts reach the parent whole.Verification
Acceptance tests from the plan, all in
src/tests/progress.rs(run loop) andsessions/tests/progress.rs(end to end through the session runtime):sixty_four_reads_without_output_get_a_report_turna_call_in_the_report_turn_is_not_executeda_mutation_before_the_threshold_means_no_reportexit 3at call 60 means no reporta_failing_command_before_the_threshold_means_no_reporta_read_only_command_is_not_progressa_childs_answer_is_progress_for_the_parenta_read_child_answers_its_brief_on_its_fourth_report,a_stuck_read_child_answers_its_brief_and_the_parent_receives_itan_empty_final_answer_hands_the_parent_the_latest_reporta_root_run_reports_every_sixty_four_calls_and_is_never_endeda_write_child_that_keeps_editing_never_reportsan_audit_child_never_gets_a_stall_report(alsoan_exempt_run_never_gets_a_stall_report)the_budget_final_turn_outranks_a_due_reportFurther tests:
Fixture changes: the slice fixtures now write once per turn, so they still reach the 256-call checkpoint rather than a stall report. The headless rollover fixture answers stall reports.
Checks:
cargo test --workspace: 2066 passed;--ignored: 5 passed;--all-targets --all-features -D warnings) and fmt are clean.Benchmarks, interleaved A/B against fix(provider): keep tools declared on no-tool-call turns; Bedrock budget-final turns no longer fail #238's head, medians, no regression:
context_assembly: 73.6 → 50.8 µs (noise; minimums 52.4 / 49.8);turn_overheadat 100 turns: 36.6 → 36.7 ms;tool_dispatch: 65.8 → 51.1 µs.tool_dispatchhangs onmain: since fix(runtime): treat an empty completion after tool results as a provider fault #196, its fixture's empty completion after tool results is a retried fault. I measured both sides with a local one-line fixture fix and filed ENG-1003.Review
Two independent read-only reviews.
The first requested changes:
Every fix has a regression test that fails without it; I checked each by removing the fix. The second review approved, and its one remaining should-fix (fault and interrupt retries in the fallback) is fixed with a test.
Compatibility
model_turns.noticegains two values within the unreleased schema 40.stall_reportas a codec error. No released build reads schema 40.Feature flow
flowchart LR A["64 calls without progress"] --> B["Pinned report turn; calls are not executed"] B --> C{"Root or stuck child?"} C -->|Root| D["Continue after report"] C -->|Child after three reports| E["Final-answer turn"] E --> F["Durable reply or labelled latest report reaches parent"]