Repository navigation
fix(agents): avoid API key billing copy for OAuth - #80895
TurboTheTurtle wants to merge 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Source inspection shows current main always emits API-key/top-up billing copy and lacks credential mode at the formatter boundary, while the linked issue gives a concrete Anthropic Max OAuth path. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this narrow formatter/context propagation fix after ordinary maintainer review, keeping API-key billing copy unchanged while using neutral recovery copy for OAuth/token-backed credentials. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main always emits API-key/top-up billing copy and lacks credential mode at the formatter boundary, while the linked issue gives a concrete Anthropic Max OAuth path. Is this the best way to solve the issue? Yes. Passing the already-known auth profile mode into the central formatter and downstream synthesis points is the narrowest maintainable fix, and it avoids changing billing classification semantics for API-key callers. Acceptance criteria:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a978f0fe3671. |
|
Closing this out to reduce the older open PR queue. It had sufficient proof and green checks, but it has been sitting without much maintainer movement and lacks the newer ready-for-maintainer-look/automerge signals. Happy to reopen or re-spin if maintainers want this direction later. |
Summary
Root Cause
Billing-shaped errors were formatted without knowing whether the active Anthropic credential was an API key, OAuth, or token. Once a Claude CLI/Max OAuth error was classified as billing-shaped, it reused API-key top-up wording even though there was no API key to top up.
Real behavior proof
fix/anthropic-oauth-billing-message, running production error-formatting modules throughnode --import tsx.formatAssistantErrorText, formats the same Anthropic usage-cap-shaped error once withauthProfileMode: "oauth"and once withauthProfileMode: "api_key", and prints the observed user-facing text checks.{ "oauth": "⚠️ Anthropic (claude-sonnet-4-6) returned a temporary account or usage-limit error while using OAuth credentials. OpenClaw will retry when the provider recovers; please try again in a minute.", "oauthMentionsApiKey": false, "oauthMentionsTopUp": false, "apiKeyMentionsApiKey": true }oauthMentionsApiKeywasfalse,oauthMentionsTopUpwasfalse, and the API-key path still retained API-key billing copy.Validation
pnpm test src/agents/pi-embedded-helpers.formatassistanterrortext.test.ts src/agents/pi-embedded-runner/run/assistant-failover.test.ts -- --reporter=verbosepnpm test src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts -- --reporter=verbosepnpm check:changed -- --base upstream/maingit diff --checkAttribution
If this PR is squashed or reworked, please preserve author attribution or include:
Co-authored-by: Andy Ye <[email protected]>Closes #80877