fix(ui): preserve queued chat messages across session switches#73679
Conversation
Greptile SummaryThis PR fixes a bug where queued chat messages were silently dropped when switching sessions by introducing Confidence Score: 5/5Safe to merge — the fix is well-scoped, correctly handles all switching scenarios, and is backed by new tests. No P0 or P1 issues found. The save/restore logic is correct across all switching permutations (switch away, switch back, multiple round-trips, empty queue cleanup). Lit reactivity is properly handled via new object references. The unification of the overview switch path with switchChatSession is a deliberate, documented improvement. No files require special attention. Reviews (1): Last reviewed commit: "fix(ui): preserve queued chat messages a..." | Re-trigger Greptile |
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep this PR open. Current main still clears the Control UI chat queue on session switches, has no per-session queue store, and the supplied PR remains a focused implementation candidate for open bug #73621 rather than obsolete cleanup. Best possible solution: Review and either land or request changes on this PR as the focused client-side fix for #73621. The narrow boundary should be Control UI state: save the active queue before switching sessions, restore it when switching back, route all session-switch surfaces through one helper, and add the proposed regression test without changing gateway or disk persistence. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against b85edb3f0cf6. |
|
@BunsDev |
BunsDev
left a comment
There was a problem hiding this comment.
Reviewed against #73621, the maintainer note in #issuecomment-4337307063, and the related queue persistence context in #51549 / #73154.
This is the focused fix for the session-switch loss path: the active queue is saved under the previous session before session reset, restored when switching back, the overview session selector now goes through the same switchChatSession helper, and the regression test covers switch-away / switch-back with a queued follow-up.
I do not consider this superseded by #73154: that PR is the broader refresh/reconnect/localStorage queue persistence candidate for #51549, while this PR intentionally keeps #73621 to in-UI session navigation without adding disk/gateway persistence.
Local proof on commit 86f0557:
- OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test ui/src/ui/app-render.helpers.node.test.ts
- pnpm tsgo:test:ui
- pnpm exec oxfmt --check --threads=1 ui/src/ui/app-render.helpers.node.test.ts ui/src/ui/app-render.helpers.ts ui/src/ui/app-render.ts ui/src/ui/app-view-state.ts ui/src/ui/app.ts
CI is still red, but the failed jobs I sampled are unrelated plugin/bundled/boundary/build-artifact failures; the PR touches only Control UI queue/session state files and the core UI CI job is green. Do not merge until branch protection/check policy is satisfied or maintainers explicitly accept the unrelated red CI.
…law#73679) Fixes openclaw#73621. Preserve queued Control UI chat messages across in-UI session switches by saving the active queue per session before reset and restoring it when switching back. Route the overview session selector through the shared switchChatSession helper so it follows the same queue lifecycle. Validation: - OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test ui/src/ui/app-render.helpers.node.test.ts - pnpm tsgo:test:ui - pnpm exec oxfmt --check --threads=1 ui/src/ui/app-render.helpers.node.test.ts ui/src/ui/app-render.helpers.ts ui/src/ui/app-render.ts ui/src/ui/app-view-state.ts ui/src/ui/app.ts
Summary
chatQueueand were cleared when switching sessions.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
resetChatStateForSessionSwitch()unconditionally clearedstate.chatQueue, even when the queue belonged to the session being left.Regression Test Plan (if applicable)
ui/src/ui/app-render.helpers.node.test.tsUser-visible / Behavior Changes
Queued Control UI messages remain associated with their original session when navigating to another session and are visible again when returning.