Skip to content

fix(ui): preserve first startup errors across session navigation - #130593

Merged
steipete merged 1 commit into
mainfrom
steipete/server-performance-slowdown-000aef
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/server-performance-slowdown-000aef

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #130589. Follow-up to #130192 (session-first remote project startup).

What Problem This Solves

Fixes an issue where users starting a remote-project session could lose the first clone error while navigating into the new chat. Reloading a failed chat also removed its diagnostic, leaving only the submitted message; users had to retry to see why setup failed.

Why This Change Was Made

Early setup/dispatch failures now pass their diagnostic through the existing canonical session lifecycle snapshot, saving the bounded lastRunError atomically with terminalization. Chat startup, full history, and cursor catch-up restore missed terminal failures through the existing run reducer and shared error display.

This removes duplicate lifecycle assignments rather than introducing another error store or UI cache. Retry admission clears the old diagnostic, newer live runs win over stale history, and a complete live diagnostic is preserved instead of being replaced by the 160-character stored summary. Clone policy, authentication, cancellation ownership, retry policy, schemas, and protocol contracts are unchanged.

User Impact

The first startup error stays visible after opening the session, reloading the browser, or restarting the Gateway—without sending another message. Normal retries remain usable and do not display stale errors from the previous run.

Evidence

Real Chrome and a real loopback-only Gateway, built from main 42112dd86ec3010cb14011d7514c82063b12974a and then the repaired source, with isolated state and a real failing GitHub clone. No mocked Gateway, forged events, or operator service changes were used.

  • Before: the durable row had status=failed and lastRunId, but no lastRunError; browser reload left no diagnostic.
  • After: an error that arrived before the chat pane mounted was recovered on its first open. The original prompt and actionable error remained visible after reload and a complete isolated Gateway stop/start, without retry.
  • Screenshots below were inspected and contain only synthetic test-session content. Test services/state were cleaned up.

Red-green regressions:

  • Gateway startup/history assertion failed on main because lastRunError was absent.
  • UI recovery assertions failed on main because chatRunError was absent.
  • Final focused proof: 65 Gateway tests and 222 UI tests passed, including cancellation, retry clearing, cursor catch-up, initial-turn handoff, complete live diagnostics, and stale newer-run fences.

Exact local commands:

node scripts/run-vitest.mjs src/gateway/server.sessions.create.projects.test.ts src/gateway/server-methods/chat-send-dispatch-errors.test.ts src/gateway/session-lifecycle-state.test.ts src/gateway/server.chat-abort-dispatch-rejection.test.ts
node scripts/run-vitest.mjs src/gateway/server.chat.gateway-server-chat-b.test.ts -t 'durably admits a restart-safe|releases an unadopted durable claim|releases a durable claim|leaves a post-admission routing rejection'
node scripts/run-vitest.mjs ui/src/pages/chat/chat-history.inflight.test.ts ui/src/pages/chat/chat-history-cursor.test.ts ui/src/pages/chat/chat-history.test.ts ui/src/pages/chat/chat-state.test.ts ui/src/pages/chat/run-lifecycle.test.ts ui/src/pages/chat/initial-turn-handoff.test.ts ui/src/pages/new-session/draft-submission-flow.test.ts

pnpm build, the full changed-file check plan, git diff --check, and independent autoreview passed. Relevant error/lifecycle owners remained unchanged on later main 8e1c34e21dd08f813cefc982079384fdd83fc084.

Production LOC: +97/-51 (net +46) | Tests: +158/-2 (net +156) | Docs: +2/-0. The necessary growth restores a missing durable diagnostic and its history presentation using existing ownership and run-identity fences; there is no new persistence surface or fallback path.

AI-assisted; source, red-green tests, and real browser behavior were independently inspected.

Before: reloading the failed session loses the clone diagnostic

After: the first clone failure is recovered when chat opens

@steipete
steipete marked this pull request as ready for review August 27, 2026 02:08
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete

steipete commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Exact-head CI is verified green for e933161a98f65cefb0f8e65953667c15d1819232: https://github.com/openclaw/openclaw/actions/runs/33032349794 (attempt 1). Native preparation and scripts/pr merge-verify 130593 passed. The older cancelled creation run is superseded by this successful run.

Correction to the earlier preparation note: the missing Clownfish check was not a demonstrated blocker for the authenticated account, which was exempt from that ruleset. Normal native merge verification succeeded. The repository owner separately requested removal of the Clownfish exact-merge ruleset; openclaw/ci-gate, linear history, and deletion/non-fast-forward protections remain enforced. No alternate merger is being used.

Root cause: the restart-safe setup/dispatch terminalizer saved the failed state but omitted its diagnostic and suppressed the later lifecycle write. A newly mounted chat could miss the transient live event; history previously restored only active runs. The fix reuses the canonical bounded lifecycle snapshot and existing run reducer, with no new error store, UI cache, schema, clone policy, or retry policy.

Best-fix judgment: repair the authoritative terminal producer and restore its existing session-row diagnostic on the reader. Rejected alternatives: delaying navigation, client-only error caches, and extra retry/timeout paths would preserve the ownership failure or lose errors on reload.

Live proof was run in real Chrome against a real isolated loopback Gateway with an actual failing GitHub clone. Before: no stored lastRunError, and reload removes the diagnostic. After: a failure arriving before the pane mounts appears on first open and remains through reload and a full Gateway restart without retry. Inspected synthetic before/after images are in the PR body. No production service was changed.

Focused regression proof: 65 Gateway tests and 222 UI tests passed. Tests failed on main for missing lastRunError/chatRunError before the repair. The full changed-file check plan, rebuild, whitespace check, and exact-diff independent autoreview passed.

Production +97/-51 (net +46), tests +158/-2, docs +2. The growth supplies the previously absent error handoff and history recovery with existing run-identity fencing; duplicate lifecycle assignments and the separate error setter were removed.

Provenance: the terminalizer without diagnostic recording dates to #106151 (bafabba0dfc5), authored and merged by @steipete on 2026-07-13. The missing history recovery became visible in the first-open remote project flow added by #130192. This repair does not reconstruct diagnostics already discarded by older builds; future failed runs retain their existing bounded summaries.

@steipete
steipete merged commit a872abc into main Aug 27, 2026
226 of 278 checks passed
@steipete
steipete deleted the steipete/server-performance-slowdown-000aef branch August 27, 2026 03:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: First remote-project startup error disappears after navigation

1 participant