Repository navigation
fix(gateway): provider usage follows reloaded account config - #124131
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 5:39 AM ET / 09:39 UTC. ClawSweeper reviewWhat this changesThe PR passes the runtime configuration captured by the provider-usage cache into provider discovery and usage loading so reloaded accounts return their own usage data. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer merge review: current main still refreshes usage without the captured runtime configuration, while this branch repairs that owner-boundary handoff. The maintainer attribution and protected label rule out automated cleanup. Priority: P2 Review scores
Verification
How this fits togetherGateway status methods cache provider account usage and refresh it in the background. The provider loader resolves configured providers and credentials, then returns account, plan, and quota data to usage-status and model-auth clients. flowchart LR
A[Runtime configuration] --> B[Gateway status request]
B --> C[Provider usage cache]
C --> D[Background refresh]
D --> E[Provider usage loader]
E --> F[Account usage snapshot]
F --> G[Gateway clients]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +27. Total +28 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single cache-to-loader configuration handoff after exact-head/base validation, preserving one canonical provider-loading path for both usage-status and model-auth reads. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible: current main invokes the provider loader without the cache's reloaded configuration, and the loader demonstrably falls back to ambient runtime configuration. Is this the best way to solve the issue? Yes. Passing the captured configuration at the shared refresh-to-loader boundary controls provider discovery, auth resolution, and plugin usage loading without adding a parallel path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 03c1d7727cfd. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Landing proof for exact head
ClawSweeper rank-up / merge-risk dispositions:
No linked issue exists to close. Related PR #121799 remains open because it addresses a distinct cold-cache/client-convergence contract. |
|
Merged via squash.
|
Related: #121799
What Problem This Solves
Fixes an issue where provider usage could show no provider or the wrong account after runtime configuration changed, because the cache refresh could fetch through an ambient configuration different from the configuration that keyed the cache.
Why This Change Was Made
The provider-usage cache now carries its exact
OpenClawConfiginto the provider loader. The configuration that determines cache ownership is therefore also the configuration used for provider discovery, account selection, and usage fetches.This is complementary to #121799: that PR changes cold-read behavior and cache identity, but its current head still does not pass the exact runtime config into
loadProviderUsageSummary. This PR does not change provider auth, routing, defaults, billing semantics, public protocol/SDK, configuration shape, persistence, or schema.Production growth is one line (
+5/-4): the single added capability is the missing owner-boundary handoff from cache refresh to provider loading. The other production edits tighten the existing cache config types.User Impact
Provider plan, quota, balance, and account data now follows the active runtime configuration after account or provider changes. Identical configuration reuses the correct cached value; a different account/configuration receives an isolated value; one provider error or timeout does not hide successful providers.
No
CHANGELOG.mdedit is included. Release generation owns changelog updates for normal fixes.Evidence
Exact candidate:
fbc479feec2303aeba3f3b3770e978969114238fecd20f392c9d4e8c9da7006048fec960c3408067447393dc3221e14f63dc9b3818ddd04051553936+5/-4(net+1)+27/-0Source-blind built-Gateway proof on Blacksmith Testbox
tbx_01m02aygy1hdqmja1jkqyca8a5(run 31876290317) used an isolated state directory, free loopback ports, and a controlled local provider with no external credentials:proof-b / [email protected].proof-a / A; no B request occurred, andusage.statusreturned[email protected]instead of an empty healthy payload.proof-c / Crequest and response rather than reusing A.controlled provider errorandTimeoutsnapshots.Verification on the exact tree:
models.authStatussibling: 85/85 passed.pnpm build: passed.git diff --checkpassed and reported only the three intended files.overall: patch is correct (0.99)).