Repository navigation
Conversation
… tool tails Claude Code 2.1.270+ appends passive runtime telemetry reminders such as <system-reminder><total_tokens>N tokens left</total_tokens></system-reminder>, Token usage, USD budget, and Output tokens after tool_result blocks (either inside the tool_result user message or as a trailing user message). Because tail_is_successful_tool_result() only ignored whitespace-only text blocks, resolved closeout tool exchanges (e.g. SendMessage) fell back to the 11-attempt full-context retry loop (~200s) and returned HTTP 503. Add a strict, bounded lexical allowlist for passive Claude Code numeric telemetry <system-reminder> segments and borrow-peel trailing user messages that contain exclusively whitespace or those passive telemetry reminders. Unknown <system-reminder> envelopes (PostToolUse hooks, SessionStart context), queued user commands, trailing system messages, and unmatched/error tool results remain ineligible.
This branch has not been deployed
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
503 Codex completed without producing outputobserved on Claude Code2.1.270+when Codex legitimately ends a turn with no additional output immediately after a resolvedtool_result(e.g., a finalSendMessagestatus update).2.1.270+appends passive runtime telemetry reminders (total_tokens_reminder,token_usage,budget_usd,output_token_usage) as<system-reminder>...</system-reminder>text blocks immediately aftertool_result(either inside thetool_resultusermessage or as a trailingusermessage). Previouslytail_is_successful_tool_result()only ignored whitespace-only text blocks (text.trim().is_empty()), so those requests fell back to the 11-attempt full-context retry loop and returned503.is_ignorable_tool_tail_text/is_passive_claude_code_telemetry_reminder) and borrow-peels trailingusermessages containing exclusively whitespace or those passive numeric telemetry<system-reminder>blocks.Preserved Safety Invariants
<system-reminder>envelopes (PostToolUse hook: continue,SessionStart hook additional context, etc.),queued_commanduser messages, trailingrole: "system"messages, arbitrary text outside<system-reminder>tags, nested/malformed tags, non-string/non-text blocks, and partial/unmatched/errortool_resulttails remain ineligible and continue to retry / fail closed.Messageretains onlyroleandcontent, so this is a narrow lexical allowlist rather than authenticated provenance;body.messagesis borrowed rather than mutated, leaving translation and continuation state unchanged.Verification
rust-baseline-20261018t033240z:1.98.0-bullseye:cargo fmt --all -- --checkcargo clippy --locked --offline -j 64 --all-targets -- -D warningscargo test --locked --offline -j 64: all suites passed (including979unit tests,2tests intests/codex_empty_tool_completion.rscovering positive/negative telemetry cases and statefulAutocontinuation recovery, and55smoke tests).