Repository navigation
fix: first quick chat works on a fresh Gateway with no stored sessions - #2432
shanselman wants to merge 8 commits into
Conversation
The floating claw created its dedicated conversation as a child of the advertised main session. A fresh Gateway advertises agent:main:main before storing it and rejects the unknown parent. Create a root session for the compose target's agent instead. Relates to #2316 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🦞👀 ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: needs changes before merge. What this changesThis PR creates floating-claw quick chats as root sessions instead of children of the advertised main session. Example: A fresh Gateway advertises agent:main:main and returns an empty session list.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this PR addresses a current-main failure, but the new creation request can target the wrong agent when the advertised main session has no stored row. Reviewed head: Before merge
Findings
Agent review detailsHow this fits togetherThe floating-claw host obtains a compose target from the shared chat provider, creates a Gateway session through the authenticated bridge, and mounts chat using the returned session key. flowchart LR
A[Floating claw] --> B[Quick chat host]
B --> C[Chat provider]
C --> D[Gateway bridge]
D --> E[Session creation RPC]
E --> F[Returned session key]
F --> B
Technical reviewBest possible solution: Create parentless quick chats using the advertised target's actual agent, including when its session row is absent, while preserving per-Gateway reuse and typed /new behavior. Do we have a high-confidence way to reproduce the issue? Source establishes the empty-store parent failure and the non-main-agent defect in the proposed replacement; the reporter's exact entry point and installed versions remain unknown, and no runtime reproduction was performed. Is this the best way to solve the issue? Parentless creation through the existing provider seam is the smallest appropriate repair, provided agent identity comes from the advertised target rather than the session-list fallback. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6c14fe598718. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed December 1, 2026, 12:09 PM ET / 17:09 UTC. |
…on is stored The floating claw quick chat now creates a root session only when the compose target is not yet stored on the Gateway (fresh install, #2316). Established installs keep main's /new request with the parent link and command hooks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…pick default agent A placeholder thread for an unstored main key could still route quick chat through /new with an unknown parent. The root path now passes no agent id so the Gateway's default agent is used. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Job and tool events track session rows client-side for keys the Gateway may not have stored. Mark rows returned by an authoritative session roster and use only those when choosing a /new parent for quick chat. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Clear IsGatewayListed on reconnect so cached rows are not trusted, and count a sessions update as a roster only when every row was listed by the Gateway, so a job or tool event republish cannot unlock compose readiness. Pin that a missing agent id is omitted from sessions.create. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…t rejection A rejected sessions.list is also retried once per connection so the roster gate cannot stay locked. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rejection Carry sessions.create OutcomeUncertain through the lifecycle result so an uncertain failure carrying the unknown-parent text is not retried. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
When a quick-chat create may have committed (timeout or lost connection), keep the attempt cached instead of dropping it, refresh the roster, and adopt the single new session once it is listed, so reopening the floating claw never sends a duplicate create. The shared create no longer takes the opening window's token, so closing that window cannot cancel a create that a reopened window has joined. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
16af7798021043a08e8112291077c06272e767f0unknown parent session, it retries once as a root session (no parent, no agent id, no hooks) without posting the error into main; timeout, lost connection and other errors do not retry.↑ A rejected
sessions.listis retried once per connection, so the roster gate cannot stay locked after one failure.↑ Fresh-Gateway regressions (empty list; pending main timeline placeholder; main row tracked only from a job event) fail without the fix and pass with it.
↑ Stored-parent test proves established installs keep main's
/newparent, command hooks and parallel-child request.↑ Stored is decided only from rows an authoritative Gateway session roster returned (
SessionInfo.IsGatewayListed), with a Shared test that job-event rows stay unlisted until a roster includes them and that reconnect clears the flag.↑ Compose readiness unlocks only for a current-connection roster (every row listed, including empty); a regression shows a job-event republish after reconnect keeps quick chat locked, and fails without the fix.
↑ build.ps1, Shared (6240 passed) and Tray (7240 passed) green locally.
↑ The unknown-parent root retry runs only for a definitive rejection; an uncertain failure with that text does not retry.
↑ An uncertain create (timeout or lost connection) stays cached and refreshes the roster; reopening sends no second create and adopts the single new root (or parent child) session once listed. The test fails without the fix.
↑ The shared create ignores the opening window token, so close and reopen while pending joins one create (fails when the window token is passed).
↓ If an uncertain create never committed, or several new sessions appear, quick chat for that Gateway stays on its error until one new session is listed or the app restarts.
↓ A stored parent beyond the roster's default 100-row limit gets a root session without
/newhooks (accepted residual, not a failure).↑ Live on a fresh 2026.11.13 Gateway: this head's parentless request with
agentIdomitted succeeds under the Gateway default agent; explicitagentId:nullis rejected, and the client omits null (BuildSessionCreateParameters).↓ The Companion UI itself was not run against the live Gateway.
INVALID_REQUEST unknown parent session: agent:main:main.↑ Upstream
prepareSessionCreateParentreturns this error when the parent has no stored entry.↓ The reporter's first-chat entry point and versions are unknown; another path could also produce the error.
Relates to #2316
What Problem This Solves
On a fresh install, opening the floating claw's quick chat right after setup could fail with
unknown parent session: agent:main:main. Quick chat created its conversation as a child of the main session, but a new Gateway advertises that main session before it has stored it, so the Gateway rejects the parent.User Impact
User impact: the floating claw's quick chat can start its first conversation on a Gateway that has no stored sessions yet.
Why This Change Was Made
Quick chat used to always run the
/newchild-session command against the compose target. It still does when an authoritative Gateway session roster has returned that session (rows tracked only from job or tool events do not count), so established installs keep the parent link and the Gateway's/newcommand hooks (for example saving the parent's memory). When the compose target is not yet stored (fresh install), it now creates a root session with no agent id, so the Gateway uses its own default agent, the same parentless creation Workspace uses for a new chat, and refreshes the session list. Typed/newin an existing chat is unchanged.Evidence
CreateQuickChatSession_ZeroSessions_CreatesRootSessionWithoutUnstoredParent(Gateway connected, empty session list): on main behavior it failed withExpected: null, Actual: "agent:main:main"for the parent; with the fix it passes and sends no parent and no agent id.CreateQuickChatSession_UnstoredMainWithPendingTimeline_CreatesRootSession: with no stored sessions but a chat event onagent:main:main(which adds a local placeholder thread), the request has no parent; without the fix it sent the unstored parent.CreateQuickChatSession_MainTrackedOnlyFromJobEvent_CreatesRootSessionand SharedTrackedSessionFromJobEvent_IsGatewayListedOnlyAfterSessionRoster: a main row created client-side by a job event is not treated as stored, so quick chat sends no parent; both failed without the fix.OnConnectedAsyncclearsIsGatewayListed, and a sessions update counts as a roster only when every row is listed.LoadAsync_ReconnectJobEventWithoutRoster_KeepsQuickChatLockedshows a job-event republish after reconnect no longer unlocks quick chat (failed without the fix); the Shared roster test now also covers reconnect.CreateQuickChatSession_UnknownParentRejection_RetriesOnceAsRootSession: a definitive unknown-parent rejection is followed by exactly one parentless retry (no agent id,emitCommandHooks=false) that succeeds, and main gets no error entry; it failed without the fix.CreateQuickChatSession_OtherParentedFailure_DoesNotRetry(timeout, lost connection, other error) sends only the parented request.SessionsListError_RetriesOncePerConnection(Shared): a rejectedsessions.listgets one scheduled retry per connection, not a loop, and reconnect re-arms it; it failed without the fix. Before this, the one post-handshakesessions.listwas not retried, so only a later Gateway session event could unlock the composer.LoadAsync_JobEventAddsUnlistedRowAfterRoster_KeepsComposeReady: an unlisted job-event row after a roster keeps compose ready.BuildSessionCreateParameters_OmitsMissingAgentId: a null or blank agent id is omitted fromsessions.create.CreateQuickChatSession_OtherParentedFailure_DoesNotRetrynow also covers an uncertain (timeout or lost connection) result whose error containsunknown parent session: no retry. It failed before theOutcomeUncertainguard and passes with it.QuickChat_UncertainRootCreate_ReopenAdoptsRosterSessionWithoutCreatingAgain: an uncertain root create throwsQuickChatCreationUncertainExceptionand refreshes the roster; reopening keeps the attempt (one create request) and, once the roster lists one new root session, adopts it. It failed without the fix (the attempt was dropped and reopening created again).QuickChat_CloseAndReopenWhileParentedCreatePending_JoinsTheSameCreate: closing the first window while the parented create is pending, then reopening, joins that create; after an unknown-parent rejection the reopened window gets the root session. Passing the window token into the shared create (the old host wiring) makes it fail withOperationCanceledException.ChatHost_SharedQuickChatCreateIgnoresTheOpeningWindowTokenpins the host wiring and failed on the previous host.sessions.listretry tweak was not needed: errors from older connections are dropped before the handler andsessions.listis sent only on a ready connection, so a scheduled refresh is declined only when disposed or without read scope./newhooks rather than an error.CreateQuickChatSession_StoredComposeSession_KeepsNewCommandParentAndHooks: with a stored main session the request keeps parentagent:main:main,emitCommandHooks=trueandsucceedsParent=false, as on main../build.ps1: all builds succeeded.dotnet test ./tests/OpenClaw.Shared.Tests: 6240 passed, 28 skipped, 0 failed.dotnet test ./tests/OpenClaw.Tray.Tests(excluding the host-profileSettingsManagerIsolationTests.OpenClawTrayDataDirRedirectsSettingsAwayFromRealAppData): 7240 passed, 0 failed.OPENCLAW_STATE_DIR,openclaw gateway call):sessions.listreturned no sessions;sessions.create {parentSessionKey:"agent:main:main", emitCommandHooks:true, succeedsParent:false}(the old quick-chat request) failed withINVALID_REQUEST unknown parent session: agent:main:main;sessions.create {emitCommandHooks:false}(this head's request,agentIdomitted) succeeded and createdagent:main:dashboard:…under the default agent; an explicitagentId:nullis rejected withat /agentId: must be string, andBuildSessionCreateParametersomits a null agent id. After storingagent:main:main, the old/newrequest succeeded and createdagent:main:dashboard:…with that parent. Request shape unchanged since; re-run on head7c13bd0in a new guest; the guest was stopped afterwards.Required proof pools
windows-wsl-gateway-e2e: first quick chat against a fresh Gateway with no stored sessions. Partially verified: Gateway protocol reproduced and fix request accepted on a fresh 2026.11.13 Gateway in Windows Sandbox (see Evidence). Not verified / blocked: Companion UI not driven against it.