Repository navigation
fix(usage): keep healthy provider usage after auth failures - #124367
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 10:48 PM ET / August 16, 2026, 02:48 UTC. ClawSweeper reviewWhat this changesThe PR isolates provider-specific authentication failures so usage summaries retain healthy provider snapshots and represent the failed provider as an error snapshot. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo blocking source findings. This active maintainer-owned repair remains necessary: current main lets a rejected provider auth hook abort the whole usage summary, while the branch isolates that failure without changing direct resolver rejection behavior. Priority: P2 Review scores
Verification
How this fits togetherProvider-usage loading resolves credentials for configured providers, then fetches each provider’s quota snapshot for status consumers. This change sits between plugin auth resolution and the summary returned to Gateway and status surfaces. flowchart LR
A[Configured providers] --> B[Provider auth resolution]
B --> C{Auth succeeded?}
C -->|Yes| D[Fetch usage snapshot]
C -->|No| E[Create provider error snapshot]
D --> F[Ordered usage summary]
E --> F
F --> G[Gateway and status consumers]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +23, Tests +42. Total +65 across 5 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep provider-scoped error capture at the summary boundary, retain direct resolver rejection semantics, and avoid broadening the resolver into a new global result contract. Do we have a high-confidence way to reproduce the issue? Yes—from source: reject one provider auth hook before a later healthy provider on current main, and the sequential await exits the summary before that later provider is collected. Is this the best way to solve the issue? Yes. The opt-in summary callback retains the resolver’s existing direct-call contract while recording the failure at the owner that can return an ordered usage result. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b170c2c02179. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper rank-up moves are satisfied on unchanged head
No ClawSweeper finding was skipped and no additional source change was required. |
|
Merged via squash.
|
…#124367) * fix(usage): isolate provider auth failures * fix(usage): preserve direct auth failures
What Problem This Solves
Fixes an issue where one provider usage auth hook rejecting could make the entire provider-usage request fail, hiding otherwise healthy provider quota snapshots.
Why This Change Was Made
Provider auth is still resolved in the existing deterministic descriptor order, but
resolveProviderAuthsnow lets the summary owner receive a provider-scoped error.loadProviderUsageSummaryconverts only those opted-in errors into the same snapshot shape already used for fetch failures and timeouts, then restores descriptor order across healthy and failed results. DirectresolveProviderAuthscallers that do not supply the error owner still receive the exact original rejection object.This leaves the #124131 cache boundary intact: the exact
OpenClawConfigobject remains the cache/dedupe identity and is passed unchanged intoloadProviderUsageSummary. There is no provider auth, routing, config, default, billing, protocol, or schema contract change.User Impact
Usage/status surfaces now keep healthy providers visible when a sibling provider's auth resolver fails. The failed provider appears with its existing error snapshot instead of blocking the whole response.
No changelog entry: this is a narrow internal reliability repair with no new user-facing surface.
Evidence
2585edba2efda9ff50e6bed0a6de8cfaef8254fc; production+89/-78, net +11. Tests/test support+54/-0.tbx_01m045cxt2tcf1cb9qmmw5at87, run 31921321514.success → HTTP 503 → timeout → auth failure, exact endpoint requests1/1/1/0, a live late timeout socket at result time, and verified Gateway listener plus isolated-state cleanup.git diff --checkis clean.Codex contract inspection at
openai/codex@57f42a81131ccf5933e7ec5dc659c381eeb5d72b:TokenCountRelated sequencing:
provider-usage.load.ts; it should rebase after this repair and preserve provider-level auth-failure isolation.