Repository navigation
fix(runtime): stop resending an empty truncated turn; raise the cap once, then fail with the cause (RR8.1) - #198
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 639bc21044
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04f4476a34
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nce, then fail with the cause (RR8.1) A turn cut at the output limit with nothing visible streamed (the whole cap spent on hidden reasoning) was continued up to MAX_OUTPUT_CONTINUATIONS times with a byte-identical request: four 16 384-token turns and ~15 min per audited run producing nothing. An empty truncation now doubles the request cap toward the model ceiling once (MAX_EMPTY_OUTPUT_RETRIES) and otherwise settles provider_output_truncated at once, naming reasoning as the cause and max_output_tokens / reasoning_effort as the remedies. The summarizer fails its step the same way instead of continuing an empty reply. Regressions: an_empty_truncated_turn_raises_the_cap_once_then_completes, an_empty_truncated_turn_at_the_ceiling_fails_at_once_naming_the_cause. Linear: ENG-953
…ntinuation from one (RR8.1 review) The empty-truncation branch discarded IncompleteReason, so an Anthropic pause_turn that arrived before any visible text was treated as output-token exhaustion and failed at the model ceiling instead of being resent as the provider requires (broke a_paused_turn_with_no_text_resumes_from_the_original_prompt). The run loop and the summarizer now take the empty-retry path only for OutputTokens; Paused resumes as before. The cap-raise retry also emitted `continuation: 0`; the field is 1-based and the client rendered "continuing (0/3)". It now increments the shared counter. Linear: ENG-953
… truncated turn as nothing (RR8.1 review 2) Truncation cleanup drops pending calls before the empty-turn check, so a turn that streamed a complete tool call and then hit the cap with no text was classified as all-reasoning and, at the model ceiling, failed the run instead of being continued. The check now remembers whether a call was streamed. An empty truncated turn is persisted as truncated but the live run neither appended it nor sent a continuation notice. Context assembly appended both on replay, telling the model to continue nothing. Replay now skips an empty truncated turn, matching the request the model saw. Tests: a_truncated_turn_that_streamed_a_tool_call_is_continued_not_failed, an_empty_truncated_turn_replays_without_the_continuation_notice. Linear: ENG-953
04f4476 to
7866a1c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7866a1cc50
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ation cap (RR8.1 review 3) After three visible truncations, an empty one entered the cap-raise branch, incremented the continuation counter past MAX_OUTPUT_CONTINUATIONS (the client renders it against the advertised cap) and spent a fifth provider turn. The branch now settles with the ordinary cap failure once the shared cap is spent. Regression: an_empty_truncation_after_the_continuation_cap_does_not_spend_another_turn (5 turns → 4, no `continuation: 4`). The summarizer's empty check trims like `Message::has_content` does, so a whitespace-only reply is not continued three times. Linear: ENG-953
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d6bf4c677
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…truncation (RR8.1 review 4) The visible-output check counted any pending call, including one cut mid-arguments that is dropped from the resend; such a turn was continued at the same cap up to three times instead of taking the empty-turn path. Only a call that finished streaming counts. Test: a_tool_call_cut_mid_arguments_with_no_text_is_an_empty_truncation. Linear: ENG-953
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b220280cd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| turn cut at the output limit with nothing visible streamed (no text, refusal, | ||
| or tool call: the whole cap went to hidden reasoning) is not continued, because |
There was a problem hiding this comment.
Describe only completed calls as visible output
This design text says that any “tool call” prevents a truncation from being empty, but the final implementation sets streamed_visible_output only when call.completed is true; a call cut while streaming arguments is discarded and follows the empty-truncation path. Since this document describes the system as built, specify “completed tool call” here so the documented contract matches the implementation and its new regression test.
AGENTS.md reference: AGENTS.md:L14-L16
Useful? React with 👍 / 👎.
RR8.1: an empty truncated turn is a budget failure, not a continuation
Spec: docs/plans/run-reliability.md (RR8) Linear: ENG-953 Stack: 1/4
What changed
OUTPUT_TRUNCATED_CONTINUE_NOTICE. There is nothing to continue and the resend was byte-identical.max_output_tokenstoward the resolved model's ceiling once (MAX_EMPTY_OUTPUT_RETRIES = 1). If the cap is already at the ceiling, or the retry is empty again, the run settlesprovider_output_truncatedat once with a message naming the cause (reasoning) and both remedies (max_output_tokens,reasoning_effort). Previously: 4 identical ~220 s turns, then a generic failure.How verified
an_empty_truncated_turn_raises_the_cap_once_then_completes(caps 256 → 512, one request each, no continuation notice appended)an_empty_truncated_turn_at_the_ceiling_fails_at_once_naming_the_cause(1 provider call, not 4)truncated_turns_are_committed_and_continued_within_the_cap/truncation_past_the_cap_settles_with_a_typed_failureunchanged.Docs
docs/design/architecture.md§ output truncation.Compatibility
RuntimeEvent::OutputTruncatedis reused for the cap-raise (1-based like every other continuation).Evidence
Operator store, read-only: two
provider_output_truncatedruns onlitellm/us.anthropic.claude-fable-5-1(2026-09-23, 2026-09-25). Every failing turn persistedassistant_content_json = []withoutput_tokens = 16384; every continuation request hadinput_tokens = 2uncached (byte-identical resend). Route-wide since 09-10: 3 935 turns, 49 truncated, 31 empty, ≈ 671 k output tokens and ≈ 2 h wall producing nothing.Review round (Codex)
IncompleteReasonwas discarded, so an Anthropicpause_turnwith no text hit the empty-retry branch and failed at the model ceiling instead of resuming (CI-confirmed). OnlyOutputTokenstakes the empty-retry path now, in the run loop and the summarizer.continuation: 0; the field is 1-based and the client renderedcontinuing (0/3).a_truncated_turn_that_streamed_a_tool_call_is_continued_not_failed.an_empty_truncated_turn_replays_without_the_continuation_notice.continuation: 4, a fifth turn); it now settles. Test:an_empty_truncation_after_the_continuation_cap_does_not_spend_another_turn.has_content.ResolvedModel(per-turnPrepared.weightalready records the effective cap); summarizer usage on the new empty-failure path (pre-existing on the sibling path); gating the retry onoutput_token_control(one bounded extra turn on Codex, which never hits this shape).Gates (run on the stack tip and on this branch's tip)
cargo fmt --all -- --check✅cargo clippy --workspace --all-targets --all-features -- -D warnings✅ (every branch tip)cargo test --workspace✅ all passing at the stack tip; each intermediate tip compiles and passesqq/qq-core/qq-provideron its own.cargo test -p qq-provider --no-default-features --features test-support✅ 184 passed.qq-clientbuild ✅