fix: apply Claude config and preserve Codex proxy identity#201
Conversation
|
Warning Review limit reached
More reviews will be available in 18 minutes and 19 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesClaude config async delegation to applyClaudeConfig
Codex client identity header forwarding
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Update pushed in Changes:
Validation:
Note: @coderabbitai review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
cli/builtin-proxy.js (1)
69-71: 💤 Low valueThe default user-agent is Mac-specific but used cross-platform.
The
DEFAULT_CODEX_USER_AGENTincludes Mac-specific metadata (Mac OS 26.0.1; arm64andApple_Terminal/464). When this proxy runs on Linux or Windows and the incoming request lacks a codex-compatible user-agent, upstream will see Mac metadata. This is likely intentional to ensure consistent upstream behavior, but document this design choice if cross-platform accuracy matters.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cli/builtin-proxy.js` around lines 69 - 71, The DEFAULT_CODEX_USER_AGENT constant at the top of the file contains hardcoded Mac-specific metadata (Mac OS 26.0.1; arm64 and Apple_Terminal/464) that is used cross-platform. Add a comment above the DEFAULT_CODEX_USER_AGENT constant definition explaining that this Mac-specific user agent is intentionally used as the default across all platforms (Linux, Windows, Mac) to ensure consistent upstream behavior, clarifying the design choice for why platform-specific user agents are not generated dynamically.tests/unit/builtin-proxy-responses-shim.test.mjs (1)
131-169: ⚡ Quick winConsider testing custom header forwarding.
The test verifies that default Codex identity headers are sent upstream when the incoming request lacks them. Consider adding a test that sends custom
user-agent,version,openai-beta, andoriginatorheaders in the proxy request, then asserts those custom values are forwarded upstream. This would verify the implementation correctly forwards client-provided identity metadata rather than always using defaults.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/builtin-proxy-responses-shim.test.mjs` around lines 131 - 169, Add a new test function that verifies custom identity headers are forwarded upstream when provided by the client. Create a test similar to the existing 'builtin-proxy /v1/responses sends Codex client identity upstream' test, but this time include custom values for the 'user-agent', 'version', 'openai-beta', and 'originator' headers in the request body sent to the proxy, then assert that these exact custom values (rather than defaults) are captured in the upstream request headers. This ensures the proxy correctly forwards client-provided identity metadata instead of always using defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@cli/builtin-proxy.js`:
- Around line 69-71: The DEFAULT_CODEX_USER_AGENT constant at the top of the
file contains hardcoded Mac-specific metadata (Mac OS 26.0.1; arm64 and
Apple_Terminal/464) that is used cross-platform. Add a comment above the
DEFAULT_CODEX_USER_AGENT constant definition explaining that this Mac-specific
user agent is intentionally used as the default across all platforms (Linux,
Windows, Mac) to ensure consistent upstream behavior, clarifying the design
choice for why platform-specific user agents are not generated dynamically.
In `@tests/unit/builtin-proxy-responses-shim.test.mjs`:
- Around line 131-169: Add a new test function that verifies custom identity
headers are forwarded upstream when provided by the client. Create a test
similar to the existing 'builtin-proxy /v1/responses sends Codex client identity
upstream' test, but this time include custom values for the 'user-agent',
'version', 'openai-beta', and 'originator' headers in the request body sent to
the proxy, then assert that these exact custom values (rather than defaults) are
captured in the upstream request headers. This ensures the proxy correctly
forwards client-provided identity metadata instead of always using defaults.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 89e34ca9-2114-441d-9c23-c21119619983
📒 Files selected for processing (2)
cli/builtin-proxy.jstests/unit/builtin-proxy-responses-shim.test.mjs
📜 Review details
🔇 Additional comments (4)
cli/builtin-proxy.js (3)
74-79: LGTM!
81-99: LGTM!
1848-1848: LGTM!tests/unit/builtin-proxy-responses-shim.test.mjs (1)
465-468: LGTM!
|
Follow-up pushed in Root cause refined:
Additional fix:
Validation:
@coderabbitai review |
|
✅ Action performedReview finished.
|
|
Follow-up pushed in Root cause refined:
Additional fix:
Validation:
@coderabbitai review |
|
Follow-up pushed in {"error":{"message":"Only Codex clients can use this group (detected: codex_cli_rs/0.98.0 (Mac OS 26.0.1; arm64) Apple_Terminal/464 / codex-tui)","code":"access_denied"}}Root cause refined:
Additional fix:
Validation:
@coderabbitai review |
|
✅ Action performedReview finished.
|
|
Docs follow-up pushed in Requested README update:
Validation for this docs-only follow-up:
Existing code validation from the latest functional change still applies:
@coderabbitai review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cli/openai-bridge.js`:
- Around line 1656-1673: The current implementation disables the request timeout
when SSE headers are detected (via the setTimeout(0) call in the
text/event-stream condition block) and ignores timeout callbacks after
streamAccepted is set to true. This creates a vulnerability where if upstream
sends the SSE headers but then stalls without sending any data, the response
hangs indefinitely. Add an idle timer mechanism that activates after the SSE
headers are accepted to monitor for data flow on the upstreamRes. This idle
timer should reset each time a data chunk is received on upstreamRes and should
trigger a timeout event if no data arrives within a specified idle threshold,
allowing the promise to settle and the client to disconnect gracefully rather
than hanging.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0389cb20-f04b-4f95-9858-1d8ce6033cbf
📒 Files selected for processing (6)
README.mdREADME.zh.mdcli/builtin-proxy.jscli/openai-bridge.jstests/unit/builtin-proxy-responses-shim.test.mjstests/unit/openai-bridge-upstream-responses.test.mjs
✅ Files skipped from review due to trivial changes (1)
- README.zh.md
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/unit/builtin-proxy-responses-shim.test.mjs
- cli/builtin-proxy.js
📜 Review details
🔇 Additional comments (3)
cli/openai-bridge.js (2)
14-17: LGTM!Also applies to: 28-62
1815-1817: LGTM!Also applies to: 1908-1908, 1985-2024, 2037-2038, 2072-2072, 2134-2134
tests/unit/openai-bridge-upstream-responses.test.mjs (1)
95-168: LGTM!Also applies to: 171-234
|
Version follow-up pushed in Requested update:
Validation:
@coderabbitai review |
|
✅ Action performedReview finished.
|
|
CodeRabbit follow-up pushed in Fix:
Tag update:
Validation:
@coderabbitai review |
|
✅ Action performedReview finished.
|
Summary
applyClaudeConfig(name)path used by manual selection--bridge openaiupstream requests/v1/responsesrequests on upstream Responses first, only falling back to/chat/completionswhen Responses is explicitly unsupportedOriginatortocodex_cli_rseven when the local TUI sendscodex-tui, matching Codex-only upstream gates0.0.53and update git tagv0.0.53to point at PR headd1223be4eb12704974d5822b840e42dfa16d09aaValidation
node --input-type=module ...targeted harness fortests/unit/claude-settings-sync.test.mjs→ 34 tests passednode --test tests/unit/builtin-proxy-responses-shim.test.mjs→ 18 tests passednode --test tests/unit/openai-bridge-upstream-responses.test.mjs→ 23 tests passednpm run lint→ passed for 220 filesnpm run test:unit→ 661 tests passedgrepfor the new Codex fingerprint wordinggrepfor no remaining0.0.52/v0.0.52matches outside dependencies/git metadataNotes
npm cireported existing dependency audit warnings before validation; no dependency changes were made.npm run test:unitruns emit the existingsearch_sessions.py --limit -1usage message at the end while exiting 0.Go-http-client/1.1), then failed onOriginator: codex-tui; the latest code normalizes the upstream Codex originator while preserving the Responses-first streaming behavior.