You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve native identity for Claude cloud project children in the Anthropic pool - #8886
An Anthropic cloud-project child can send the local_projects entrypoint when it starts a local Claude thread. The managed Anthropic OAuth path currently treats that exact label as an unknown identity, substitutes its generated CLI identity, and removes native-only feature flags. A recorded cloud-to-Desktop request reached the pool and received HTTP 400. The failing request’s wire label and detailed rejection were not retained.
Recognize the exact first-party label when all existing native identity checks pass. Keep the original User-Agent and existing native features on the first-party destination. OpenCodex still selects the serving pool account and binds account metadata to that credential. Ingress classification remains unchanged because the project-child label can come from the generic bridge. T3 and arbitrary entrypoint labels remain excluded.
The local_projects managed OAuth regression failed against the original allowlist and passed with the exact match. It asserts the original User-Agent, preserved per-turn beta, and pool credential and metadata before refresh, after refresh, and after switching accounts. Adapter tests reject T3 and near-matches.
bun test tests/claude-integration/claude-intercept-client-class.test.ts tests/claude-integration/messages-native-oauth.test.ts tests/adapters/anthropic/anthropic-client-identity.test.ts passed 105 tests.
Typecheck, structure check, privacy scan, and diff check passed. Local validation scoped to the affected adapter and interception. Full repository coverage is left to CI.
Live cloud handoff with a patched build is pending. Caller-owned pass-through does not satisfy the acceptance condition. The turn must complete through the managed pool.
Checklist
Scope stays focused and avoids unrelated cleanup.
Docs or release notes were updated when needed.
Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
New Features
Requests from Claude cloud project child sessions are now recognized when they use the exact local_projects entrypoint and required identity headers.
These requests retain their observed identity and access to allowlisted native feature betas, while continuing to follow existing ingress routing rules.
Supported CLI, SDK, and Desktop labels continue to retain first-party native feature betas.
No actionable comments were generated in the recent review.
Walkthrough
The Anthropic client identity check now accepts local_projects as a User-Agent entrypoint. Documentation and tests cover the entrypoint, credential refresh, account switching, and forwarding per-turn beta values.
Changes: Anthropic client identity
Layer / File(s)
Summary
Accept the local_projects entrypoint src/adapters/anthropic/client-identity.ts, structure/data-planes/protocol-paths.md, docs-site/src/content/docs/*/guides/protocol-paths.md, tests/adapters/anthropic/anthropic-client-identity.test.ts, tests/claude-integration/messages-native-oauth.test.ts
The identity check accepts local_projects. Documentation describes its use for Claude cloud project children and existing ingress routing rules. Tests cover rejected fallback values and exercise identity across credential refresh and account switching for both cli and local_projects. The integration test also checks that each upstream request includes the per-turn beta value.
lidge-jun/opencodex#8507: Changes recognition for managed native Anthropic OAuth clients. Both PRs modify the client identity recognition contract.
lidge-jun/opencodex#7838: Changes Claude Code OAuth User-Agent and beta handling on native and translated paths. This PR also covers User-Agent and per-turn beta behavior for managed OAuth identity.
Merge Risk: Minimal · up to dd8ba
This change lets Claude cloud project child sessions keep their native identity through the managed Anthropic pool. The matching is exact, so lookalike and third-party labels are still rejected. Tests and documentation are in place, and no merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: preserving native identity for Claude cloud project children (the exact-match local_projects entrypoint) in the Anthropic pool. The raw summary shows the adapter valid…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: preserving native identity for Claude cloud project children (the exact-match local_projects entrypoint) in the Anthropic pool. The raw summary shows the adapter validation change, the docs, and the tests all address this same entrypoint. The title is specific and matches the PR objectives. The title is 80 characters and 12 words, which is within a reasonable length for a title.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Maintainer question: caller-owned pass-through versus managed OAuth
OpenCodex already has a caller-owned native Messages path. An unmapped Claude model with a genuine caller credential can retain the original User-Agent, billing attribution, and beta headers through that path. Proxy admission and stripped transport headers still apply. An explicit provider/model binding selects the managed route instead, where OpenCodex chooses the credential and shapes the request. The reported Fable request used the managed route. See the native pass-through guide.
The original identity change kept Claude session identity consistent with the upstream request while the pool selected a serving account. The later preamble and beta change narrowed the entrypoint check as recognition gained more effects. #8507 also tied it to retaining the tool names used by Anthropic's server reviews. That history explains the allowlist, but does not establish which additional clients Anthropic supports today.
T3:T3 #28410 intentionally selects t3-code. Claude writes it to both the User-Agent and billing preamble. T3 #29393 reports different API-credit behavior by entrypoint. A genuine API-key SDK session can choose the SDK default at launch. Rewriting just the User-Agent to cli or sdk-ts would leave inconsistent attribution.
Cloud project to Desktop: The installed Anthropic launcher can set local_projects for a project child. An existing host request label can take precedence. The failing request's wire label is still unverified. A diagnostic limited to the parsed entrypoint and required-header validation outcomes could confirm it without recording request content or credentials.
Current support:Anthropic's current guidance distinguishes users signing in to the unmodified Claude Code binary with their own subscription from third-party products intermediating subscription credentials. That is relevant to caller-owned routing. It does not document a label translation or a blanket expansion for pooled OAuth.
Would maintainers prefer to document and test the existing caller-owned pass-through for the cloud handoff, add a narrowly validated first-party entrypoint after confirming the actual wire label, or use an explicit label-to-capability policy for managed requests? The latter would keep original wire attribution and existing credential and destination checks. CLIProxyAPI #7224 is precedent for explicit classification, but does not establish Anthropic approval. The broad matcher remains in draft pending that direction.
clairernovotny
changed the title
Preserve native Anthropic request features for embedded Claude clients
Preserve native identity for Claude cloud project children in the Anthropic pool
Nov 18, 2026
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Add an enabled-pool regression for local_projects.
fixtureConfig() sets anthropicAccountPool.enabled to false at Line 139. This test therefore covers managed OAuth credential continuity, but not enabled-pool routing, which is the central PR workflow.
Keep this test as the direct managed-OAuth control. Add a focused case with the pool enabled and send the coherent local_projects bundle through handleClaudeMessages. Assert the outgoing User-Agent, per-turn beta, selected bearer and account metadata after credential replacement and account switching. This will detect pool-specific routing regressions that the current fixture cannot expose.
This recommendation follows the PR objective that the request completes through the managed pool.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Live verification on Arke (macOS arm64) with a locally compiled OpenCodex runtime from 9cb1e9002: I retried the previously failing cloud-created local Claude Desktop thread with Fable 5.2 still mapped to managed Anthropic OAuth. Claude returned the requested test marker, and the proxy recorded HTTP 200 with a terminal response from a pooled Anthropic account for the same conversation that had previously received HTTP 400. The initial Threads probe still fell back to Messages; the subsequent managed requests completed. This verifies a turn in the existing cloud-created thread. Creating a brand-new cloud-to-Desktop thread was not tested.
Maintainer answer to the design question above: we'll take the narrow option. local_projects is accepted as an exact-match first-party entrypoint for managed Anthropic OAuth identity, the same way sdk-ts was added. The required identity headers and the beta allowlist still apply. Lookalike labels (local_projects-*), third-party labels such as t3-code, and label translation stay out of scope, as your tests already assert.
Before merge, we'll address the Codex P1 by documenting project-child support in the public guide (docs-site/src/content/docs/guides/protocol-paths.md), bring the branch up to date with dev, and run a security review of the identity change. We'll push those changes to this branch, since it allows maintainer edits.
Maintainer integration (lidge-jun, dev-only path in MAINTAINERS.md) at head dd8ba5fab9bd92836ef9e7dac10558d50d9e566f:
Owner decision 2026-11-18: accept the narrow exact-match local_projects entrypoint (no label translation, no other labels).
Up to date with dev (0 behind ab220fd463). All required PR checks pass on this head.
Independent review and explicit security review (gpt-6.2-sol, C4) of the final diff: APPROVE and SECURITY PASS. Exact-label matching; ingress routing, credential selection, bearer placement, the first-party destination and the beta allowlist are unchanged; caller credentials are neither forwarded nor logged. Focused suites: client identity + native OAuth 85/0, intercept classifier 50/0, beta allowlist 80/0, typecheck clean.
Codex P1 resolved by documenting project-child support in the public protocol-paths guide (en/es/tr). The CodeRabbit enabled-pool coverage note is non-blocking: both paths pass the same request-local identity handle to the same builder.
scripts/ci/assert-mergeable-review.sh --maintainer-integration 8886: OK.
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
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
An Anthropic cloud-project child can send the
local_projectsentrypoint when it starts a local Claude thread. The managed Anthropic OAuth path currently treats that exact label as an unknown identity, substitutes its generated CLI identity, and removes native-only feature flags. A recorded cloud-to-Desktop request reached the pool and received HTTP 400. The failing request’s wire label and detailed rejection were not retained.Recognize the exact first-party label when all existing native identity checks pass. Keep the original User-Agent and existing native features on the first-party destination. OpenCodex still selects the serving pool account and binds account metadata to that credential. Ingress classification remains unchanged because the project-child label can come from the generic bridge. T3 and arbitrary entrypoint labels remain excluded.
Related to #8885. This replaces the broad matcher. See the attribution discussion for the rationale.
Verification
local_projectsmanaged OAuth regression failed against the original allowlist and passed with the exact match. It asserts the original User-Agent, preserved per-turn beta, and pool credential and metadata before refresh, after refresh, and after switching accounts. Adapter tests reject T3 and near-matches.bun test tests/claude-integration/claude-intercept-client-class.test.ts tests/claude-integration/messages-native-oauth.test.ts tests/adapters/anthropic/anthropic-client-identity.test.tspassed 105 tests.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
local_projectsentrypoint and required identity headers.