Repository navigation
Stop Claude Code from retrying the mock's deliberate 400 - #201
Merged
Merged
Conversation
Claude Code 2.1.304 retries the deterministic 400 returned by the Anthropic mock, so claude_session_emits_traces hits the mock's panic arm and times out. The harness set ANTHROPIC_MAX_RETRIES, which Claude Code never reads; it honors CLAUDE_CODE_MAX_RETRIES. The Anthropic mock now also sends x-should-retry: false on error replies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…request After the deterministic 400, Claude Code 2.1.304 reissues the request with ToolSearch disabled. That fallback ignores CLAUDE_CODE_MAX_RETRIES. Start with ToolSearch off so the fallback never applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
claude_session_emits_tracesstarted failing in the Daemon job on all platforms ("Test coding-agent integrations with deterministic inference", e.g. run 39333251206) once CI picked up Claude Code 2.1.304. The last greenmainrun (39312258447) used 2.1.303.The mock answers request 2 with a deliberate HTTP 400
invalid_request_error. Claude Code 2.1.304 now sends another request after that 400, which lands in the mock'spanic!arm. Two separate mechanisms cause it:ANTHROPIC_MAX_RETRIES=0, and Claude Code never reads that variable. Claude Code's own limit isCLAUDE_CODE_MAX_RETRIES.CLAUDE_CODE_MAX_RETRIESdoesn't govern this fallback. In 2.1.301, ToolSearch is off by default whenANTHROPIC_BASE_URLisn't a first-party host, so this path never ran there.Changes
tests/support/agents/claude.rs: setCLAUDE_CODE_MAX_RETRIES=0(instead ofANTHROPIC_MAX_RETRIES=0) andENABLE_TOOL_SEARCH=false. A falsy value selects Claude Code'sstandardtool mode, so the run never starts with ToolSearch and there's nothing to fall back from.tests/support/inference/mod.rs: add anerror_responsehelper that sendsx-should-retry: false. Claude Code's HTTP retry check honors this header before it looks at the status code.tests/support/inference/anthropic.rs: useerror_responsefor the decode-error reply and forMockReply::HttpError.The OpenAI mock is unchanged. The panic arm and the
== 3request-count assertion are also unchanged.Testing
claude_session_emits_tracespasses locally on Claude Code 2.1.301 (exactly 3 requests).cargo fmt --checkandcargo clippy --all-features --all-targets -- -D warningsare clean.🤖 Generated with Claude Code