Skip to content

fix: preserve usage account attribution across retries - #2379

Open
yangeni wants to merge 1 commit into
jlcodes99:mainfrom
yangeni:fix/usage-account-attribution-v1.3.47
Open

yangeni wants to merge 1 commit into
jlcodes99:mainfrom
yangeni:fix/usage-account-attribution-v1.3.47

Conversation

@yangeni

@yangeni yangeni commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep request token usage attached to the account that produced the usage callback.
  • Do not let a later retry or selector snapshot overwrite that account with another account.
  • Preserve selector fallback only when no usage callback exists or the callback AuthID matches.
  • Keep mismatched or unmapped usage unattributed rather than charging a different account.

Scope

  • Does not change routing, retries, model pricing, quota querying, WebSocket execution IDs, or existing request logs.
  • Does not rewrite historical billing records; historical reassignment requires original request-level evidence.
  • No credentials or private account data are included.

Verification

  • go test ./...
  • go test -race ./... for the affected package
  • Windows amd64 cross-compile test completed locally; CI remains the runtime verification surface.

The regression tests cover selector changes after usage, missing selector state, matching AuthID fallback, multiple successful usage records, and API-key attribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant