Repository navigation
fix(gateway): stop fabricating assistant agent id "main" before roster resolution - #114257
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 26, 2026, 11:40 PM ET / July 27, 2026, 03:40 UTC. ClawSweeper reviewWhat this changesThe PR removes fabricated Merge readiness⛔ Blocked until real behavior proof is added - 4 items remain Keep this PR open. The patch has a coherent, narrow fix for the pre-roster Control UI startup regression and its focused coverage matches the reported path, but it still lacks inspectable after-fix real behavior proof from an affected deployment or equivalent live setup. Priority: P2 Review scores
Verification
How this fits togetherThe gateway exposes a small Control UI bootstrap payload and later sends WebSocket hello/session-default data; the UI combines those with the agent roster to choose an agent for catalog and session requests. This PR changes the unresolved startup state from a hard-coded agent id to no selection until the real roster or gateway data is available. flowchart LR
A[Control UI bootstrap] --> C[Gateway store]
B[WebSocket hello] --> C
C --> D[Agent selection]
E[Agent roster] --> D
D --> F[Agent-scoped catalog requests]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +51. Total +54 across 8 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the no-agent-until-resolved model, retain the focused bootstrap/store/roster regression coverage, and add redacted after-fix reload evidence showing no Do we have a high-confidence way to reproduce the issue? No high-confidence reproduction was independently run in this review. The provided production trace plus the branch’s focused tests make the path source-reproducible: load the Control UI with a roster containing only Is this the best way to solve the issue? Yes, conditionally. Representing the unresolved state as no agent and adopting the roster default is narrower and more maintainable than retaining a bundled id, but it needs after-fix proof on the affected startup path before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 04bb2b7ee9a9. 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
HistoryReview history (1 earlier review cycle)
|
|
Addressing the rank-up moves. Consumer audit (move 2), performed: every consumer of After-fix reload evidence (move 1): follows deployment to team.openclaw.ai immediately after merge — acceptance is the production journal showing zero |
3247f1a to
41eea47
Compare
…r resolution Three fabrication points told clients the assistant agent was "main" before any roster/config resolution: DEFAULT_ASSISTANT_IDENTITY in src/gateway/assistant-identity.ts, the Control UI store's initial snapshot (ui/src/app/gateway-store.ts:65), and its hello fallback (:336). On installs whose implicit main agent is retired, every page reload fired sessions.catalog.list for the nonexistent agent and flashed 'unknown agent id "main"' in the sidebar. The no-roster state now carries no agent id: DEFAULT_ASSISTANT_IDENTITY drops agentId, resolveAssistantIdentity returns ResolvedAssistantIdentity (agentId required) for config-backed paths, the bootstrap omits the optional assistantAgentId field without config, the UI store starts null, and agent selection adopts the roster default once agents.list arrives.
41eea47 to
f089cf4
Compare
|
Merged via squash.
|
|
Post-deploy verification from team.openclaw.ai, as promised. Deploy Clean-idle snapshot (first minutes after deploy, per-method journal latency):
Full 24.6h soak aggregate (with an honest caveat): The aggregate The Error rate excluding that spam: 319 over 24.6h (~13/h), zero crashes, RSS steady ~820MB. |
…r resolution (openclaw#114257) Three fabrication points told clients the assistant agent was "main" before any roster/config resolution: DEFAULT_ASSISTANT_IDENTITY in src/gateway/assistant-identity.ts, the Control UI store's initial snapshot (ui/src/app/gateway-store.ts:65), and its hello fallback (:336). On installs whose implicit main agent is retired, every page reload fired sessions.catalog.list for the nonexistent agent and flashed 'unknown agent id "main"' in the sidebar. The no-roster state now carries no agent id: DEFAULT_ASSISTANT_IDENTITY drops agentId, resolveAssistantIdentity returns ResolvedAssistantIdentity (agentId required) for config-backed paths, the bootstrap omits the optional assistantAgentId field without config, the UI store starts null, and agent selection adopts the roster default once agents.list arrives.
What Problem This Solves
On team.openclaw.ai (agent
maindeliberately retired; roster =roboclawonly), every Control UI page reload briefly flashes an error chip in the CODING sidebar section —unknown agent id "main"with a Retry button — and a fresh "New thread" view can showmainin the agent picker. The gateway journal shows the client firing on each reload, then retrying every ~3s:Root cause is a fabricated identity, hardcoded in three places:
ui/src/app/gateway-store.ts:65— the client gateway store initializesassistantAgentId: "main"before any server data arrivesui/src/app/gateway-store.ts:336— the hello handler falls back to"main"when session defaults are absentsrc/gateway/assistant-identity.ts—DEFAULT_ASSISTANT_IDENTITY.agentId: "main", served through the Control UI HTTP bootstrap whenever no config snapshot is threadedAgent selection (
ui/src/app/agent-selection.ts) trusts that id during the pre-roster window (reconciliation passes unknown ids through untilagents.listarrives), so agent-scoped catalog RPCs target a nonexistent agent.Why This Change Was Made
Core must not carry bundled agent ids when a roster contract exists (root AGENTS.md architecture rule). The honest state before config/roster/hello resolution is "no agent known":
DEFAULT_ASSISTANT_IDENTITYno longer carries an agent id;resolveAssistantIdentityreturns aResolvedAssistantIdentity(agentId required) so all config-backed paths keep their guarantee at the type level.ControlUiBootstrapConfig.assistantAgentIdbecomes optional and is omitted when no config is present (HTTP bootstrap contract only; no gateway-protocol change).assistantAgentId: nulland the hello fallback isnull, not"main".reconcileSelectedIdnow also adopts the roster default when nothing is selected once the roster loads, so the picker settles on the real default agent instead of a fabricated one.Production paths always thread
loadGatewayConfig(), so configured installs see identical behavior; the change only removes the fabricated id in the config-absent/pre-hello windows.User Impact
No more
unknown agent id "main"flash on reload on installs whose implicitmainagent was retired; the agent picker cannot show a nonexistent agent while booting. Fewer wasted failing RPCs during startup.Evidence
src/gateway/control-ui.http.test.ts— new coverage that the bootstrap omitsassistantAgentIdwithout config and resolves the roster id with config.ui/src/app/gateway-store.test.ts— snapshot starts null / hello fallback stays null.ui/src/app/agent-selection.test.ts— null-selection adopts roster default on roster arrival.git diff --checkclean.gpt-5.6-sol, xhigh): clean, "patch is correct (0.93)".