Skip to content

feat(runtime): report after 64 calls without progress; a stuck child answers its brief (AP3b) - #240

Merged
lg2m merged 3 commits into
fix/eng-1001-tool-choice-nonefrom
feat/eng-1000-ap3b-stall-report
Oct 5, 2026
Merged

lg2m merged 3 commits into
fix/eng-1001-tool-choice-nonefrom
feat/eng-1000-ap3b-stall-report

Conversation

@lg2m

@lg2m lg2m commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

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.

  • Stall report. After 64 tool calls that changed nothing, the next turn is a short report: what is established (with 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.
  • A stuck sub-agent answers its brief. A model-spawned child that reports three times without other progress gets a final-answer turn instead of a fourth report. That turn ends the run whatever it returns, and the parent's spawn_agent result 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.
  • If the final answer is empty, the parent receives the child's latest report, under [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:

  • a successful mutating call, or an external call its server does not mark read-only;
  • a non-read-only shell command that ran, whatever its exit status (a failing test is work);
  • a successful blocking spawn_agent;
  • an applied steer or an answered ask_user;
  • a report.

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:
    • StallScope with StallPolicy {Root, Subagent, Exempt};
    • ReportDue {None, Report, FinalAnswer};
    • is_progress(call, catalog entry, result), which reuses approval::classify. "The shell ran" means the result opens with the shell or exec header, including timeouts.
  • Run loop:
    • Every settle site counts once: gate deny or answer, 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.
  • The final-answer turn's guarantee is the harness's, not the model's obedience (models answered 23 of 25 checkpoint turns with calls):
  • ADR-0054 § 3 is amended: it said "declares no tools", but native Bedrock rejects that once history holds tool calls (fix(provider): keep tools declared on no-tool-call turns; Bedrock budget-final turns no longer fail #238).
  • Store: TurnNotice gains stall_report and final_answer in model_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 like report and continuation.
  • Parent fallback: store.run_latest_report_text walks 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) and sessions/tests/progress.rs (end to end through the session runtime):

    Case Test
    (a) 64 reads produce a report turn, tools declared, prefix kept, continuation next sixty_four_reads_without_output_get_a_report_turn
    (b) a call in the report turn is not executed and is shown as such a_call_in_the_report_turn_is_not_executed
    (c) a mutation at call 60 means no report a_mutation_before_the_threshold_means_no_report
    (c′) a failing exit 3 at call 60 means no report a_failing_command_before_the_threshold_means_no_report
    read-only shell is not progress a_read_only_command_is_not_progress
    (c″) a child's answer resets the parent a_childs_answer_is_progress_for_the_parent
    (d) a stuck read child answers before 320 calls and the parent receives it a_read_child_answers_its_brief_on_its_fourth_report, a_stuck_read_child_answers_its_brief_and_the_parent_receives_it
    (e) an empty final answer gives the parent the labelled latest report an_empty_final_answer_hands_the_parent_the_latest_report
    (e′) the final request keeps its tools and asks for none asserted in both (d) tests
    (g) 1 000 reads in a root: a report every 64 calls, never ended a_root_run_reports_every_sixty_four_calls_and_is_never_ended
    (h) a write child editing every 50 calls never reports a_write_child_that_keeps_editing_never_reports
    (m) a real audit child making 96 reads gets no notice an_audit_child_never_gets_a_stall_report (also an_exempt_run_never_gets_a_stall_report)
    (n) budget-final outranks a due report the_budget_final_turn_outranks_a_due_report
  • Further tests:

    • denied calls count;
    • read-only versus ordinary MCP tools;
    • a truncated stall report keeps one notice;
    • a call on the final-answer turn never runs;
    • a final-answer turn over its token bound settles as exhausted;
    • an interrupted stall report, and an interrupted final answer, keep their notice and kind;
    • a continued report, and a fault-retried report, reach the parent whole;
    • no text at all is still an error;
    • replay: a child that answered its brief replays byte-identically, and the reference oracle agrees.
  • 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;
    • soak --ignored: 5 passed;
    • clippy (--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:

Review

Two independent read-only reviews.

The first requested changes:

  • Blocking (fixed): an interrupting steer during a report reset the count while the notice stayed marked as placed. Sixty-four calls later a report went out unannounced, rejecting every call, and an interrupted final answer gave the child its tools back.
  • Should-fixes (fixed): read-only MCP tools counted as progress; a final-answer turn with calls could complete over budget; a truncated report reached the parent as its tail only; the benchmark numbers were missing.

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

  • No protocol or descriptor change.
  • Prompt version unchanged: the notices are runtime messages, not system text.
  • model_turns.notice gains two values within the unreleased schema 40.
  • A pre-AP3b build that reads a store written by this one would reject stall_report as 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"]
Loading

lg2m added 3 commits October 2, 2026 02:17
…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
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant