feat: per-provider monthly budget limits - #109
Conversation
…ew change The Access screen's active-tab scrollIntoView also scrolled ancestors during mount, loading the page yanked down past the header. Reveal the active tab by adjusting only the tablist's horizontal scroll, reset window scroll on SPA view changes, and show $0.00 instead of 'none' for zero provider-budget spend.
|
Codex review: needs real behavior proof before merge. Reviewed August 3, 2026, 1:07 PM ET / 17:07 UTC. ClawSweeper reviewWhat this changesThis PR adds monthly per-provider budget settings, reserves and settles provider budgets alongside policy budgets, and displays provider spend controls in the admin catalog. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 7 items remain Keep this PR open, but do not merge it yet. Its new provider-budget Durable Object key is hard-coded to the Priority: P1 Review scores
Verification
How this fits togetherClawRouter’s Worker data plane authorizes and routes provider requests, reserves budget before sending traffic upstream, then settles actual cost through Durable Object ledgers. The admin console configures provider connections and displays their budget state. flowchart LR
A[Admin catalog] --> B[Provider connection settings]
B --> C[Worker request routing]
C --> D[Policy budget reservation]
D --> E[Provider budget reservation]
E --> F[Upstream provider request]
F --> G[Ledger settlement]
G --> H[Usage and admin spend status]
Decision needed
Why: The branch calls the feature tenant-wide while its configuration and ledger implementation are provider-global; only maintainers can set that permanent billing and admission-control contract. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Choose and document the supported ownership boundary for provider budgets; if the intended behavior is tenant-wide, persist and address budgets by tenant plus provider, then prove two tenants cannot affect each other’s balance before merge. Do we have a high-confidence way to reproduce the issue? Yes, from source: configure two distinct tenant policies that route to the same metered provider, exhaust the first tenant’s provider spend, then send the second tenant’s request. Both use the Is this the best way to solve the issue? No. Dual reservation and settlement are suitable, but the provider-budget configuration and Durable Object address omit tenant identity despite the stated tenant-wide behavior. The maintainer must first confirm whether the feature is tenant-scoped or gateway-wide. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f82765ad3821. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
402 provider_budget_exhaustedwhen a provider budget is exhausted.$0.00spend formatting.Verification
pnpm checkall suites green: 123+26+74 tests.fusion-readinessis pre-existing on this machine and reproduces without these changes; CI Linux snapshots are authoritative.Deployment
Will be deployed to clawrouter.openclaw.ai via the Deploy Cloudflare workflow after merge.
Remaining risk
Provider budgets default to
null/unmetered; only metered providers pay one extra Durable Object round-trip.