Skip to content

fix(ui): validate session-catalog agent against the live roster - #114303

Merged
steipete merged 1 commit into
mainfrom
fix/ui-catalog-retired-agent
Jul 27, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/ui-catalog-retired-agent

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Completes the reload-flash cluster on team.openclaw.ai (sibling of merged #114257). Even with the fabricated "main" defaults gone, two client behaviors remained:

  1. Same-client hello was ignored. agent-selection.ts only re-published when the gateway client object changed, so a hello that arrived on the existing client with the real assistantAgentId never updated the selection — the pre-hello state stuck until a full reconnect.
  2. Catalog RPCs trusted unvalidated agent ids. sessions.catalog.list fired with whatever provisional selection existed pre-roster; on retired-agent installs that produced the journal's repeated unknown agent id "main" errors and a retry loop that opened a new connection every ~3 seconds (production journal 2026-07-27 01:18–01:19 UTC: fresh conn= id per failing request).

Why This Change Was Made

  • Selection now tracks assistantAgentId changes on the same client (hello arriving after connect), adopting the server default when the previous selection was just the provisional default.
  • resolveSessionCatalogAgentId requires the active client's roster: with a roster, an unknown selection reconciles to the roster default; without one, the hello default is used only when it doesn't conflict with an explicit selection — a pre-roster selection the hello doesn't confirm defers the catalog fetch rather than fetching the wrong agent's catalog (autoreview-hardened; regression test included).
  • New-session route retries are bounded, preserve valid deep links, reject stale-client rosters, and reuse the current connection — ending the reconnect-per-retry loop.
  • sessionDefaults.defaultAgentId is trimmed before adoption so a whitespace-only value cannot become a truthy selection.

Rebased onto main after #114257; the overlapping fabrication-removal hunks were dropped during rebase so this PR contains only the complementary behavior.

User Impact

No error-chip flash and no wasted RPC bursts on reload; the agent picker and catalog always agree with the server's roster; fast session switching cannot interleave a wrong-agent catalog.

Evidence

  • Production journal evidence above; root-cause chain verified in source (agent-selection.ts:81 client-change-only subscription; catalog resolver trusting provisional ids).
  • Focused suites: app-sidebar.test.ts 191 passed (includes new fixture: pre-roster conflicting selection defers, hello-default fetch fires when selection matches); agent-selection / gateway-store / new-session route / catalog-target 36 passed; worker's broader run 257 passed pre-rebase.
  • Full-shard run flagged only two known-flaky files (board-view.test.ts, bootstrap.test.ts — untouched by this PR; both pass in isolation).
  • Changed-file oxlint rc=0; UI test-types lane clean (pre-existing @openclaw/session-url-contract worktree artifact excepted, present on main).
  • Autoreview (Codex gpt-5.6-sol, xhigh): first pass flagged the pre-roster conflicting-selection window — fixed with the deferral; final pass clean, "patch is correct (0.87)".

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 05:07
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete
steipete force-pushed the fix/ui-catalog-retired-agent branch from 433dda0 to 83d547c Compare July 27, 2026 05:14
@steipete
steipete force-pushed the fix/ui-catalog-retired-agent branch from 83d547c to 72bbe6f Compare July 27, 2026 05:20
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 1:25 AM ET / 05:25 UTC.

ClawSweeper review

What this changes

The PR makes Control UI validate the selected agent against the connected gateway’s live roster before loading session catalogs or resolving a new-session catalog route, while updating same-client hello handling and connection-reset state.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep this PR open for protected maintainer review. The supplied patch and its merged sibling indicate a focused follow-up for the reload/catalog-targeting regression, with no discrete correctness defect identified in the reviewed diff; however, the branch is behind current main and the PR body supplies tests plus pre-fix production evidence rather than after-fix live Control UI proof.

Priority: P2
Reviewed head: 72bbe6fbd5a289ccb974634f91bb2152ab618aae
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and covered by targeted tests, but missing after-fix real behavior proof keeps the overall merge-readiness signal low.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body provides focused test results and pre-fix production-journal diagnosis, but not after-fix evidence from a live Control UI setup; add a redacted runtime log, terminal output, screenshot/recording with diagnostic output, or comparable live artifact before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body provides focused test results and pre-fix production-journal diagnosis, but not after-fix evidence from a live Control UI setup; add a redacted runtime log, terminal output, screenshot/recording with diagnostic output, or comparable live artifact before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Changed selection and connection boundary: The branch updates same-client hello adoption in agent selection and clears the hello-derived assistant agent ID when the gateway stops or disconnects.
Roster validation path: The branch adds catalog-target resolution that only trusts an agent list associated with the current connected gateway client, with route and sidebar regression coverage for stale and pre-roster states.
Related merged provenance: The PR explicitly follows the merged removal of fabricated pre-roster main identity behavior in #114257; this PR addresses the remaining client selection and catalog-request paths rather than duplicating that merged change.
Findings None None.
Security None None.

How this fits together

Control UI receives a gateway hello and a live agent roster, then derives the active agent for session-catalog RPCs and new-session deep links. This PR changes the boundary that prevents provisional or retired agent IDs from being sent to the gateway.

flowchart LR
  A[Gateway hello] --> B[Gateway connection snapshot]
  C[Live agent roster] --> D[Agent selection]
  B --> D
  D --> E[Catalog target validation]
  C --> E
  E --> F[Session catalog request]
  E --> G[New-session deep link]
Loading

Decision needed

Question Recommendation
Should this protected Control UI routing change proceed after a current-main refresh and after-fix live proof, or should maintainers choose a narrower compatibility policy for pre-roster selections and catalog deep links? Refresh and prove before merge: Rebase onto current main and provide a redacted real Control UI run that exercises the retired-agent reload and a valid catalog deep link.

Why: The maintainer label requires explicit human handling, and the patch intentionally changes the upgrade-visible behavior of persisted/provisional agent selections before the roster is available.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body provides focused test results and pre-fix production-journal diagnosis, but not after-fix evidence from a live Control UI setup; add a redacted runtime log, terminal output, screenshot/recording with diagnostic output, or comparable live artifact before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The branch is behind current main, so the final review should be refreshed after rebasing to ensure nearby Control UI state changes do not alter the three-way merge result.
  • Resolve merge risk (P1) - The patch changes how existing selections and deep links are reconciled before and after roster arrival; focused tests are useful, but the PR lacks after-fix live evidence that the Control UI stops the retired-agent catalog request without regressing valid catalog deep links.
Agent review details

Security

None.

PR surface

Source +296, Tests +180. Total +476 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 6 328 32 +296
Tests 4 180 0 +180
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 508 32 +476

Review metrics

Metric Value Why it matters
Gateway-derived selection default 1 default-normalization path changed Trimming and clearing the hello-derived assistant agent ID changes the value that drives initial agent selection across connect and disconnect transitions.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/session-data-controller-catalog.ts, unknown-data-model-change: ui/src/components/session-data-controller-catalog.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Refresh the branch and add live proof (recommended)
    Rebase onto current main and show the corrected roster/catalog behavior in a redacted live Control UI run before merging.
  2. Accept the remaining compatibility uncertainty
    Merge with the focused tests only, accepting that pre-roster selections and valid catalog deep links have not been demonstrated after the change in a real setup.

Technical review

Best possible solution:

Rebase onto current main, then attach redacted after-fix Control UI evidence showing a retired provisional ID defers or reconciles correctly, a valid deep link still loads its catalog, and retries reuse the existing gateway connection.

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

Yes, at source level with medium confidence: publish a gateway hello whose default differs from a provisional or retired selected agent, delay or replace the roster, and observe the resulting session-catalog target. The PR body also describes a production instance of the failing retired-agent request, but no current after-fix live reproduction is attached.

Is this the best way to solve the issue?

Unclear: validating catalog targets against the roster is aligned with the stated invariant, but current-main rebasing and after-fix live evidence are needed to confirm that the chosen deferral/reconciliation policy is the best behavior for existing selections and deep links.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against df5d85a5b2ff.

Labels

Label changes:

  • add P2: This is a bounded Control UI regression affecting session catalog requests and new-session routing, without evidence of data loss or an outage.
  • add merge-risk: 🚨 compatibility: The PR changes reconciliation of existing provisional selections and catalog deep links during gateway/roster startup, which can alter established user behavior after upgrade.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides focused test results and pre-fix production-journal diagnosis, but not after-fix evidence from a live Control UI setup; add a redacted runtime log, terminal output, screenshot/recording with diagnostic output, or comparable live artifact before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded Control UI regression affecting session catalog requests and new-session routing, without evidence of data loss or an outage.
  • merge-risk: 🚨 compatibility: The PR changes reconciliation of existing provisional selections and catalog deep links during gateway/roster startup, which can alter established user behavior after upgrade.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides focused test results and pre-fix production-journal diagnosis, but not after-fix evidence from a live Control UI setup; add a redacted runtime log, terminal output, screenshot/recording with diagnostic output, or comparable live artifact before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Changed selection and connection boundary: The branch updates same-client hello adoption in agent selection and clears the hello-derived assistant agent ID when the gateway stops or disconnects. (ui/src/app/agent-selection.ts:80, 72bbe6fbd5a2)
  • Roster validation path: The branch adds catalog-target resolution that only trusts an agent list associated with the current connected gateway client, with route and sidebar regression coverage for stale and pre-roster states. (ui/src/components/session-data-controller-catalog.ts:88, 72bbe6fbd5a2)
  • Related merged provenance: The PR explicitly follows the merged removal of fabricated pre-roster main identity behavior in fix(gateway): stop fabricating assistant agent id "main" before roster resolution #114257; this PR addresses the remaining client selection and catalog-request paths rather than duplicating that merged change. (ui/src/app/gateway-store.ts:333, bb55d44840df)
  • Current review state: GitHub reports the PR as cleanly mergeable but behind its base; the supplied repository state identifies current main as df5d85a while the PR base is 2a8c0ca. (df5d85a5b2ff)
  • Proof supplied in the PR body: The body records focused mocked/test-suite validation and a production journal showing the pre-fix failure, but it does not include an after-fix live run, redacted runtime log, terminal output, recording, or screenshot proving the corrected catalog request behavior. (72bbe6fbd5a2)

Likely related people:

  • steipete: The same contributor authored the merged adjacent change that removed fabricated assistant-agent defaults and the current follow-up across the same Control UI gateway and selection boundary. (role: adjacent merged feature author; confidence: high; commits: bb55d44840df; files: ui/src/app/gateway-store.ts, ui/src/app/agent-selection.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and refresh the affected focused checks.
  • Attach redacted after-fix proof covering the retired provisional agent, roster reconciliation, a valid catalog deep link, and connection reuse.

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.

@steipete
steipete merged commit e78310f into main Jul 27, 2026
121 of 127 checks passed
@steipete
steipete deleted the fix/ui-catalog-retired-agent branch July 27, 2026 05:33
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant