Repository navigation
fix(ui): validate session-catalog agent against the live roster - #114303
Conversation
433dda0 to
83d547c
Compare
83d547c to
72bbe6f
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 1:25 AM ET / 05:25 UTC. ClawSweeper reviewWhat this changesThe 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 Priority: P2 Review scores
Verification
How this fits togetherControl 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]
Decision needed
Why: The Before merge
Agent review detailsSecurityNone. PR surfaceSource +296, Tests +180. Total +476 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
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:agent-selection.tsonly re-published when the gateway client object changed, so a hello that arrived on the existing client with the realassistantAgentIdnever updated the selection — the pre-hello state stuck until a full reconnect.sessions.catalog.listfired with whatever provisional selection existed pre-roster; on retired-agent installs that produced the journal's repeatedunknown 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: freshconn=id per failing request).Why This Change Was Made
assistantAgentIdchanges on the same client (hello arriving after connect), adopting the server default when the previous selection was just the provisional default.resolveSessionCatalogAgentIdrequires 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).sessionDefaults.defaultAgentIdis trimmed before adoption so a whitespace-only value cannot become a truthy selection.Rebased onto
mainafter #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
agent-selection.ts:81client-change-only subscription; catalog resolver trusting provisional ids).app-sidebar.test.ts191 passed (includes new fixture: pre-roster conflicting selection defers, hello-default fetch fires when selection matches);agent-selection/gateway-store/new-session route/catalog-target36 passed; worker's broader run 257 passed pre-rebase.board-view.test.ts,bootstrap.test.ts— untouched by this PR; both pass in isolation).@openclaw/session-url-contractworktree artifact excepted, present onmain).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)".