Repository navigation
fix(models): wait for standalone catalog refresh before listing - #149752
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 16, 2026, 2:46 AM ET / 06:46 UTC (Revision 3). ClawSweeper reviewWhat this changesExplicit standalone model-catalog refreshes now finish discovery before printing results, with a regression test covering discovery that exceeds five seconds. Merge readiness✅ Ready for maintainer review This focused fix remains necessary on the inspected main revision. No blocking correctness or security defect was found; the related LiteLLM fixes address separate problems. Priority: P2 Review scores
Verification
How this fits togetherThe model catalog combines configured models with provider discovery and supplies model listings. Standalone CLI commands must finish discovery before exiting, while the long-running Gateway can publish results after its foreground response. flowchart TD
A[Model list refresh] --> B{Catalog owner}
B -->|Standalone CLI| C[Wait for discovery]
B -->|Gateway| D[Bounded foreground wait]
C --> E[Publish discovered inventory]
D --> E
E --> F[Project model rows]
F --> G[Display model list]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +4, Tests +163. Total +167 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep completion waiting in the shared catalog owner for explicit standalone refreshes while preserving bounded Gateway responses and existing discovery deadlines. Do we have a high-confidence way to reproduce the issue? Yes, from source: with no Gateway and discovery taking over five seconds, current main can print the earlier catalog before discovery finishes. The added held-worker regression exercises that path; this review did not execute it. Is this the best way to solve the issue? Yes. The change uses the existing owner's lifecycle distinction, avoiding a second discovery implementation or CLI polling loop while preserving Gateway behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ce9e84331014. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
landpr-approve-admin-merge |
|
landpr-approve-admin-merge |
|
Proof: A standalone
|
…claw#149752) Related: openclaw#149472 ## What Problem This Solves Without a Gateway, `models list --refresh` could exit with no discovered rows after a successful proxy response. ## Why This Change Was Made The decision `whether refresh can outlive its caller` is made by exactly one mechanism at `src/agents/prepared-model-runtime.catalog-access.ts:658`; this state has one writer. Gateway refresh keeps its bounded wait. `catalog-access.ts` +5 lines; `build.ts` -1. Growth accepted under the owner's standing acceptance (2026-09-15). ## User Impact The command prints completed discovery instead of silently returning an earlier catalog. ## Evidence `openclaw models list --provider litellm --refresh --json`: before, one GET `/v1/models` returned 200 but JSON had zero rows; after, one GET returned 200 and JSON listed the returned row. Twenty CLI tests and the Gateway pending control pass after merging main. Authored and unrelated provider JSON is byte-identical; failures warn. ## Compatibility No JSON, SDK, or configuration change. The separate onboarding seed restriction needs its follow-up fix. ## Consumers Standalone catalog refresh callers wait for completion. Gateway and ordinary reads keep existing behavior. ## Invalidation Existing refresh, discovery deadlines, and owner replacement rules remain in place. ## Tests Held discovery fails with the old behavior and passes with the fix. The existing Gateway control still returns pending before discovery completes. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #149472
What Problem This Solves
Without a Gateway,
models list --refreshcould exit with no discovered rows after a successful proxy response.Why This Change Was Made
The decision
whether refresh can outlive its calleris made by exactly one mechanism atsrc/agents/prepared-model-runtime.catalog-access.ts:658; this state has one writer. Gateway refresh keeps its bounded wait.catalog-access.ts+5 lines;build.ts-1.Growth accepted under the owner's standing acceptance (2026-09-15).
User Impact
The command prints completed discovery instead of silently returning an earlier catalog.
Evidence
openclaw models list --provider litellm --refresh --json: before, one GET/v1/modelsreturned 200 but JSON had zero rows; after, one GET returned 200 and JSON listed the returned row. Twenty CLI tests and the Gateway pending control pass after merging main. Authored and unrelated provider JSON is byte-identical; failures warn.Compatibility
No JSON, SDK, or configuration change. The separate onboarding seed restriction needs its follow-up fix.
Consumers
Standalone catalog refresh callers wait for completion. Gateway and ordinary reads keep existing behavior.
Invalidation
Existing refresh, discovery deadlines, and owner replacement rules remain in place.
Tests
Held discovery fails with the old behavior and passes with the fix. The existing Gateway control still returns pending before discovery completes.