Conversation
|
This pull request targeted The base branch has been automatically changed to |
There was a problem hiding this comment.
Code Review
This pull request introduces short-circuiting for Claude sample requests (when max_tokens is 1) to return mock responses directly, and strips the context-1m-2025-08-07 beta header for OAuth upstreams to prevent 429 errors. The review feedback suggests flushing the response writer immediately for streaming/SSE responses to prevent buffering issues by intermediate proxies.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50ea891610
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@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: 45c767985a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| func isClaudeMaxTokensOneProbe(rawJSON []byte) bool { | ||
| maxTokens := gjson.GetBytes(rawJSON, "max_tokens") | ||
| return maxTokens.Exists() && maxTokens.Type == gjson.Number && maxTokens.Int() == 1 |
There was a problem hiding this comment.
Compare max_tokens without truncating fractional values
When max_tokens is a fractional JSON number such as 1.5, gjson.Result.Int() truncates it to 1, so this predicate misclassifies the request as a probe and returns the synthetic 200 response. This masks the invalid non-integer parameter instead of allowing normal request validation or upstream handling; require the numeric value to be exactly integer 1 before short-circuiting.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a82a83e876
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| cfg.Codex.StreamBootstrapBuffering = true | ||
| cfg.Codex.StreamBootstrapTimeout = DefaultCodexBootstrapTimeout |
There was a problem hiding this comment.
Avoid enabling buffering without an enforceable deadline
When a Codex SSE upstream emits an initial bufferable event such as response.created and then sends no further complete line, enabling buffering by default with a 30-second timeout can leave downstream headers uncommitted indefinitely. The timeout in codex_executor_stream.go is checked only after scanner.Scan() returns another line, so it cannot release the already buffered event while the scan is blocked; native Responses clients that previously received response.created immediately can therefore hit reverse-proxy/client read timeouts despite this configured ceiling. Use an asynchronous release mechanism or keep buffering opt-in for this path.
Useful? React with 👍 / 👎.
# Conflicts: # internal/runtime/executor/codex_executor_request.go # internal/runtime/executor/codex_websockets_request.go
This reverts commit b3abf60.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
max_tokens=1requestscontext-1m-2025-08-07silent fallback logic intacte17b18dWhy
Claude Code uses
max_tokens=1for several probe flows such as API key verification, model validation, and quota preflight. The later predicate tightening caused some valid probe shapes to bypass the local short-circuit and hit upstream, which breaks compatibility for requests that only need an HTTP 200 Claude Messages response.This PR keeps the working behavior from the earlier branch state while still retaining the separate
context-1m-2025-08-07OAuth downgrade fix.Notes
mainwas first synced to the latest upstreammain5e4bd686and3da61624from the feature branch history while keepingd531723ande17b18d