fix(ai): include native Anthropic OAuth billing fingerprint - #1398
Open
chupe wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Adds the missing billing fingerprint to native Anthropic OAuth requests, together with the external CLI user-agent suffix and Agent SDK identity. The fingerprint uses the first serialized user text block and browser-safe SHA-256. The existing supported client version remains
2.1.251.This is separate from the version-floor fix in #1289 and the stale version fixed in pi-anthropic-auth #60. The related OMO #3892 targeted OpenCode and closed without merging.
Behavior
cc_version,cc_entrypoint=sdk-cli, andcchfields before payload hooks run.Verification
bun run checkbuild:offlineExact commands and sanitized receipts are retained locally under
local-ignore/qa-evidence/20260905-oauth-upstream/(red.txt,green.txt,cli-qa.json,README.md), excluded from Git per repository policy. The CLI proof uses the repository's Senpi QA sandbox and fake-model helpers.Scope and risk
The change is confined to the native OAuth branch. Fingerprint input edge cases, payload-hook preservation, browser imports, and non-OAuth paths have regression coverage. No real provider credentials were used for these checks. LSP could not initialize with the installed TypeScript 7 tooling; the actual repository compiler passed.
Summary by cubic
Fixes native Anthropic OAuth requests being rejected for missing the deterministic billing fingerprint and external CLI/Agent SDK identity.
Adds a
x-anthropic-billing-headersystem block (cc_version,cc_entrypoint=sdk-cli,cch) derived from the first serialized user text block via browser-safe SHA-256, plus the(external, cli)user-agent suffix and Agent SDK identity. The block is prepended before payload hooks run, and only the native OAuth branch is affected; API-key, Cloudflare, and Copilot requests stay unchanged.Bug Fixes
Written for commit 770262f. Summary will update on new commits.