Repository navigation
fix(ui): survive route notFound at startup and stop silent chat draft loss - #120960
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 5:52 AM ET / 09:52 UTC. ClawSweeper reviewWhat this changesRepairs Control UI startup recovery for unresolved chat routes and preserves a typed chat draft when no visible session can own its send. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open: current main still aborts this default Control UI route path and can clear an unowned draft; the PR has no blocking code finding, but its exact-head checks are still running and it is maintainer-owned. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI turns a browser or pairing landing URL into a router state, then resolves the Gateway-backed active session before chat sends are scoped and delivered. This change covers route recovery, deferred session selection, and the composer boundary that hands a message to the chat queue. flowchart LR
A[Browser or pairing landing] --> B[Control UI router startup]
B --> C[Chat route loader]
C --> D[Gateway session readiness]
D --> E[Committed visible chat session]
E --> F[Composer send and chat delivery]
C --> G[Rendered not-found recovery]
G --> D
Before merge
Agent review detailsSecurityNone. PR surfaceSource +46, Tests +211. Total +257 across 14 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the narrow owner-boundary recovery and draft-preservation design, then merge after the still-running exact-head checks are green. Do we have a high-confidence way to reproduce the issue? Yes—current-main source establishes the bare-route startup rejection and the pre-validation composer-clear path, though this read-only review did not execute a browser reproduction. Is this the best way to solve the issue? Yes—the patch repairs the lifecycle and session-owner boundaries; catching all startup failures or only guarding the queue would conceal real errors or leave the underlying route state unresolved. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 135278c8968f. 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
History |
ebbc2d7 to
cb56e8c
Compare
cb56e8c to
ff1baf0
Compare
fa2f099 to
f5a38a0
Compare
What Problem This Solves
Opening the dashboard via the standard
openclaw dashboardpairing URL (or any bare/landing) logs[openclaw] application start failed {type:'notFound'}and aborts the startup lifecycle. Reproduced on a pristine gateway + clean browser profile, every load.Chain: the pairing hash is stripped and the browser lands on bare
/(b438b96, #118388) → the router rewrites it to bare/chat→ the chat loader cannot parse a session from a bare/chatpath and returnsnotFound→ uirouter records the notFound state in its store and then rethrows →router.start()rejects →startupLifecycle.run()(fail-fast sequential since cca5b14, #113883) abandons every remaining startup step with no user-visible signal.Consequences: for a returning user with a persisted non-agent
sessionKey, the deferred recovery step that would install the real session location after gateway connect is registered after the router step and never runs — the app pins on an unresolvable route. The one-shotonNotFound → replaceChatWithCurrentSession()recovery declines while the gateway is still disconnected and its latch never re-arms. On such a never-committed route, a submitted chat message is cleared from the composer and enqueued into an outbox scope no drain owns — silent draft loss with nochat.sendemitted (covered by unit tests on the enqueue path).Why This Change Was Made
Four layers, matching the design the code already implies (notFound is a rendered, recoverable state — the outlet has a full notFound presentation pipeline):
startApplicationRoutertolerates uirouternotFoundrejections (state is already committed to the router store; the outlet owns presentation). Other rejections still propagate.sessionKeyfirst-run/pairing landing now also defers to gateway defaults and adopts the authoritative gateway session key (extension of the existing deferral for persisted non-agent keys).User Impact
Dashboard/pairing landings start cleanly (no
application start failedin console — verified live before/after on a pristine gateway with the embedded browser; chat send round-trip verified working after the fix). Returning users with stale session state can no longer strand on a dead route, and no code path can silently discard a typed message.Evidence
[openclaw] application start failed {type: notFound, data: {routeId: "chat"}}on every load. After: clean console, session route commits,chat.sendround-trip completes with a model reply in-UI.?session=landing normalization; b438b96 (fix: dashboards fail to load and interrupted first-time setup never recovers #118388) made the pairing flow always land on bare/.ui/src/app685 passed / 1 skipped (new: runtime.start() resolves when the initial route is notFound; recovery re-arms on gateway connect; default landing resolves to a session path),ui/src/pages/chat/chat-send272 passed (new: unscopable submit keeps draft + notices, no stranded queue item). Core-test + UI typechecks green.Red-main fix carried in this PR
On the pre-rebase head, this PR carried the CI-faithful refresh for the lost update between #120927 and #118451, generated and checked on a Linux Node 24 Testbox because macOS/Node 26 generation drifts. While this PR was rebased for a GitHub-reported conflict, current main advanced to
d0e812e18f4and incorporated an equivalent combined-tree baseline refresh. A fresh post-rebase Linux Node 24 Testbox run confirmed current main's manifest is byte-identical to generated output andpnpm plugin-sdk:api:checkpasses, so the now-empty duplicate baseline commit was dropped. No baseline or other generated-file diff remains in this PR.