Repository navigation
fix(ui): claim new-session handoffs on the direct chat route - #114377
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 3:42 AM ET / 07:42 UTC. ClawSweeper reviewWhat this changesThe PR updates Control UI new-session handoffs so direct chat routes claim rejected-turn and initial-prompt state before transcript history resolves, with related mocked-Gateway test updates. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep this maintainer-labeled PR open. The supplied context supports a focused repair for the direct-route handoff regression, but the sandbox prevented the mandatory current-source, scoped-policy, history, and lifecycle inspection; it also lacks inspectable after-fix browser/runtime proof. Priority: P2 Review scores
Verification
How this fits togetherControl UI creates a new session from a submitted prompt, routes the browser to that session’s chat view, and reconciles temporary prompt or rejection handoffs with Gateway transcript history. The affected lifecycle controls whether users immediately see their prompt or a recovery state while transcript data is still loading. flowchart LR
A[New-session submission] --> B[Session creation]
B --> C[Direct chat route]
C --> D[Handoff admission]
D --> E[Transcript history merge]
E --> F[Visible prompt or retry state]
Decision needed
Why: The sandbox prevented the required source and history review, while the patch affects user-visible ephemeral session state where incorrect handoff ownership could regress ordering or recovery. Before merge
Agent review detailsSecurityNone. PR surfaceSource +61, Tests +28. Total +89 across 7 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Confirm the patch against the complete current chat lifecycle, then add redacted browser or runtime evidence that a directly routed new session immediately shows its submitted prompt and exposes a rejected-turn retry state without duplicate or reordered transcript rows. Do we have a high-confidence way to reproduce the issue? No high-confidence reproduction was independently established because the read-only shell failed before source or tests could be inspected. The supplied context gives a focused mocked-Gateway path and direct-route sequence, so the report is source-reproducible only from that evidence. Is this the best way to solve the issue? Unclear. The patch is plausibly at the stated handoff seam, but the required comparison with current lifecycle callers, sibling paths, tests, and history could not be completed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d4ed57bc8847. LabelsLabel 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 (2 earlier review cycles)
|
9a07efb to
3265cc7
Compare
Deferred session navigation can route a pane straight onto the created session key, which never runs the switch path that admits the one-shot handoffs. The rejected turn then expired unclaimed instead of offering a retry, and an accepted prompt stayed hidden until the transcript bootstrap resolved. Mirror chat-state-route's admission on the direct branch. Fixes #114374
A pane that admits the accepted prompt before its transcript bootstrap resolves leaves that row in chatMessages while the history request is in flight. The merge then re-placed it as a late optimistic tail, and since #113266 stable rows keep insertion order, the first turn rendered below the tool activity it kicked off. The handoff reconciler owns that head row, so exclude it from the late tail.
3265cc7 to
70ce23d
Compare
|
Both rank-up moves from the ClawSweeper review, addressed against head 1. Real-browser proof for direct-route prompt visibility and rejected-turn recoveryCaptured with Playwright/Chromium against a built Control UI, screenshotting the live pane at the same point in each scenario with and without the product commits ( Rejected turn —
Before, the pane is empty: the user's message is gone, with no error and nothing to retry — the handoff expired unclaimed against its 60s TTL. After, the storage error banner is shown and the failed turn is present with its Retry control, so the message is recoverable. Accepted prompt —
Both frames are 2.5s after the route commits. Before, the thread is still skeletons — the prompt is not visible because it only arrives once the transcript bootstrap resolves. After, the prompt renders immediately. Checksums and sizes: artifact-manifest.json. The screenshot calls were temporary instrumentation and are not part of the diff. 2. Comparison with the switch, reconnect, and transcript-reconciliation paths
CI is green on this head (71 pass / 18 skip) after one rerun of |
|
Merged via squash.
|
…w#114377) * test(ui): align new-session e2e with path routes and startup transcript * fix(ui): claim new-session handoffs on the direct chat route Deferred session navigation can route a pane straight onto the created session key, which never runs the switch path that admits the one-shot handoffs. The rejected turn then expired unclaimed instead of offering a retry, and an accepted prompt stayed hidden until the transcript bootstrap resolved. Mirror chat-state-route's admission on the direct branch. Fixes openclaw#114374 * fix(ui): keep the projected first prompt above the replies it started A pane that admits the accepted prompt before its transcript bootstrap resolves leaves that row in chatMessages while the history request is in flight. The merge then re-placed it as a late optimistic tail, and since openclaw#113266 stable rows keep insertion order, the first turn rendered below the tool activity it kicked off. The handoff reconciler owns that head row, so exclude it from the late tail.




What Problem This Solves
Four tests in
ui/src/e2e/new-session-page.e2e.test.tshave been failing onmainsince #113883 landed path-based session routes. Bisected on a clean Blacksmith Testbox:cca5b147857d5c~1green,cca5b147857d5cred. Nothing caught it becausetest/vitest/vitest.ui-e2e.config.tsis not referenced byci.yml— only bypackage.jsonandmantis-web-ui-chat-proof.yml, which runs a single unrelated file.Two of the four are stale test expectations. Two are real product regressions, tracked in #114374.
Why This Change Was Made
Stale expectations. #113883 replaced
?session=<key>with a/chat/<key>path, sourl.searchParams.get("session")never matches again; the assertion now compares againstcontrolUiSessionPath(sessionKey). Separately, the transcript bootstrap preferschat.startupwhenever the Gateway advertises it, so threewaitForRequest("chat.history")gates could no longer fire and the image test deferred a method the app never calls. Those gates are replaced by the rendered rows they were standing in for, and the deferral moves tochat.startup.ui/src/test-helpers/control-ui-e2e.tsgains the other half of that: a scenario that configures onlychat.historynow has its transcript replayed onto thechat.startuppayload, so both bootstrap paths serve the same conversation instead of one silently returning nothing.Product regressions (#114374).
chat-pane-lifecycle.tsclaimed the two one-shot handoffs — the rejected turn and the accepted prompt — only on the session-switch path. Before #113883 every created session went through that path. With deferred session navigation a pane can be routed straight onto the created session key, and then neither handoff is ever admitted: the rejected turn expires against its 60s TTL and the user gets no retry affordance, and the accepted prompt stays invisible until the transcript bootstrap resolves. The fix admits both handoffs on the direct-route branch as well, which is the same seam that already owns them.Verified by instrumenting the handoff store:
PROBE_PREPAREfires without a matchingPROBE_CONSUMEon unpatchedmain.User Impact
Submitting a new session that the Gateway rejects now surfaces the error and keeps the draft recoverable instead of silently dropping it, and an accepted prompt appears immediately rather than after the transcript loads. The rest is test-only.
Evidence
Blacksmith Testbox,
pnpm test:ui:e2e ui/src/e2e/new-session-page.e2e.test.ts:main@736a788cb81d5bThe remaining failure is
resolves a pending catalog target after reconnect without clearing the draft. It is not caused by this PR: it fails in isolation on unmodifiedmainand atcca5b147857d5c~1, so it predates #113883. It passed inmain's full-suite run only because an earlier test used to die on a stale URL assertion before completing its offline/online cycle; fixing that assertion removes the masking. Root cause is now identified and filed separately as #114398 — the new-session route loader drops the requested agent id while offline, socatalog.routeKeyflips from["","claude"]to["research","claude"]on reconnect andresetDraft()wipes the typed message. That gets its own PR.Chat unit suites covering the touched seam:
chat-page.test.ts,route.test.ts,chat-pane-board.test.ts— 62 passed.Fixes #114374