Repository navigation
refactor(ui): reuse catalog reader on Agents page - #177799
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR replaces the Agents page’s duplicate catalog request and subscription lifecycle with ModelCatalogReader. Example: The main agent’s catalog request fails after a same-socket Gateway suspension ends.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR completes a useful catalog-reader consolidation, with no concrete correctness or security finding. The remaining failed check concerns PR-body sections, not the patch. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Agents overview reads agent-scoped model choices through the browser catalog cache; ModelCatalogReader owns request cancellation and subscriptions, while the page owns panel error presentation. flowchart LR
A[Agents overview] --> B[Agents page state]
B --> C[ModelCatalogReader]
C --> D[Catalog store and cache]
D --> E[Gateway models list]
E --> D
D --> A
Technical reviewBest possible solution: Land the existing-reader cutover once the repository’s current CI gates are satisfied. Do we have a high-confidence way to reproduce the issue? This PR is a refactor rather than a bug report; source inspection confirms the duplicated lifecycle, and existing tests specify its observable contracts. Is this the best way to solve the issue? Reusing the existing reader is the smallest complete consolidation: the cache remains the display-data owner, the old lifecycle disappears, and the page retains only its distinct error and recovery presentation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d305eb20619. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -59. Total -59 across 2 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 19, 2026, 6:55 PM ET / 22:55 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Upstream: openclaw#177799 at 0631ad4 Method: adapted, not cherry-picked. Ported the shared ModelCatalogReader lifecycle into the 10.5 AgentsPage owner, preserving scope binding, stale-response rejection, reconnect recovery, cache publication, and panel status semantics. The upstream agents-page-state file was already superseded on this branch. Regression tests: pnpm exec vitest run ui/src/pages/agents/agents-page.test.ts ui/src/pages/agents/agents-model-catalog-recovery.test.ts ui/src/pages/agents/agents-page.selection.test.ts --maxWorkers=2 (52 passed). Rollback: revert this isolated commit; do not reset the qualification branch.
What Problem This Solves
The Agents overview duplicated the catalog reader's request cancellation, cache subscription, and publication subscription. It now uses
ModelCatalogReader, retaining the page's panel error presentation and one pending Gateway-recovery intent. The reader passes the original error to its callback; existing callers can continue to ignore it.Selection, connection, and disposal still clear the reader. A Gateway that resumes while a request is pending waits for its result before retrying a failure. The canonical model-catalog publication/invalidation path is unchanged. File-list snapshots stay local because an open editor must retain its list and drafts while the canonical cache is invalidated and rebuilt.
Evidence
pnpm tsgo:uiProduction LOC in the two touched files: 1,319 → 1,260 (−59). Tests: unchanged. No markup, styles, routes, or selectors changed, so no visual screenshots are applicable. The existing max-lines exception remains necessary for the Agents state file; no allowance was raised.
Build comparison: base
2ccb5e7b30d859798889f68315f5337d7264cf0c, head9c096eeee17aea2d2aa60d51b3e40db5cc71c22d, with identical fixed build identity on the same machine. Both pass the current 338,900 B startup ceiling. No lazy boundary or eager dependency import changes.ci:fullcovers the shared reader consumers.Exact-head CI run 39336729073 passed all UI unit shards, all nine regular UI E2E shards, type/lint/guard checks, and startup performance. Its two failing real-Gateway tests also fail in the latest completed scheduled main run 39335414307:
Control UI browser platform family with a real Gateway > keeps signed browser identities while rendering fresh and legacy Mac and iPad labelsControl UI device alias rename with a real Gateway > persists a Devices-page alias rename through the real Gateway across reload and restartBoth runs report
DeviceIdentityStorageErrorbecause the fixtures use an identity path outside the canonical client credentials database. The relevant tests, helper, storage, and dependency blobs match main. Landing uses the documented inherited-failure route; the failed CI result is retained. CI tested merge1c98dad26b6c8c7ec6627f390e3a4e2753ef9e5cwith parents50520de188dd2c498db8bd397d0ceb932ba794e4and reviewed head9c096eeee17aea2d2aa60d51b3e40db5cc71c22d.