Skip to content

fix(ui): refresh automation models after team agent switch - #164357

Merged
obviyus merged 6 commits into
openclaw:mainfrom
TUARAN:fix/cron-selected-agent-model-suggestions
Oct 7, 2026
Merged

obviyus merged 6 commits into
openclaw:mainfrom
TUARAN:fix/cron-selected-agent-model-suggestions

Conversation

@TUARAN

@TUARAN TUARAN commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #164346

What Problem This Solves

Fixes: Automations retains the previous agent's model suggestions when the selected team agent changes while the page remains scoped to all agents.

User Impact

User impact: model suggestions follow the selected agent without resetting the all-agent task list or an open automation draft.

Why This Change Was Made

Inventory follows the page scope, while models follow the selected agent. Observe these independently and retire stale catalog results. The existing Sessions observer is moved to the agents module without changing its semantics.

Thanks @TUARAN for reporting the issue and implementing the fix. No overlap with Pash/Sarah changes.

Evidence

Real Chromium and built Gateway

Compared current main 16e94f50ee95237a79368fd012c44cd135d8d8ab with candidate de9a710c7b9801d4c6f3f6b2ceb67f6eb33622b3. Both Gateway/UI builds and Chromium 154 ran in isolated Linux containers, using synthetic agents and credentials, with Gateway state on tmpfs.

  1. Configure Main and Writer with different configured catalogs, including fixture/main-extra and fixture/writer-extra; use the team roster sidebar.
  2. Click Writer, open Automations, create a draft named Keep this roster draft, and open the model picker.
  3. From the matching CLI, run openclaw --profile <isolated-profile> agents delete writer --force --json.
  4. The real Gateway publication reconciles the selected agent to Main while the Automations scope stays all agents.

Before: selection is Main, but the picker still contains fixture/writer-extra, lacks fixture/main-extra, and displays an old-agent error.

Before: Main is selected after Writer deletion, but Writer model suggestions remain

After: the picker removes Writer's stale suggestions and contains fixture/main-extra. The same open draft survives.

After: the model picker refreshes to Main while preserving the draft

This is a real deletion-driven selection change, not a direct JavaScript call to the selection owner. Ordinary sidebar selection navigates to Chat; it does not reproduce the in-place transition by itself.

Control: both builds remove Writer from the sidebar and retain Main. Opening Main's chat subsequently displays Main Session with Main model, while the previously opened Writer pane retains Writer model on both. The shared Sessions agent-selection-priority tests pass on both builds; the relocated observer body is unchanged.

Regression checks

  • Candidate Cron lifecycle and Sessions priority files passed. The same candidate lifecycle test on current main fails because the selected-agent-only change makes no new model catalog request. Combined targeted run: 10.02 seconds candidate; 10.47 seconds baseline (including the inherited Chat test below).
  • New roster-selection Chromium regression: candidate passed in 13.48 seconds; current-main baseline failed in 24.20 seconds waiting for the missing Writer models.list request. These mock-Gateway tests supplement the real-Gateway proof above.
  • Exact-head live Gateway call to openai/gpt-5-mini, reasoning low, configured output budget 4096: completed and returned live gate passed. One assistant turn, no tool calls. The credential file and its container were removed.
  • ClawSweeper is ready for maintainer review on exact head de9a710c7b9801d4c6f3f6b2ceb67f6eb33622b3: review run.

CI classification

The three failure entries represent one failed test job and two aggregate gate entries:

  • checks-ui (3/3): inherited chat-gateway.test.ts case timestamps materialized streamed text after the persisted user prompt, expected 201, received 100. The identical case fails on main's run, and was repaired upstream by e1fd019ceaadc4fc2e9b3e8dd44893ba6702a5a6. It also fails identically in the local candidate run. This PR changes neither Chat history timestamp handling nor that test.
  • openclaw/ci-gate check and status mirror: aggregate failures, not additional failing test cases.
  • One cancelled job: check-guards. Local replay of its executable guards passed, including duplicate, coercion, dependency patch, authentication, and both import-cycle checks. The report-only Git-diff temp-directory annotation step was not replayed.

