Repository navigation
test(models): cover quota recovery during catalog discovery - #146708
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 8:12 AM ET / 12:12 UTC (Revision 13). ClawSweeper reviewWhat this changesAdds a real-Gateway test that holds model discovery across quota recovery, verifies model availability and the Ready badge, and documents that behavior. Merge readiness✅ Ready for maintainer review The PR retains useful regression coverage absent from current main. The earlier ownership finding is resolved, and no actionable defect remains in the final patch. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway combines provider model discovery with account quota state to determine model availability. The Control UI consumes those results to show whether a provider is ready. flowchart LR
A[Provider catalog response] --> B[Gateway catalog discovery]
C[Ordinary chat turn] --> D[Account quota recovery]
D --> E[Current account usage]
B --> F[Published model availability]
E --> F
F --> G[Models settings Ready badge]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +121, Docs +2. Total +123 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep quota freshness with the existing account-bound runtime owner and retain deterministic Gateway coverage for recovery during discovery. Do we have a high-confidence way to reproduce the issue? No current-main failure was established; the earlier failure is documented, while the recorded after-fix Gateway run passes the forced discovery-overlap scenario. Is this the best way to solve the issue? Yes. Extending the existing Gateway fixture protects the race without duplicating production quota ownership or weakening existing assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8d37c8a52ff2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
6fc316b to
b05005a
Compare
|
@clawsweeper re-review Removed the duplicate usage projection and its supporting mock test. The refreshed branch retains the discovery-overlap regression; 64 owner/catalog tests, all three real-Gateway quota cases, changed-file checks, and P1 autoreview pass. The PR body records the applied findings. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Reconcile the shared catalog when a publication retires a route preload before the Models page subscribes. Keep catalog errors visible and use the existing loader to consume current models without changing badge semantics. The route-to-page gap was introduced by c9c856c (#146396). It matches the automatic quota-recovery badge failures in checks-ui-e2e-real-gateway on #146246 (run 34733358595) and #146664 (run 34733471778). Prove the same Signed in/Ready failure before the fix and recovery after it. All 134 focused tests, both real-Gateway quota scenarios, the UI build, and changed-file checks pass. Keep usage-preload fixtures complete and retain quota badge transitions and catalog events for diagnosis.
Represent the completed route preload in the existing shared catalog owner before asserting that the page does not request core data again. Preserve every assertion. This fixes the fixture failures in checks-ui (1/3) and checks-node-compact-large-5 from run 34735832610; all 234 Models-settings tests and changed-file checks pass.
Catalog discovery captures auth before awaiting provider I/O. If an ordinary turn clears a quota block meanwhile, the published catalog can retain the old cooldown despite successful recovery. Background inventory renewal in 65c9f24 (#146317) exposes this overlap in the quota real-Gateway CI cases reported on #146246 and #146664. Materialize current in-memory usage only for unchanged discovery credentials. Keep credential ownership and standalone read-only behavior intact. Remove the earlier UI-only candidate from the final change. A held synthetic catalog response proves the original stale cooldown and Signed in badge, then proves available models and Ready after the repair. Preserve all existing assertions and poll deadlines. Add credential-identity coverage and document recovery behavior; no persistent-state changes.
Remove the extra materializer usage overlay and its mock test. Current main already refreshes quota through the generation-bound usage reader, which preserves physical-owner and inherited/local precedence. Retain the real-Gateway discovery-overlap regression and recovery documentation.
51c2caf to
212732e
Compare
|
Merged via squash.
|
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
* temp/pr-145950: (101 commits) refactor(memory-wiki): share freshness result construction (#146935) improve(gateway): use metadata projection for presence (#146817) test(agents): reuse complete Responses model fixtures (#147015) fix(sessions): align the reclamation-memory test with the archive session owner (#147028) refactor(terminal): simplify copy-sensitive token checks (#146934) refactor(media): remove duplicate spaced path fallback (#146933) refactor(cli): reuse command-group names (#146893) improve(plugins): reduce JavaScript generation capture work (#146993) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) ...
* commit '060e856e5f9df245d63c98990fcb47e18108c6b9': (97 commits) refactor(memory-wiki): share freshness result construction (#146935) improve(gateway): use metadata projection for presence (#146817) test(agents): reuse complete Responses model fixtures (#147015) fix(sessions): align the reclamation-memory test with the archive session owner (#147028) refactor(terminal): simplify copy-sensitive token checks (#146934) refactor(media): remove duplicate spaced path fallback (#146933) refactor(cli): reuse command-group names (#146893) improve(plugins): reduce JavaScript generation capture work (#146993) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) ...
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
…#146708) Add a real-Gateway regression that holds model catalog discovery across an ordinary quota-recovery turn, then verifies model availability and the provider's Ready badge without restarting the Gateway. Keep quota freshness with the existing generation-bound, physical-owner-aware usage reader. The final change adds fixture support, browser coverage, and recovery documentation; the duplicate production overlay was removed during review. Refs openclaw#146317. Refs openclaw#146246. The sandbox-cache half is tracked separately in openclaw#146664. Validation: 64 focused owner/catalog tests and all three real-Gateway quota cases passed in the retained behavior proof. Exact-head CI passed at https://github.com/openclaw/openclaw/actions/runs/34755008537. The clean rebase preserves the approved patch byte-for-byte; the whitespace check and native hosted-CI prepare gates passed. Lead and ClawSweeper reviews have no actionable findings.
What Problem This Solves
Protects quota recovery when model catalog discovery begins while an account is blocked and finishes after an ordinary turn has recovered it. The regression previously left Models settings at “Signed in” and model availability false instead of showing “Ready.”
Refs #146317. Refs #146246. Refs #146664.
User Impact
Recovered accounts remain available across an overlapping catalog refresh, without a manual refresh or Gateway restart. This final revision adds regression coverage and documentation; production quota handling remains with the current prepared-runtime owner.
Why This Change Was Made
Background inventory renewal exposed a captured cooldown surviving automatic recovery. The real-Gateway scenario now holds catalog discovery, recovers through an ordinary turn, releases discovery, and checks both available models and the provider's Ready status.
The original extra usage overlay was removed during review: matching credentials in a merged store does not prove that its usage belongs to the same physical account owner. The existing owner-bound usage reader supplies freshness and local-versus-inherited precedence. The sandbox-cache half of the CI repair is #146664 and is outside this PR.
Evidence
node scripts/run-vitest.mjs src/agents/prepared-model-catalog.test.ts src/agents/auth-profiles/runtime-snapshots.test.tspassed 64 tests, including physical-owner identity and inherited/local usage precedence.node scripts/run-vitest.mjs ui/src/e2e/quota-reset-status.real-gateway.e2e.test.tspassed all three cases: automatic recovery, saved-clear recovery, and forced recovery during discovery. The harness built a fresh Gateway; the forced-overlap screenshot was inspected and shows Ready.212732e649c6e4d81df2bc25fdede14e5e1cf793preserves that patch byte-for-byte; the before/after SHA-256 isbce441809dd9057bfe7497251fe10a50172a594bdfac5a76ca009934f4a5f0af. The current ClawSweeper review has no actionable findings.212732e649c6e4d81df2bc25fdede14e5e1cf793, including the real-Gateway suite and UI shard 4/7. The actual checkout was mergeae3af049a4fef3683cada8719ce00d5d3cae7a1d, whose main parent contains the file-link test correction from fix: stop repeated catalog reloads and cancelled-task recovery #146810. Changed-file checks and the rebase whitespace check passed.ClawSweeper review
Applied the P1 ownership finding and both Rank-up moves: removed the duplicate production overlay and its supporting mock test; retained and passed the forced-overlap case plus existing inherited/local precedence tests against refreshed main. No items skipped.
CI checkout recovery
Earlier runs used stale merge checkouts and retained failures already corrected on main. A clean rebase refreshed CI attachment without changing the approved patch. The final run includes the repaired file-link close-tab lookup and passes; no assertions, timeouts, or skipped-test policy were changed during landing.