Skip to content

fix(runtime): keep tools declared on the slice checkpoint and reject a call there (RR1) - #108

Merged
lg2m merged 2 commits into
docs/run-reliability-planfrom
feat/rr1-checkpoint-tolerance
Sep 22, 2026
Merged

lg2m merged 2 commits into
docs/run-reliability-planfrom
feat/rr1-checkpoint-tolerance

Conversation

@lg2m

@lg2m lg2m commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #107 (plan). RR1 of docs/plans/run-reliability.md; audit finding R03.

Behaviour

The 256-call slice checkpoint used to remove the tool schemas from its request and treat any tool call the model streamed anyway as a ProviderProtocol run failure. Over OpenAI-compatible routes Anthropic models keep emitting tool_use when the transcript is dense with tool calls, so the checkpoint itself ended runs of 6–80 minutes (5 runs plus two sub-agents in the audit) with the work complete and durable but the run marked failed.

Now:

  • Tools stay declared on the checkpoint turn; the system-prompt notice asks the model not to use them.
  • A call streamed there is admitted through the existing PendingToolCall.rejection path (same as calls past the 16-per-turn cap), never executes, does not count toward the slice, and settles as one not-executed result (SLICE_CHECKPOINT_REJECTION) that the continuation turn sees, so the model re-issues it.
  • The slice resets whether or not the model obeyed: the persisted turn is the boundary.
  • The "declared no tools" protocol failure remains for budget-final turns, which still send no schemas.

Design

Principle 2 of the plan: bounds are enforced by what QQ sends next, never by declaring the model's reply illegal. tool_choice: none was not added — no adapter carries a tool-choice field today and the rejection result is sufficient for correctness. Once RR12's loop result lands, the checkpoint itself is a candidate for deletion (in-run compaction from #92 is already the durable boundary).

Verification

  • New regression a_tool_call_on_the_checkpoint_turn_settles_as_a_rejection_and_the_run_continues: 255 executed reads, one rejected call at the checkpoint, continuation request carries its result and SLICE_CONTINUATION_NOTICE, run completes with no Failed event.
  • Fixtures that identified the checkpoint by an empty tool list (RenewableSliceProvider, MeasuredCheckpoint, CompletesAfterCheckpoint, EmptyCheckpoint) now key on the notice and assert the schemas are present.
  • cargo test -p qq-core --lib: 686 passed. cargo fmt --check, cargo clippy -p qq-core --all-targets --all-features -D warnings clean.

Impact

Checkpoint requests now carry the tool schema bytes (previously credited back for one turn); no other hot-path change. No protocol or schema change.

…a call there instead of failing the run

The 256-call slice checkpoint removed the tool schemas from its request and
treated any tool call the model streamed anyway as a ProviderProtocol
failure. Over OpenAI-compatible routes Anthropic models keep emitting
tool_use when the transcript is dense with tool calls, so the checkpoint
itself ended runs of 6 to 80 minutes (5 runs, plus two sub-agents, in the
2026-09-21 audit) with the work complete and durable but the run marked
failed.

Tools now stay declared on the checkpoint turn; the notice in the system
prompt asks the model not to use them. A call streamed there is admitted
through the same PendingToolCall.rejection path as calls past the per-turn
cap, never executes, does not count toward the slice, and settles as one
not-executed result the continuation turn sees, so the model re-issues it
with tools available again. The slice resets whether or not the model
obeyed the notice: the persisted turn is the boundary. The "declared no
tools" protocol failure remains for budget-final turns, which still send
no schemas.

Regression: a_tool_call_on_the_checkpoint_turn_settles_as_a_rejection_and_the_run_continues
(255 executed reads, one rejected call at the checkpoint, continuation
carries its result, run completes). Fixtures that identified the
checkpoint request by an empty tool list now key on the notice. The
measured-token chain test now expects the seam to vary only by the notice
bytes rather than the whole schema.

RR1 of docs/plans/run-reliability.md.
@lg2m
lg2m merged commit e10323e into main Sep 22, 2026
4 checks passed
@lg2m
lg2m deleted the feat/rr1-checkpoint-tolerance branch September 22, 2026 02:52
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