Repository navigation
feat(logs): record the Anthropic pool account tag on each attempt - #8520
Merged
Merged
Conversation
added 2 commits
November 11, 2026 10:44
Anthropic pool attempts carried no account attribution field: the pool folds the account into the logged provider (anthropic-p<hex6>) and stampOAuthAccountLabel skips it, so accountLogLabel consumers saw nothing. Each request-log attempt and row now carries accountTag, the p-label already in the provider suffix (no new identifier). It is derived from the attempt's frozen provider in sealRequestAttemptIdentity, so on the native Messages and translated Responses paths a failover attempt carries the replacement account's tag. usage.jsonl normalization and request-log hydration keep only p<hex6> values. accountLogLabel and per-account summaries are unchanged. Refs #8383
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
Caution Review failedThe pull request is closed.
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. |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
Owner
Author
|
Maintainer judgment
|
3 tasks done
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
Request-log rows for the Anthropic OAuth pool carried no account attribution field (#8383, part 1).
stampOAuthAccountLabelskipsanthropicon purpose, becauseformatAnthropicProviderForLogfolds the account into the logged provider (anthropic-p2e22d0). A consumer readingaccountLogLabeltherefore saw almost no Anthropic attribution and had to parse the provider suffix.Each Anthropic pool attempt and row now records
accountTag, thep-label already in that provider name (anthropic-p2e22d0→p2e22d0). No new identifier is introduced, andaccountLogLabeland the per-account usage summaries from #2699 are unchanged.sealRequestAttemptIdentitysets the tag from the attempt's frozen provider. This covers the native Messages and translated Responses paths, plusanthropic2, without touching dispatch.usage.jsonl, reads back, and request-log hydration keep onlypplus six lowercase hex digits. Attempt hydration previously copied attempt fields unchecked and now validates this one.Owner decisions on the rest of #8383: part 2 (hashed session and worker keys that link requests) is declined, and part 3 (binding lifecycle events) is not scheduled. This PR implements part 1 only.
One limitation: a translated request with the pool turned off logs plain
anthropicwith no suffix, so it has no tag. A test pins this down. Tagging it would need a new identifier, which the owner decision excludes.Closes #8383
Verification
bun test tests/usage/request-log-anthropic-account-tag.test.tswithsrc/atdevgave 1 pass, 18 fail (for exampleExpected: "pba037e" Received: undefinedfor the native and translated attempt tags). With the change it gives 19 pass. The cases drive real requests throughhandleClaudeMessagesandhandleResponses:summarizeUsageoutput with and without the tag;dev(the PR diff is byte-identical, samegit patch-id), on the request-log and usage suites, native Messages OAuth, layout, ratchet and Lab boundary: 271 pass, 0 fail.src/server/request-log.tsstays at 1,998 lines.bun run typecheck,bun run structure:checkandbun run privacy:scan: pass.test:changed(run by the implementing lane alongside another worktree's suite): 36,621 pass, 99 fail across 26 files, none of which touch request logging or usage. Each was rerun alone: 19 fail the same way ondev(launcher and update subprocess timeouts,config_busy, link end to end, catalog and others), 6 passed on a rerun as timing flakes, andclient-connectpassed alone.bun run test;lint:gui(nogui/change); macOS/Windows CI (manualdevbatch only).Checklist