No hosted jobs were rerun. No source changes or new commits were needed for this verification; the contributor's exact reviewed head is preserved.

before

after

@clawsweeper

clawsweeper Bot commented Oct 3, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 11:01 AM ET / 15:01 UTC (Revision 8).

ClawSweeper review

What this changes

Refresh Automations model suggestions when the selected team agent changes, preserve the task list and editor, and move the shared selection observer into the agents module.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main and the latest release still miss selected-agent-only catalog refreshes. The focused implementation and supplied browser proof support keeping it open, with no actionable patch findings.

Priority: P2
Reviewed head: de9a710c7b9801d4c6f3f6b2ceb67f6eb33622b3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with credible browser boundary proof and complementary stale-response coverage; no blocking patch defect was found.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied real-Chromium run exercises CronPage through a mock Gateway and reports the new agent's choices, removal of old choices, preserved draft, and unscoped inventory; GitHub confirms exact-head E2E success. Inspected prepared images concern adjacent work and were excluded. Raw CI logs were inaccessible through the reviewer proxy. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied real-Chromium run exercises CronPage through a mock Gateway and reports the new agent's choices, removal of old choices, preserved draft, and unscoped inventory; GitHub confirms exact-head E2E success. Inspected prepared images concern adjacent work and were excluded. Raw CI logs were inaccessible through the reviewer proxy. No stored-data contract changes.
Evidence reviewed 11 items Pinned introduced change: Reviewed the merge-base-to-head delta at the supplied identities. The selected-agent observer is moved without changing its subscription semantics; Cron subscribes separately and cleans up both observers. Sessions uses the relocated helper, and searches found no remaining references to its retired name.
Current main still needs the fix: Current main subscribes Cron only to watchAgentScope. The selection owner deliberately preserves scope during team navigation, and watchAgentScope suppresses unchanged scopes. Existing catalog-publication handling therefore does not cover this selected-agent-only transition.
Latest-release check: Inspection of cron-page.ts at v2026.9.8 also found the scope-only subscription and no selected-agent observer. The requested repair is not established as shipped.
Findings None None.
Security None None.

How this fits together

The Control UI Automations page reads scheduled tasks by page scope and model suggestions by selected agent. Team navigation can change the selected agent while the task scope remains All agents.

flowchart TD
  A[Team agent selection] --> B[Selection observers]
  B --> C[Page scope changed]
  B --> D[Selected agent changed]
  C --> E[Refresh task inventory]
  D --> F[Read agent model catalog]
  F --> G[Publish current model suggestions]
  E --> H[Automations page]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +11, Tests +191. Total +202 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 19 8 +11
Tests 2 192 1 +191
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 211 9 +202

Review metrics

Metric Value Why it matters
Production versus regression growth production net +11 lines; tests net +191 lines Production growth supplies the missing selection subscription and cleanup; browser coverage and delayed-response coverage protect distinct boundaries.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164346
Summary: This PR directly addresses the linked roster-selection bug; merged catalog-publication and provider-identity work is adjacent and does not supersede it.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep catalog suggestions owned by selected agent while inventory and editor state remain owned by page scope.

Do we have a high-confidence way to reproduce the issue?

Yes: switching selected agent in roster mode while scope stays null demonstrably bypasses current main's scope observer. This review established the path from source without executing target code.

Is this the best way to solve the issue?

