Skip to content

fix(ui): survive route notFound at startup and stop silent chat draft loss - #120960

Merged
steipete merged 1 commit into
mainfrom
fix/control-ui-startup-notfound
Aug 9, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/control-ui-startup-notfound

Conversation

@steipete

@steipete steipete commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Opening the dashboard via the standard openclaw dashboard pairing 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 /chat path and returns notFound → 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-shot onNotFound → 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 no chat.send emitted (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):

  1. startApplicationRouter tolerates uirouter notFound rejections (state is already committed to the router store; the outlet owns presentation). Other rejections still propagate.
  2. The notFound recovery latch distinguishes "declined" (shell disconnected) from "handled", and re-runs recovery once gateway readiness flips to connected.
  3. The default chat landing no longer starts the router on a knowingly-unresolvable path: the empty-sessionKey first-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).
  4. Safety net: a submit that cannot be scoped to a committed/visible session keeps the draft, creates no queue item, and surfaces the existing session-unavailable notice — a draft can no longer vanish without a visible outcome.

User Impact

Dashboard/pairing landings start cleanly (no application start failed in 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

  • Live: pristine gateway + pairing URL. Before: [openclaw] application start failed {type: notFound, data: {routeId: "chat"}} on every load. After: clean console, session route commits, chat.send round-trip completes with a model reply in-UI.
  • Regression provenance: cca5b14 (feat(ui): path-based session and dashboard URLs #113883) introduced the fail-fast startup lifecycle and removed the old ?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 /.
  • Tests: ui/src/app 685 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-send 272 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 d0e812e18f4 and 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 and pnpm plugin-sdk:api:check passes, so the now-empty duplicate baseline commit was dropped. No baseline or other generated-file diff remains in this PR.

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Aug 9, 2026
@steipete
steipete marked this pull request as ready for review August 9, 2026 06:36
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 9, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 5:52 AM ET / 09:52 UTC.

ClawSweeper review

What this changes

Repairs Control UI startup recovery for unresolved chat routes and preserves a typed chat draft when no visible session can own its send.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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
Reviewed head: f5a38a0d850d8f725c28667c9f7f48f1da90e2ec

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, well-covered repair with no supported correctness finding; normal exact-head CI completion remains the final merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the body records a live before/after claim but no inspectable artifact was available.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the body records a live before/after claim but no inspectable artifact was available.
Evidence reviewed 5 items Current-main startup path: Current main rewrites the bare landing into chat and directly awaits router startup and dynamic navigation, so a loader rejection can still abort the startup sequence.
Current-main draft-loss boundary: Current main clears composer state before enqueueing without first confirming that the submitted session is visible and owned.
PR owner-boundary repair and coverage: The PR catches only typed route-not-found rejections, re-arms recovery after Gateway readiness, resolves implicit empty-session landings from Gateway state, and checks visible session ownership before clearing the composer; focused tests cover each boundary.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

  • Resolve merge risk (P1) - The local dependency source for @openclaw/uirouter was unavailable and network lookup failed; direct PR tests exercise the observed committed-not-found/rejection contract, but an independent dependency-source check remains unavailable.
  • Complete next step (P2) - This maintainer-owned PR has no mechanical repair to dispatch; wait for exact-head CI and normal maintainer merge review.
Agent review details

Security

None.

PR surface

Source +46, Tests +211. Total +257 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 9 68 22 +46
Tests 5 280 69 +211
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 348 91 +257

Review metrics

Metric Value Why it matters
Production versus test delta production +68/-22 (net +46); tests +280/-69 (net +211) The production growth is justified by explicit router-recovery and session-ownership boundaries; most of the change is focused regression coverage.

Stored data model

Persistent data-model change detected: serialized state: ui/src/app/bootstrap.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the narrow owner-boundary recovery and draft-preservation design, then merge after the still-running exact-head checks are green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: A standard dashboard landing can fail during startup, and the affected chat path can silently discard a typed draft without emitting a send.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the body records a live before/after claim but no inspectable artifact was available.

Evidence

What I checked:

  • Current-main startup path: Current main rewrites the bare landing into chat and directly awaits router startup and dynamic navigation, so a loader rejection can still abort the startup sequence. (ui/src/app-routes.ts:181, 135278c8968f)
  • Current-main draft-loss boundary: Current main clears composer state before enqueueing without first confirming that the submitted session is visible and owned. (ui/src/pages/chat/chat-send-submit.ts:417, 135278c8968f)
  • PR owner-boundary repair and coverage: The PR catches only typed route-not-found rejections, re-arms recovery after Gateway readiness, resolves implicit empty-session landings from Gateway state, and checks visible session ownership before clearing the composer; focused tests cover each boundary. (ui/src/app-routes.ts:167, f5a38a0d850d)
  • Regression history: The merged path-based URL work contains the central startup files, while the later dashboard pairing work changed the bare-root landing; both precede the current-main behavior this PR repairs. (ui/src/app-routes.ts:209, cca5b147857d)
  • Current-main and release check: The PR head is neither contained by current main nor by any tag, so its repair remains necessary and is not shipped. (ui/src/app-routes.ts:167, f5a38a0d850d)

Likely related people:

  • steipete: Current-main blame/shortlog for the central Control UI files and merged path-routing and pairing history point to Peter Steinberger; this PR continues that same ownership path. (role: feature owner and recent area contributor; confidence: high; commits: cca5b147857d, b438b9605f33, f5a38a0d850d; files: ui/src/app-routes.ts, ui/src/app/bootstrap-location.ts, ui/src/app/app-shell-navigation.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the currently running exact-head checks complete green before taking the normal maintainer merge decision.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-09T06:43:54.342Z sha ebbc2d7 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-09T07:43:51.179Z sha cb56e8c :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the fix/control-ui-startup-notfound branch from ebbc2d7 to cb56e8c Compare August 9, 2026 07:17
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 9, 2026
@steipete
steipete force-pushed the fix/control-ui-startup-notfound branch from cb56e8c to ff1baf0 Compare August 9, 2026 09:18
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 9, 2026
@steipete
steipete force-pushed the fix/control-ui-startup-notfound branch from fa2f099 to f5a38a0 Compare August 9, 2026 09:44
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Aug 9, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 9, 2026
@steipete
steipete merged commit 6f56d79 into main Aug 9, 2026
103 checks passed
@steipete
steipete deleted the fix/control-ui-startup-notfound branch August 9, 2026 09:57
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant