Skip to content

Preserve native identity for Claude cloud project children in the Anthropic pool - #8886

Merged
lidge-jun merged 4 commits into
lidge-jun:devfrom
clairernovotny:fix/claude-client-compatibility
Nov 18, 2026
Merged

lidge-jun merged 4 commits into
lidge-jun:devfrom
clairernovotny:fix/claude-client-compatibility

Conversation

@clairernovotny

@clairernovotny clairernovotny commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

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.

Related to #8885. This replaces the broad matcher. See the attribution discussion for the rationale.

Verification

  • 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.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • 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: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9cb1e90 and dd8ba5f.

Files selected for processing: 3

  • docs-site/src/content/docs/es/guides/protocol-paths.md
  • docs-site/src/content/docs/guides/protocol-paths.md
  • docs-site/src/content/docs/tr/guides/protocol-paths.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ 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.

0/4 boxes ticked.

Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked.

Hygiene

✅ Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as ready for review November 18, 2026 00:35
@clairernovotny
clairernovotny marked this pull request as draft November 18, 2026 00:41
@clairernovotny

Copy link
Copy Markdown
Contributor Author

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 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
@clairernovotny
clairernovotny marked this pull request as ready for review November 18, 2026 01:31
Copilot AI balanced review requested due to automatic review settings November 18, 2026 01:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T10:04:28.778914Z dd8ba5f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions
github-actions Bot marked this pull request as draft November 18, 2026 01:32
@clairernovotny
clairernovotny marked this pull request as ready for review November 18, 2026 01:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9cb1e9002c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread structure/data-planes/protocol-paths.md Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1

tests/claude-integration/messages-native-oauth.test.ts-330-330: 1

330-330: Trivial · Maintainability & Code Quality · Quick win

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.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4d110ec and 9cb1e90.

Files selected for processing: 4

  • src/adapters/anthropic/client-identity.ts
  • structure/data-planes/protocol-paths.md
  • tests/adapters/anthropic/anthropic-client-identity.test.ts
  • tests/claude-integration/messages-native-oauth.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@clairernovotny

Copy link
Copy Markdown
Contributor Author

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.

@lidge-jun

Copy link
Copy Markdown
Owner

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.

@github-actions
github-actions Bot marked this pull request as draft November 18, 2026 09:57
@lidge-jun

Copy link
Copy Markdown
Owner

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.

Closes #8885.

@lidge-jun
lidge-jun marked this pull request as ready for review November 18, 2026 10:00
@lidge-jun
lidge-jun merged commit 8ff612d into lidge-jun:dev Nov 18, 2026
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants