Skip to content

fix(anthropic): recognize TypeScript Agent SDK client identity - #7059

Merged
lidge-jun merged 1 commit into
devfrom
fix/claude-sdk-ts-identity
Oct 13, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/claude-sdk-ts-identity

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Recognize claude-cli/<version> (external, sdk-ts) as a TypeScript Agent SDK client identity. Complete SDK sessions now keep their observed headers and allowlisted native feature betas on first-party Anthropic requests, avoiding the generic-client fallback reported in [Bug]: Native Claude client identity rejects the Agent SDK sdk-ts entrypoint (betas dropped, output_config 400) #7040.
  • Keep required identity headers, anchored UA parsing, scalar bounds, destination isolation and proxy-owned credentials unchanged. Add regressions for every missing required header, malformed/duplicate/oversized UAs, and native beta forwarding with output_config; update the architecture contract and English user documentation.

Closes #7040

Verification

  • Red before the fix: bun test tests/adapters/anthropic/anthropic-client-identity.test.ts — 17 passed, 2 failed on SDK identity acceptance and preserved UA.
  • bun test tests/adapters/anthropic/anthropic-client-identity.test.ts tests/adapters/anthropic/anthropic-beta-allowlist.test.ts tests/adapters/anthropic/anthropic-messages-passthrough-oauth.test.ts — 72 passed, 0 failed after the fix.
  • bun run test:changed — 4,211 passed, 30 skipped, 0 failed across 185 files, compared with origin/dev merge base f5f73ff3970b3b238c4e2fade29ba3f64914f637.
  • bun test tests/ci-workflows/file-size-ratchet.test.ts — 9 passed, 0 failed; no caps raised.
  • bun run typecheck, bun run structure:check, bun run privacy:scan, and git diff --check — passed.
  • In docs-site/: bun install --frozen-lockfile and bun run build — passed; 569 pages built, 79,403 internal links checked.
  • Full local bun run test omitted under the documented resource exception because several implementation worktrees share this machine. Focused regressions and import-connected coverage ran locally; the PR's fast Ubuntu CI provides its configured broader coverage. The 30 changed-suite skips are opt-in live-client scenarios. No live Anthropic request was made.

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. This only expands request-local compatibility recognition; client headers still grant no authorization, and existing credential and destination-isolation tests pass.

Summary by CodeRabbit

  • Compatibility
    • TypeScript Agent SDK requests using the sdk-ts entrypoint now retain their identity headers and allowlisted native feature betas when routed to first-party Anthropic.
  • Documentation
    • Updated protocol guidance to include the sdk-ts entrypoint and its required identity headers.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 13, 2026 15:31
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T15:34:29.873316Z 6ee30bd PR opened
ℹ️ 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 added the bug Something isn't working label Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b2cc2ff7-8d46-49bc-b42c-9d1b601736bf
📥 Commits

Reviewing files that changed from the base of the PR and between f5f73ff and 6ee30bd.

📒 Files selected for processing (4)
  • docs-site/src/content/docs/guides/protocol-paths.md
  • src/adapters/anthropic/client-identity.ts
  • structure/data-planes/protocol-paths.md
  • tests/adapters/anthropic/anthropic-client-identity.test.ts

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

📝 Walkthrough

The Anthropic client identity validator now accepts the TypeScript Agent SDK’s sdk-ts user-agent entrypoint. Tests cover identity preservation and rejection cases. Two protocol-path documents describe the entrypoint and its identity-header behavior.

Changes: TypeScript Agent SDK identity

Layer / File(s) Summary
Accept and verify sdk-ts identity
src/adapters/anthropic/client-identity.ts:24, tests/adapters/anthropic/anthropic-client-identity.test.ts:27, 39–67, structure/data-planes/protocol-paths.md:343–344, docs-site/src/content/docs/guides/protocol-paths.md:152–153
The validator accepts sdk-ts. Tests verify preservation of identity headers, supplied betas, and output_config, and check rejection of missing required headers and malformed, duplicated, or oversized user-agent values. Both documents describe the accepted entrypoint and its header behavior.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 6ee30

The supplied review context indicates that the change adds TypeScript Agent SDK identity support while retaining the existing checks and covering the reported forwarding and rejection cases. No merge-blocking issue is established.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: recognizing the TypeScript Agent SDK client identity in the Anthropic adapter. This matches the implementation, tests, and documentation upda…
Linked Issues check Passed Issue #7040 requires acceptance of the sdk-ts User-Agent entrypoint while preserving required-header and bounded-value checks, with regressions for complete, incomplete, and malformed identities. `s…
Out of Scope Changes check Passed The changes stay within Issue #7040. The source change is limited to the Anthropic client-identity entrypoint allowlist. The identity regressions validate the requested behavior and preserve existing …
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • 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

Comment @coderabbitai help to get the list of available commands.

@lidge-jun
lidge-jun merged commit 39f5654 into dev Oct 13, 2026
34 checks passed
@lidge-jun
lidge-jun deleted the fix/claude-sdk-ts-identity branch October 13, 2026 15:44
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration record (MAINTAINERS.md dev exception): squash-merged into dev by @lidge-jun without a second maintainer approval as part of the 2026-10-14 triage. Exact-head verification: every required check on head 6ee30bd9cb88288f74128b5a647d3cd2f9892361 completed successfully (typecheck, test shards 1–4, gates, structure gate, hygiene, enforce-target, docs build, storage policy, api usage, docker smoke, npm-global ubuntu, keyring ubuntu; macOS/Windows jobs skipped per the PR CI policy). The merge was pinned to that head with --match-head-commit. No outstanding maintainer change requests. Low-risk, non-UI bug fix with a focused regression test.

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.

1 participant