Yes: reuse the existing selected-agent observer and existing guarded catalog loader, preserving the separate scope lifecycle and Sessions semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bb3a8a9ac304.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Stale model suggestions affect team-mode Automations selection with a limited UI blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied real-Chromium run exercises CronPage through a mock Gateway and reports the new agent's choices, removal of old choices, preserved draft, and unscoped inventory; GitHub confirms exact-head E2E success. Inspected prepared images concern adjacent work and were excluded. Raw CI logs were inaccessible through the reviewer proxy. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied real-Chromium run exercises CronPage through a mock Gateway and reports the new agent's choices, removal of old choices, preserved draft, and unscoped inventory; GitHub confirms exact-head E2E success. Inspected prepared images concern adjacent work and were excluded. Raw CI logs were inaccessible through the reviewer proxy. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head delta at the supplied identities. The selected-agent observer is moved without changing its subscription semantics; Cron subscribes separately and cleans up both observers. Sessions uses the relocated helper, and searches found no remaining references to its retired name. (ui/src/pages/cron/cron-page.ts:169, de9a710c7b98)
  • Current main still needs the fix: Current main subscribes Cron only to watchAgentScope. The selection owner deliberately preserves scope during team navigation, and watchAgentScope suppresses unchanged scopes. Existing catalog-publication handling therefore does not cover this selected-agent-only transition. (ui/src/pages/cron/cron-page.ts:166, bb3a8a9ac304)
  • Latest-release check: Inspection of cron-page.ts at v2026.9.8 also found the scope-only subscription and no selected-agent observer. The requested repair is not established as shipped. (ui/src/pages/cron/cron-page.ts:160, fc23bc864e45)
  • Documented selection contract: The Control UI documentation explicitly preserves All agents page scope when navigating another agent's chat in team mode. The PR respects this separation rather than resetting scope-owned inventory. Public docs: docs/web/control-ui.md. (docs/web/control-ui.md:254, de9a710c7b98)
  • Previously recorded observer gap: The GitHub commit record for a7d093b explicitly identifies roster-mode selectedId-only catalog staleness as separate follow-up work. Its editor-preservation repair does not supersede this PR. (ui/src/pages/cron/cron-page.ts:132, a7d093b7e2d0)
  • Production boundary and browser proof: The supplied PR body records real Chromium exercising the rendered Automations page through a mock Gateway: fixture/main disappears, fixture/writer appears, the draft remains, and cron.list stays unscoped. The inspected browser scenario implements those assertions; the lifecycle regression independently holds an earlier catalog response and verifies it cannot overwrite the newly selected agent. (ui/src/e2e/cron-agent-ownership.e2e.test.ts:251, de9a710c7b98)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • jalehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-03T14:57:10.403Z sha 63aed65 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-03T15:19:54.495Z sha efdcece :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-03T15:30:02.142Z sha 0d404fa :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-03T15:39:22.330Z sha 4481423 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-03T15:51:37.195Z sha b70ba6d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T16:00:29.250Z sha b70ba6d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T14:36:36.987Z sha de9a710 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 3, 2026
@TUARAN

TUARAN commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Maintainer override: the only failing job on exact head de9a710 is checks-ui (3/3) (https://github.com/openclaw/openclaw/actions/runs/37324864026/job/111813561491), plus the aggregate openclaw/ci-gate. The failing case is chat-gateway.test.ts ("timestamps materialized streamed text after the persisted user prompt"; expected 201, received 100). It failed identically on main (https://github.com/openclaw/openclaw/actions/runs/37312031958/job/111769878645) and was repaired on main by e1fd019, which this merge lands on top of. This PR doesn't touch chat-gateway. The one cancelled check-guards job was replayed locally (both import-cycle guards pass). Exact-head ClawSweeper is ready. The real built-Gateway Chromium before/after (screenshots in the PR body) shows the Automations model list following the selected agent after the selected agent is deleted.

@obviyus
obviyus merged commit d526a02 into openclaw:main Oct 7, 2026
105 of 109 checks passed
@obviyus

obviyus commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Landed in d526a02. Thanks @TUARAN! Verified on a built Gateway in real Chromium: when the selected agent is deleted while the automation editor is open, main kept offering the deleted agent's models; with this the list follows the new selection and the draft survives.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
…164357)

Refresh the Automations page model list when the selected agent changes in place, for example when the selected agent is deleted and selection falls back to another agent, instead of keeping the previous agent's models.

Fixes openclaw#164346.

Co-authored-by: Ayaan Zaidi <[email protected]>
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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

[Bug]: Automations keeps stale model suggestions after team agent switch

2 participants