Repository navigation
fix(ui): refresh automation model suggestions on catalog changes - #139876
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 6, 2026, 3:05 AM ET / 07:05 UTC. ClawSweeper reviewWhat this changesThe Automations page refreshes model suggestions after catalog or configuration changes, preserves suggestions on failed reads, and rejects stale responses without replacing the draft. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and v2026.9.2 still lack publication-driven automation model refreshes. No actionable introduced defect was found, and the related staging PR does not supersede this focused repair. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI’s Automations editor reads model suggestions from the Gateway’s prepared catalog. Those suggestions feed the model picker alongside configured models and models used by existing tasks. flowchart TD
A[Gateway publication event] --> B[Automations page]
C[Selected agent and connection] --> B
B --> D[Read prepared catalog]
D --> E{Latest request?}
E -->|Yes| F[Update suggestions or show error]
E -->|No| G[Discard stale result]
F --> H[Model picker and preserved draft]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -17, Tests +101, Docs +1. Total +85 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep catalog refresh and request retirement in the page lifecycle while retaining the existing shared suggestion normalization and prepared-only Gateway reads. Do we have a high-confidence way to reproduce the issue? Yes, from source: leave Automations open and publish a changed catalog; current main has no notification handler that reloads its suggestions. The contributor reports a failing built-browser baseline, but this review did not execute it. Is this the best way to solve the issue? Yes. The patch repairs the existing page-owned read lifecycle, reuses established Gateway notifications, and preserves the shared normalization path without adding configuration or persistent state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3e234f1cf19b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Landed through the guarded merge at
|
…nclaw#139876) Related: openclaw#136257 ## What Problem This Solves Fixes an issue where users leaving Automations open see old model suggestions after the Gateway publishes a changed catalog. Failed catalog reads also silently remove suggestions instead of showing the failure. ## Why This Change Was Made The Automations page now owns its typed catalog read and refreshes it on the existing configuration and chat-metadata notifications. Only the latest request for the current page and agent may publish results or errors. This removes the separate mutable suggestion helper and its duplicate parsing; the existing form-suggestion builder still owns normalization and sorting. Automatic reads retain `preparedOnly: true`. The change uses existing Gateway methods and does not alter provider discovery, authentication, configuration, session/default selection, or automation execution. ## User Impact New suggestions appear without reloading the page. Failed reads show an error while preserving the previous suggestions for the same agent and connection. Successful reads, including empty catalogs, replace them and clear the error. Draft fields remain unchanged. ## Evidence - Built-browser baseline at `b9a935ddeddc5e6545135912a69bee6f7051e90a`: initial model is visible; after `chat.metadata.changed`, the replacement option remains absent. The existing all-agents ownership scenario passes. - Built-browser candidate: both scenarios pass, covering both publication events, removal of old options, visible failure, retained options, empty recovery and draft preservation. This uses the real built Control UI with synthetic Gateway responses; it does not claim live provider acquisition. - Focused unit tests: 253 pass across the cron page, lifecycle, form-suggestion and cron library suites. Delayed successes and errors cannot publish after a newer request, agent switch, reconnect, Gateway replacement or page removal. Existing automation coalescing and mutation coverage remains intact. - Source-blind browser acceptance: all five contract clauses pass, including ten delayed-response orderings. All 33 catalog reads use prepared configured parameters; 244 captured requests contain no configuration, authentication, session-default or automation writes. The validator exercised the built UI independently and kept the same synthetic-provider limitation. - Real Gateway proof: coupled baseline and candidate UI/runtime builds run the normal Gateway. A supported CLI config change emits real `config.changed` and `chat.metadata.changed` notifications. The baseline keeps the old list; the candidate reads the published list and removes the retired option. A controlled transport fault replaces real catalog replies with `UNAVAILABLE` after recording them; the error appears, prior options remain, and another real publication restores reads without losing the draft. Catalog contents and notifications are never injected in this test. All five tests in the existing real-Gateway automation suite pass, including the new case. - Independent code review: no actionable findings through P2. Formatting, syntax-only lint, line/assertion ratchets and UI copy verification pass. Typechecking is left to CI. - Production: **−17 lines**. Tests/support: **+272 lines**. Docs: **+1 line**. Validation metadata: **0 net lines**, with the assertion allowance reduced from 13 to 11. The test growth adds built-browser refresh/recovery, real Gateway publication and five request-ownership cases; one obsolete helper test is removed. Focused commands: ```sh node scripts/run-vitest.mjs ui/src/pages/cron/cron-page.test.ts ui/src/pages/cron/cron-page.lifecycle.test.ts ui/src/pages/cron/form-suggestions.test.ts ui/src/lib/cron/index.test.ts node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/cron-agent-ownership.e2e.test.ts --maxWorkers=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/cron-duration-save.real-gateway.e2e.test.ts --maxWorkers=1 ``` Known unrelated baseline test: `src/agents/sandbox/browser.create.test.ts:606` assumes no protected skill mounts beneath its fixed temporary workspace. Independent controls on unmodified main `b9a935ddeddc5e6545135912a69bee6f7051e90a` pass with no skills directory and reproduce the same hash-label failure when only that directory exists. The production mount behavior from openclaw#135702 is intentional; the test fixture needs isolation. This PR changes no sandbox owner, dependency, runner or hash input. The exact completed CI result still determines whether the guarded unrelated-failure route is needed. Before: initial catalog choice; the baseline keeps this list after publication.  After: the published replacement appears and the draft remains.  Real Gateway flow: the controlled read failure is visible while the unsaved draft remains.  Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #136257, #135702.
What Problem This Solves
Automations kept old model suggestions after catalog publication. Failed reads silently removed suggestions.
Why This Change Was Made
The page owns its typed catalog read and follows existing publication events. Only the latest request for the current page and agent may update results or errors. Shared form normalization and sorting remain unchanged.
User Impact
Suggestions update without reloading. Failed reads show an error and retain same-agent choices; successful empty results clear them. Draft fields remain intact, and automatic reads do not trigger discovery.
Evidence
Built-browser checks reproduced stale suggestions and verified publication, recovery, empty results, and draft preservation. All 253 focused tests passed. Real Gateway/browser tests used CLI configuration changes to publish new choices and controlled read failures to verify recovery. All five real-Gateway automation scenarios passed. A separate sandbox fixture failure reproduced on the baseline.
Consumers: Automations suggestions now follow catalog publication and current-request ownership.