fix(webchat): preserve refresh-visible history and composer state#83992
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 31, 2026, 4:20 AM ET / 08:20 UTC. Summary PR surface: Source +459, Tests +380. Total +839 across 11 files. Reproducibility: yes. at source level: current main stores chatMessage and chatQueue in component memory and reads a narrow raw transcript tail before visible projection, matching the reported refresh loss mode. I did not run a live browser before/after repro in this read-only review. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused history/composer fix only after maintainers explicitly accept or narrow the browser-storage and restored-queue replay boundaries, then keep the linked issues open or updated for remaining preview/title metadata work. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main stores chatMessage and chatQueue in component memory and reads a narrow raw transcript tail before visible projection, matching the reported refresh loss mode. I did not run a live browser before/after repro in this read-only review. Is this the best way to solve the issue? Unclear as a product decision: the code path is a plausible focused fix, but the durable answer depends on whether maintainers accept sessionStorage retention and auto-drain semantics for restored queues. If not, the safer direction is to narrow persisted payloads or require explicit replay after refresh. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against b81adc6202b2. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +459, Tests +380. Total +839 across 11 files. View PR surface stats
Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
6bb9097 to
77025f3
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
7e1f0c1 to
b4c9804
Compare
b4c9804 to
4e475b9
Compare
4e475b9 to
93b8d7a
Compare
93b8d7a to
bc0bcb6
Compare
bc0bcb6 to
5fc2e6c
Compare
…enclaw#83992) WebChat now stores/restores composer draft and queued sends across refresh, scoped by gateway/session/agent. It skips in-flight/steered sends, restores after agent scope hydration, waits for fresh idle session proof before draining restored sends, and backfills visible chat history when the raw tail contains silent/context entries. Refs openclaw#83344 Co-authored-by: Zee Zheng <zheng.zuo0@gmail.com>
…enclaw#83992) WebChat now stores/restores composer draft and queued sends across refresh, scoped by gateway/session/agent. It skips in-flight/steered sends, restores after agent scope hydration, waits for fresh idle session proof before draining restored sends, and backfills visible chat history when the raw tail contains silent/context entries. Refs openclaw#83344 Co-authored-by: Zee Zheng <zheng.zuo0@gmail.com>
…enclaw#83992) WebChat now stores/restores composer draft and queued sends across refresh, scoped by gateway/session/agent. It skips in-flight/steered sends, restores after agent scope hydration, waits for fresh idle session proof before draining restored sends, and backfills visible chat history when the raw tail contains silent/context entries. Refs openclaw#83344 Co-authored-by: Zee Zheng <zheng.zuo0@gmail.com>
Summary
Refs #83344.
This intentionally does not auto-close #83344 because session preview/title metadata remains out of scope for this PR.
Addresses two refresh-time WebChat state gaps from #83344:
chat.historybefore visible-message projection/pagination, so recent visible conversation can be backfilled even when the latest raw transcript tail is mostly silent/internal trafficsessionStorage, then restores them after refresh/session switchingNotes
sessionStorageinstead oflocalStorageas the safer privacy default: drafts/queued prompts survive refresh in the same tab, but do not persist indefinitely across browser restarts.Real behavior proof
Behavior or issue addressed: WebChat refresh keeps visible chat history available after a tool-heavy/raw-tail transcript, and preserves same-tab composer draft plus queued messages for the same gateway/session.
Real environment tested: Local OpenClaw Control UI from this PR served by Vite at
http://127.0.0.1:5173, connected in Google Chrome to a local loopback WebSocket gateway atws://127.0.0.1:18789.Exact steps or command run after this patch:
npm --prefix ui run dev -- --host 127.0.0.1 --port 5173 --force.connect,sessions.list,chat.history, andchat.send, and keeps the firstchat.sendrun active.http://127.0.0.1:5173/chat?session=main.visible history before tool-heavy tailandvisible assistant reply restored after refresh.start long run proof, then queuedqueued proof after refreshwhile that run stayed active.draft proof after refresh.Evidence after fix: Copied live output from the browser accessibility tree after reload included:
Observed result after fix: The refreshed WebChat kept the same visible history messages, restored the queued message under
Queued (1), and restored the unsent draft in the composer for sessionmain. The queued message stayed in the queue rather than being delivered early on reconnect.What was not tested: The gateway Vitest target did not run locally because root
node_modulesdoes not containvitest/package.jsonafter the full pnpm workspace install stalled; session preview/title metadata remains intentionally out of scope for this PR.Tests
chat.historybackfilling visible messages when the raw tail is mostlyNO_REPLY.npm --prefix ui test -- src/ui/chat/composer-persistence.test.ts src/ui/app-lifecycle.node.test.ts:git diff --check.ui/src/ui/chat/composer-persistence.ts.OPENCLAW_GATEWAY_PROJECT_SHARDS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway.config.ts src/gateway/server.chat.gateway-server-chat-b.test.ts; it failed before running tests because rootnode_modulesis missingvitest/package.jsonin this local environment.Full targeted Vitest was not run locally because dependency installation for the full 128-workspace pnpm repo stalled in this environment.