Conversation
immakermatty
marked this pull request as ready for review
October 15, 2026 22:25
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.
Claude Code Agent SDK threads repeatedly fail with HTTP 400 because CLIProxyAPI derives a new Anthropic-Beta header from a delta request that omits the tools used to derive the creation header. The client then replays the entire conversation, increasing failure counts and latency.
This change retains the exact upstream beta header with the existing bounded per-message tool-alias state, shared by scoped executor copies. Continuations reuse that header when the SDK omits optional betas or explicitly names an already emitted beta. Missing state, a changed account/upstream, a genuinely new caller beta, or changed operator beta overrides returns the existing request-scoped 404 replay signal. An incomplete delta is never sent to a different account. OAuth token changes under the same auth record remain compatible with the cached state. Business payloads remain unchanged after operator payload rules.
The fork's main and dev branches were synchronized by fast-forward to upstream 5be2cda before this fix. This PR changes only four Claude executor/test files. The existing routing, quota cooldowns and account priorities are preserved. Runtime rollout is limited to the operator's local macOS installation; organization fleets are outside this change.
Validation:
GOMAXPROCS=4 go test -p 4 ./...passes on b1735ad. An earlier unrelated WebRTC test timed out during initial compilation; isolated rerun and both subsequent full suites pass.GOMAXPROCS=4 go test -p 2 -race ./internal/runtime/executor ./sdk/cliproxy/authpasses on b1735ad.Thread state remains bounded and in memory. Restarts, executor replacement and eviction can require the client's full replay; actual provider quotas and outages remain possible. Historical failure counters are not evidence of new failures. No credential material, user prompts, or account identities are included.