Skip to content

fix(ui): list sessions after a cold start restores a chat route - #173344

Closed
wr-web wants to merge 1 commit into
openclaw:mainfrom
wr-web:fix/restored-chat-session-list
Closed

wr-web wants to merge 1 commit into
openclaw:mainfrom
wr-web:fix/restored-chat-session-list

Conversation

@wr-web

@wr-web wr-web commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Closes #173095

What Problem This Solves

Fixes: on a cold start that restores the last chat route, the Control UI never requested sessions.list. The sidebar then showed only the open chat until some other action, such as creating a chat, refreshed the list.

Since #146591, the connection bootstrap coordinator holds background work, including the sidebar's session list, until the foreground chat pane reports a ready transcript. The pane is accepted only when its key equals the foreground route key. Both keys come from resolveChatSnapshotKey, which prefixes the session key with the connection's account scope.

On a cold start, the restored route resolves while the Gateway is still connecting, so subscribeForegroundChatBootstrap registers it under the provisional scope:unowned:<n> prefix. The chat pane mounts after connect and registers under the connected scope:["ws://…","<account>"] prefix. Nothing re-keyed the route after connect, so the two keys never matched. The pane was rejected, and background bootstrap stayed held for the life of the connection.

User Impact

User impact: reloading or reopening the Control UI on a chat now lists every accessible chat in the sidebar once the restored transcript is ready. The selected transcript still loads first: the background queue is held until the pane is ready, exactly as before.

Why This Change Was Made

ui/src/app/bootstrap-location.ts: subscribeForegroundChatBootstrap already subscribes to Gateway snapshots to synchronize the coordinator's client. It now also recomputes the foreground route key on each snapshot. A route restored before connect is therefore re-keyed with the connected account scope, which is the key the mounted pane uses.

The route rules are unchanged:

  • non-session routes and pending creations still clear it;
  • pending routes still hold it;
  • catalog keys still bypass it.

The subscription moved below synchronize so the first snapshot can re-key the route.

Evidence

Real Control UI, Windows 11, headless Edge.

  • Build: the Gateway and Control UI were built from this checkout (main c47f803 vs this branch), with a fresh state dir and a local mock model.
  • Setup: three chats were created through the UI.
  • Cold start: a fresh page in the same browser profile opens /, and the client restores the last chat route itself.
  • Measured: the client's WebSocket RPCs and the sidebar's chat links, 20 s after load.

restored chat sidebar

Build sessions.list sent in 20 s Sidebar chats before reload → after cold start
main c47f803 0 (38 other methods were sent, including chat.startup and board.get, as in the report) 2 → 1
this branch 3 2 → 2 (the same chats)

Root-cause trace on main, from temporary logging in connection-bootstrap.ts (not committed):

Call Key
setForegroundRoute scope:unowned:1\u0000agent:main:dashboard:<id>
setForegroundPane (ready: true) scope:["ws://127.0.0.1:28795","<account>"]\u0000agent:main:dashboard:<id>

The pane was rejected, so foregroundPending stayed true and the background sessions.list task never started.

Regression test in ui/src/app/bootstrap-location.test.ts. It uses the real coordinator: the route resolves before connect, the Gateway then connects, the foreground key must equal the pane's connected key, and a queued background sessions.list task must run once the pane is ready.

Test main This branch
re-keys a route restored before connect so the mounted pane releases background work fails passes

Gates:

  • bootstrap-location.test.ts, connection-bootstrap.test.ts and bootstrap.test.ts pass.
  • oxfmt, oxlint, pnpm tsgo:ui and pnpm tsgo:test:ui pass.
  • pnpm check:changed could not run locally. Its Crabbox route downloads from github.com, which this network resolves to a private address, so CI covers it.

A route restored before connect was registered with the provisional unowned scope while the mounted chat pane registers with the connected account scope, so the connection bootstrap coordinator never accepted the pane and held background work such as the sidebar sessions.list for the whole connection. Re-key the foreground route on Gateway snapshots.
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Recompute the restored chat route’s scoped identity on Gateway snapshots so transcript readiness releases sidebar session discovery.

Example: Reopen the Control UI with two existing sidebar chats and restore the last chat.

  • Before: The sidebar shows only the selected chat, and sessions.list is never requested.
  • After: The sidebar retains both chats after the restored transcript becomes ready.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused root-cause repair with relevant shipped-browser proof, a coordinator regression, and no actionable correctness or security findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected the supplied before/after Control UI capture and accompanying WebSocket measurements: Windows 11 Edge reopened the saved route through the built Gateway/UI, and this branch restored both sidebar chats with session-list requests after transcript readiness.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Reopening a saved chat can hide other existing conversations from the sidebar indefinitely.
Reason: The narrow change restores documented discovery behavior while retaining the owner’s existing startup ordering and route rules.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a source-confirmed startup defect still present on current main, with relevant browser proof and no actionable findings.

Priority: P2
Reviewed head: d2de821eb4cfa0e676806a54d47c390ca70215e3

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI binds router and Gateway facts to a connection bootstrap coordinator, which admits background session-list requests after the selected transcript is ready.

flowchart TD
  A[Restored chat route] --> C[Foreground route identity]
  B[Gateway snapshots] --> C
  C --> E[Connection bootstrap coordinator]
  D[Ready chat pane] --> E
  E --> F[Session list request]
  F --> G[Sidebar chats]
Loading

Technical review

Best possible solution:

Land the focused route re-keying repair while preserving the existing transcript-first coordinator.

Do we have a high-confidence way to reproduce the issue?

Source confirms that a provisional route key can remain mismatched with the connected pane key; the supplied browser comparison exercises that failure and recovery, but no target code was executed during this review.

Is this the best way to solve the issue?

Reusing the existing route synchronizer at the Gateway snapshot boundary fixes the stale identity at its producer without bypassing transcript priority or introducing another scheduler.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a166c4931a40.

Provenance checked

  • Foreground bootstrap scheduling keeps the original intent (b023df8: Prioritize the selected transcript before automatic sidebar and catalog reads, then release background work on a visible transcript outcome.)
  • Account-scoped transcript identity keeps the original intent (9764de1: Keep cached presentation scoped to its Gateway and account during offline use and connection recovery.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b023df8 adds ui/src/app/bootstrap-location.ts:324 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b023df80868e; files: ui/src/app/bootstrap-location.ts)

PR surface

Source +3, Tests +83. Total +86 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 10 7 +3
Tests 1 84 1 +83
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 94 8 +86

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Cold-start discovery hides existing conversations, but an available UI action can restore the list.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 15, 2026, 1:56 PM ET / 17:56 UTC.

@wr-web

wr-web commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded. Main landed the same repair in afecea8 (#179919): subscribeForegroundChatBootstrap now calls synchronize() from the Gateway snapshot subscription so a literal route restored before hello is re-keyed with the connected storage scope. It also adds the matching regression test ("hydrates the roster when a literal route commits before its Gateway connects"). That is the same change and invariant as this PR, so there is nothing left to land here.

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 P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

Control UI: session sidebar stays empty on cold start that restores the last chat route (sessions.list never requested)

1 participant