Skip to content

refactor(ui): reuse catalog reader on Agents page - #177799

Merged
steipete merged 2 commits into
mainfrom
solid2/w-agent-reader-owner
Oct 19, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-agent-reader-owner

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Proof Result
pnpm tsgo:ui Pass
Agents page and file lifecycle 39 tests passed
Model catalog recovery 5 tests passed
Focused lint and formatting Pass
Wave-zero guard Pass; all touched-file smell counts remain zero
Independent review Full-context P0–P3 scoped-clean
Production Knip Pass
Exact-base/head builds + strict performance Pass: startup JS 325,974 → 326,013 B gzip (+39 B); raw JS 979,801 B unchanged; CSS 38,500 B gzip and one request unchanged

Production 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, head 9c096eeee17aea2d2aa60d51b3e40db5cc71c22d, 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:full covers 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 labels
  • Control UI device alias rename with a real Gateway > persists a Devices-page alias rename through the real Gateway across reload and restart

Both runs report DeviceIdentityStorageError because 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 merge 1c98dad26b6c8c7ec6627f390e3a4e2753ef9e5c with parents 50520de188dd2c498db8bd397d0ceb932ba794e4 and reviewed head 9c096eeee17aea2d2aa60d51b3e40db5cc71c22d.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T22:45:36.013750Z 9c096ee PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The Agents page’s private request lifecycle waits for settlement and retries the failed catalog read.
  • After: The shared reader settles the request, and one page-owned recovery intent triggers the retry.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused consolidation appears correct and preserves existing contracts; supplied behavioral validation remains harness-based.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied validation covers the page and reader through mocked Gateway requests, with no current-PR browser or live transport artifact.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Separate catalog lifecycles can drift in cancellation, refresh, and recovery behavior across model pickers.
Reason: The maintainer-authored direction extends an established shared owner without adding settings, persistent state, or another implementation.

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
Reviewed head: 9c096eeee17aea2d2aa60d51b3e40db5cc71c22d

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not demonstrate the Agents picker’s suspension recovery through a running browser and Gateway.
Agent review details

How this fits together

The 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
Loading

Technical review

Best 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

  • Shared catalog reader keeps the original intent (26d1ec9: Unify catalog request and subscription policy while preserving warm choices and truthful cold-catalog behavior.)
  • Agents catalog scope and lifecycle keeps the original intent (25e7d4f: Scope Agents page state and retain synchronous request identity, selection, and cleanup ownership.)
  • Scoped catalog publication subscriptions keeps the original intent (286f153: Avoid canceling another agent’s catalog request during unrelated catalog publications.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 26d1ec9 adds ui/src/lib/model-catalog-reader.ts:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 26d1ec973edc; files: ui/src/lib/model-catalog-reader.ts)

PR surface

Source -59. Total -59 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 53 112 -59
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 53 112 -59

Review metrics

Metric Value Why it matters
Production versus test LOC Production +53/-112; tests unchanged The reduction removes duplicate lifecycle machinery while retaining page-specific panel status and recovery intent.

Labels

Label changes:

  • add P3: This is a behavior-preserving internal consolidation with no established urgent user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a behavior-preserving internal consolidation with no established urgent user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 19, 2026, 6:55 PM ET / 22:55 UTC.

@steipete
steipete enabled auto-merge (squash) October 19, 2026 23:15
@steipete
steipete disabled auto-merge October 19, 2026 23:31
@steipete
steipete merged commit 0631ad4 into main Oct 19, 2026
111 of 117 checks passed
@steipete
steipete deleted the solid2/w-agent-reader-owner branch October 19, 2026 23:40
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
yozakura-ava pushed a commit to yozakura-ava/openclaw that referenced this pull request Oct 20, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant