Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 1:49 AM ET / 05:49 UTC. ClawSweeper reviewWhat this changesThe PR skips unsupported Anthropic setup-token quota requests, preserves configured web-session fallback, and adds credential-type metadata, regression coverage, and documentation. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main and v2026.9.5. No blocking correctness finding remains; the recorded compatibility acceptance and production-path evidence support this replacement PR. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s provider usage subsystem turns configured credentials into quota and billing snapshots for status displays. The Anthropic plugin chooses the appropriate usage endpoint or skips credentials that cannot authorize quota requests. flowchart TD
A[Configured credentials] --> B[Anthropic usage selection]
B --> C[Admin billing]
B --> D[OAuth quota]
B --> E[Stored setup token]
E --> F[Configured web session or skip]
C --> G[Usage displays]
D --> G
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +62, Tests +249, Docs 0. Total +311 across 8 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep credential selection authoritative and apply the accepted setup-token policy in the existing Anthropic usage owner, preserving OAuth, Admin API, and configured web fallback. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: a selected stored Anthropic token profile reaches OAuth usage polling on current main. This review did not run a live current-main provider reproduction. Is this the best way to solve the issue? Yes. Stored profile metadata avoids unreliable token-prefix classification, preserves credential ordering, and reuses the existing web fetcher under an accepted compatibility policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 80bab7e23ce0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Fixing this while preserving the web-session fallback, without widening the public plugin SDK, needs the ownership refactor described in #156296. Closing this proposal in favor of that work. Thank you @saariuslystoned and @RamiNoodle733 for investigating and contributing fixes. |
Replaces #155805 (maintainer edits disabled); credit @saariuslystoned and @RamiNoodle733. Their original commits are preserved without rewriting.
Follow-up to #146726
Closes #143419 and carries the compatibility repair from #146726 onto a branch writable by this account.
What Problem This Solves
Fixes: Anthropic setup-token profiles poll
/api/oauth/usage, which those tokens cannot authorize, and then surface a misleading quota error.User Impact
User impact: a stored Anthropic setup-token profile no longer makes the unsupported OAuth usage request. If a claude.ai web session is configured, quota loads from that fallback; if that fallback fails, status shows
Claude web usage unavailable. Existing OAuth and API-key profiles keep their previous usage paths.Why This Change Was Made
Classification uses the stored auth-profile type. Anthropic setup-token onboarding persists
type: "token"; OAuth login persiststype: "oauth"even when the access token uses thesk-ant-oat01-shape; API keys persisttype: "api_key". Token prefix alone must not suppress usage.Compatibility decision
Maintainer decision — 2026-09-23: Ayaan accepted this compatibility tradeoff: “go for it, claude's setup-token is inference only”. Stored Anthropic
type: "token"profiles skip OAuth usage polling, including manually pasted bearer credentials that might otherwise have usage scope.Evidence that this is the stored-profile contract, not an over-broad skip:
type: "token"are setup-token auth andmodels auth paste-token, both validated byvalidateAnthropicSetupToken.type: "oauth". API-key auth writestype: "api_key".typeScore0) over token (1) over API key (2).sk-ant-oat01-credential with no stored token profile still uses the OAuth usage path.No code change in this follow-up. If later evidence shows a supported Anthropic writer storing a working OAuth usage token as
type: "token", narrow then.Evidence
Exact head:
c119d0e89f4673d1750cdccd5000b5bd6b5bfba8Isolated disposable store only. Temporary
HOME/OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH, loopback HTTP fixtures, synthetic sentinels. No live user Gateway, no inference/chat, no real provider request.After-fix request counters and usage snapshots from the PR-head Anthropic usage owner plus official auth-profile upsert:
/api/oauth/usagetype: "token"){ handled: true }, provider omittedtype: "token"profileclaude.aiorgs=1, usage=15hwindow at 17%claude.aiorgs=1error: "Claude web usage unavailable"{ handled: true }(unchanged; not setup-token)5hwindow at 23%5hat 23%type: "token", then skippedCommands:
All passed.
The earlier contributor proof above used the registered plugin owner. The additional CLI verification below exercises the shipped status entry point.
The original PR head branch is owned by another fork and cannot be updated by this account; this follow-up preserves the repair without force-pushing or changing the original PR.
Maintainer CLI verification (2026-09-23)
Ran the supported
pnpm openclaw status --usage --json --timeout 2000entry point at the exact head with isolated synthetic auth stores, official auth-profile upsert, and a fetch-boundary response fixture (no real provider calls). All three commands exited 0:providers: [], no misleading quota error5husage at 23%HTTP 403: scope requirement user:profileThe authorization-error control verifies that the status path exposes a genuine denial rather than suppressing all usage errors; it is not a pre-fix binary run. The 39 focused tests across the three files listed above also passed again.
The replacement adds one test-only commit updating three credential-selection expectations for the new
profileTypemetadata. Production code and CLI behavior are unchanged from the contributor head.Replacement verification:
node scripts/run-vitest.mjs src/infra/provider-usage.auth.normalizes-keys.test.ts --maxWorkers=1— all 17 tests passed, including the three formerly failing expectations.