Repository navigation
fix(models): one failed provider discovery hides its models until a manual refresh - #167230
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 October 8, 2026, 8:57 AM ET / 12:57 UTC (Revision 2). ClawSweeper reviewWhat this changesThe Gateway automatically retries failed provider model discovery with capped exponential backoff while ordinary model-list reads remain passive. Example: The user opens the model list after an OpenRouter discovery timeout.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a recovery gap still present on current main, has sufficient real Gateway proof, and has no actionable review findings. The previous review’s test-cost request is satisfied. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway’s model catalog supplies model choices to the CLI, chat commands, and app pickers. Its lifecycle owner acquires provider inventory and publishes completed results while retaining compatible choices through failures. flowchart TD
A[Provider discovery] --> B{Discovery succeeds?}
B -->|Yes| C[Publish model inventory]
B -->|No| D[Retain saved or built-in models]
D --> E[Owner schedules backed-off retry]
E --> A
C --> F[Passive model-list reads]
D --> F
G[Generation retires] -->|Cancel timer| E
Technical reviewBest possible solution: Keep failure recovery in the existing catalog owner, preserving passive reads, compatible inventory retention, and generation-scoped cancellation. Do we have a high-confidence way to reproduce the issue? Yes: current source leaves failed discovery without a renewal deadline while model-list reads stay passive, and the contributor reports a failing owner regression and real OpenRouter outage recovery. This read-only review did not execute a reproduction. Is this the best way to solve the issue? Yes: scoped retries repair acquisition recovery at its existing owner without restoring request-triggered discovery or adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 34b2cfb3126c. Provenance checked
TestingProof path: shipped entry point. Added test files: 1. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +98, Tests +67, Docs +2. Total +167 across 5 files. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in eea11f9. If a provider's discovery failed once, it used to stay on its built-in rows until someone ran a manual refresh. Now the failed provider retries in the background (30 s, then doubling up to 30 min) without making reads renew anything. Proof: in an isolated live Gateway, OpenRouter went from 3 to 466 rows on its own after the network recovered, with no refresh. A regression test also covers this and fails on the old code. |
…anual refresh (openclaw#167230) ## What Problem This Solves Fixes: when a provider's model discovery fails once (for example an OpenRouter timeout), the Gateway falls back to that provider's few built-in rows (OpenRouter 466 → 3) and keeps them until someone runs an explicit `models refresh`. ## User Impact A transient provider outage no longer hides most of that provider's models for the life of the Gateway. The failed provider retries discovery in the background and its full model list comes back on its own once the provider is reachable. ## Why This Change Was Made Failed discovery recorded no renewal deadline, and ordinary `models.list` reads intentionally no longer renew inventory (openclaw#167008), so nothing ever retried it. A failed provider now gets a backed-off retry deadline (30 s, doubling to a 30 min cap) on its retained inventory facts. The catalog owner keeps one timer for the earliest deadline, re-armed after each acquisition settles and cancelled when the catalog generation retires. Reads stay passive; a successful retry publishes the full rows and returns the provider to its normal cache deadline. A compatible reload keeps the failure facts and resumes the retry. ## Evidence - Regression tests in `prepared-model-runtime.catalog-owner.test.ts`: discovery fails, then recovers with backoff and no read or refresh (fails on `main`: the worker is never called again); and a new failure episode is measured from its own failure. - Live isolated Gateway with real OpenRouter discovery and a DNS-delay preload: OpenRouter discovery failed at startup and showed 3 built-in rows with `refreshFailed`. Background retries ran at the expected backoff (lookups at 12:17:38, 12:18:13, 12:19:19, 12:21:24, 12:25:29 UTC). After the network recovered at 12:29:40, passive `models.list` polling (no refresh) showed OpenRouter go from 3 to 466 rows at 12:33:35, on the next scheduled retry. OpenRouter's outcome is now `ready`. - Focused prepared-catalog and models-list suites pass. Two `models-auth-*.catalog.integration` tests also fail on an unmodified `main` checkout locally. - Test cost: `pnpm exec vitest run src/agents/prepared-model-runtime.catalog-owner.test.ts` takes 8.2 s wall time locally (19 tests; Vitest duration 4.2 s). The two new cases use fake timers and add about 0.4 s of CI test time. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: when a provider's model discovery fails once (for example an OpenRouter timeout), the Gateway falls back to that provider's few built-in rows (OpenRouter 466 → 3) and keeps them until someone runs an explicit
models refresh.User Impact
A transient provider outage no longer hides most of that provider's models for the life of the Gateway. The failed provider retries discovery in the background and its full model list comes back on its own once the provider is reachable.
Why This Change Was Made
Failed discovery recorded no renewal deadline, and ordinary
models.listreads intentionally no longer renew inventory (#167008), so nothing ever retried it. A failed provider now gets a backed-off retry deadline (30 s, doubling to a 30 min cap) on its retained inventory facts. The catalog owner keeps one timer for the earliest deadline, re-armed after each acquisition settles and cancelled when the catalog generation retires. Reads stay passive; a successful retry publishes the full rows and returns the provider to its normal cache deadline. A compatible reload keeps the failure facts and resumes the retry.Evidence
prepared-model-runtime.catalog-owner.test.ts: discovery fails, then recovers with backoff and no read or refresh (fails onmain: the worker is never called again); and a new failure episode is measured from its own failure.refreshFailed. Background retries ran at the expected backoff (lookups at 12:17:38, 12:18:13, 12:19:19, 12:21:24, 12:25:29 UTC). After the network recovered at 12:29:40, passivemodels.listpolling (no refresh) showed OpenRouter go from 3 to 466 rows at 12:33:35, on the next scheduled retry. OpenRouter's outcome is nowready.models-auth-*.catalog.integrationtests also fail on an unmodifiedmaincheckout locally.pnpm exec vitest run src/agents/prepared-model-runtime.catalog-owner.test.tstakes 8.2 s wall time locally (19 tests; Vitest duration 4.2 s). The two new cases use fake timers and add about 0.4 s of CI test time.