Skip to content

fix(ui): keep active commentary after session navigation - #129640

Merged
jalehman merged 5 commits into
mainfrom
fix/webchat-inflight-cursor-replay
Aug 26, 2026
Merged

jalehman merged 5 commits into
mainfrom
fix/webchat-inflight-cursor-replay

Conversation

@jalehman

Copy link
Copy Markdown
Contributor

Closes #129639

What Problem This Solves

Fixes an issue where Control UI users switching among sessions could lose visible commentary from a still-active run after the original session pane was evicted and reopened through cursor history.

Why This Change Was Made

Cursor history now carries the same bounded inFlightRun replay state as full history, and both response kinds use one fenced UI replay path. Background prefetch leaves transient active-run replay for the presented pane to consume instead of advancing past it. The existing 50-event / 128 KiB replay snapshot bound is unchanged.

User Impact

Returning to an active session after navigating elsewhere now restores its current commentary and tool activity instead of showing only a generic running state.

Evidence

  • Before: full history for the observed active session contained 49 replay events, including five commentary preambles; cursor history returned zero messages and no inFlightRun.
  • After: an isolated Gateway cursor response included active commentary, and the mocked-Gateway browser flow evicted the pane, returned through its cursor, and rendered the restored commentary.
  • Regression proof: focused protocol, Gateway, UI state, prefetch, and browser E2E coverage exercises the repaired owner boundary.
  • Production LOC: +140/-89 (net +51). Tests: +376/-0. The production growth is the additive protocol/client contract plus the shared replay owner used by full and cursor history.

Restored active commentary after cursor revalidation

pnpm test:changed
# passed: 4 shards, 65 tests

OPENCLAW_UI_E2E_ARTIFACT_DIR=.artifacts/webchat-cursor-replay-pr \
  node scripts/run-vitest.mjs ui/src/e2e/chat-active-cursor-replay.e2e.test.ts
# passed: 1 test

pnpm build
# passed

pnpm lint:swift
# passed: 0 violations

git diff --check
# passed

env -u CODEX_HOME .agents/skills/autoreview/scripts/autoreview \
  --mode uncommitted --stream-engine-output
# clean: 0 actionable findings, 0.98 confidence

AI-assisted: yes. The implementation and evidence were reviewed against the affected Gateway, protocol, generated client, and Control UI paths.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@jalehman
jalehman marked this pull request as ready for review August 25, 2026 22:06
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 7:40 PM ET / 23:40 UTC.

ClawSweeper review

What this changes

Adds bounded active-run replay to cursor-based chat history so an evicted Control UI session restores commentary and tool activity when reopened.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for maintainer review. The inspected PR head repairs the Gateway-to-Control-UI replay gap with no discrete correctness or security finding, but it changes session-state replay and needs the required isolated live UI proof plus exact-head CI before merge.

Priority: P1
Reviewed head: f84fc57393c462a6c8f888fa2f9832bc2c329490
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is coherent and well-covered at the Gateway/UI boundary; live exact-head proof remains the material confidence reducer.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository context marks the author as a member; the PR also supplies a UI screenshot and focused browser-flow evidence, while the remaining live proof is a maintainer merge check.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository context marks the author as a member; the PR also supplies a UI screenshot and focused browser-flow evidence, while the remaining live proof is a maintainer merge check.
Evidence reviewed 6 items Gateway owner boundary: The cursor branch now bounds the authoritative active-run snapshot against the delta payload and returns it with the delta response, matching the full-history response’s bounded snapshot behavior.
UI replay path: Both cursor and full-history responses call the same active-run adoption and replay path, which fences stale projections before rendering commentary or tool activity.
Protocol and native client contract: The additive optional inFlightRun field is accepted by the closed cursor-result schema and represented by the generated Swift cursor model.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs ui/src/e2e/chat-active-cursor-replay.e2e.test.ts

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs ui/src/e2e/chat-active-cursor-replay.e2e.test.ts: previous terminal command was still running after 30 seconds: "node scripts/run-vitest.mjs ui/src/e2e/chat-active-cursor-replay.e2e.test.ts"

[test] starting test/vitest/vitest.ui-e2e.config.ts
[test] preflight test/vitest/vitest.ui-e2e.config.ts
[ui-e2e] Using system Chromium at /usr/bin/chromium-browser.
Downloading FFmpeg (playwright ffmpeg v1011) from https://cdn.playwright.dev/dbazure/download/playwright/builds/ffmpeg/1011/ffmpeg-linux.zip
|                                                                                |   0% of 2.3 MiB
|■■■■■■■■                                                                        |  10% of 2.3 MiB
|■■■■■■■■■■■■■■■■                                                                |  20% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■                                                        |  30% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                                |  40% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                        |  50% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                |  60% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                        |  70% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                |  80% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■        |  90% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 2.3 MiB
FFmpeg (playwright ffmpeg v1011) downloaded to /tmp/clawsweeper-live-proof-129640-r9rwM6/profile/cache/ms-playwright/ffmpeg-1011

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129640-r9rwM6/target

Assertions:

  • FAIL expect_output: restores active commentary when an evicted session revalidates from its cursor

How this fits together

The Gateway serves durable chat history plus active-run state to the Control UI. Cursor refreshes update cached session panes, while the UI replays active commentary and tool events into the visible pane.

flowchart LR
A[Active agent run] --> B[Gateway history handler]
B --> C[Cursor history response]
C --> D[Control UI replay reducer]
D --> E[Session cache and pane]
E --> F[Visible commentary and tools]
Loading

Decision needed

Question Recommendation
Should this maintainer-labelled session-replay repair merge after exact-head CI and isolated live Control UI proof confirm the retained race fencing is necessary? Verify and retain the shared replay path: Run the isolated live Gateway navigation proof and merge if it confirms commentary survives return to the active session without stale replay.

Why: The change affects live session-state presentation across the Gateway protocol and Control UI; the protected maintainer label requires explicit maintainer handling.

Before merge

  • Resolve merge risk (P1) - A stale or wrongly adopted active-run snapshot could mis-associate commentary with a session; mock coverage is strong, but the changed Gateway/UI boundary still needs isolated live Control UI proof before merge.
  • Resolve merge risk (P1) - The current PR retains a net +51 production-line increase for replay and race fencing; maintainers should confirm the shared reducer is the smallest safe owner boundary.
  • Complete next step (P2) - The protected maintainer label and session-state replay risk require explicit maintainer review rather than an automated repair lane.
Agent review details

Security

None.

PR surface

Source +47, Tests +381, Other +4. Total +432 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 4 136 89 +47
Tests 6 388 7 +381
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 0 +4
Total 11 528 96 +432

Review metrics

Metric Value Why it matters
Production versus test delta production +140/-89 (net +51); tests +388/-7 (net +381) The positive production growth implements the protocol/UI replay contract and should be retained only where existing reducer logic cannot safely absorb it.

Stored data model

Persistent data-model change detected: persistent cache schema: ui/src/pages/chat/session-prefetch.test.ts, serialized state: ui/src/pages/chat/session-prefetch.test.ts, serialized state: ui/src/pages/chat/session-prefetch.ts, unknown-data-model-change: ui/src/pages/chat/session-prefetch.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #129639
Summary: This PR is the explicit candidate repair for the linked Control UI cursor-replay bug.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Mantis proof suggestion

A redacted web UI chat recording would materially supplement the mocked browser flow for this session-navigation behavior. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis web UI chat proof: reproduce session navigation during an active run and capture that commentary remains visible after returning.

Merge-risk options

Maintainer options:

  1. Capture live session-navigation proof (recommended)
    Use an isolated Gateway and real Control UI session to show that active commentary remains visible after eviction and return on the current head.
  2. Pause for reducer simplification
    Hold the PR if maintainers conclude the added replay fencing duplicates an existing canonical state owner.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Run an isolated Gateway Control UI navigation proof on the exact head, retaining only replay and race-fencing logic required for stale-snapshot safety.

Technical review

Best possible solution:

Keep one bounded Gateway snapshot and one UI replay owner, then verify navigation away and return during a real active run on the exact PR head.

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

Yes, source and focused tests define a high-confidence reproduction: reopen an evicted active session through its cached cursor while the Gateway returns an empty durable delta plus active-run replay. This read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Producing the bounded snapshot at the Gateway owner and applying it through the shared UI replay path is safer than having cache/prefetch infer transient run state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against dfe29eda2daa.

Labels

Label changes:

  • add merge-risk: 🚨 session-state: The PR changes adoption and replay of transient active-run state across a cursor-history boundary.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Repository context marks the author as a member; the PR also supplies a UI screenshot and focused browser-flow evidence, while the remaining live proof is a maintainer merge check.

Label justifications:

  • P1: The defect can silently hide active commentary and tool progress during normal Control UI session navigation.
  • merge-risk: 🚨 session-state: The PR changes adoption and replay of transient active-run state across a cursor-history boundary.
  • 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: Repository context marks the author as a member; the PR also supplies a UI screenshot and focused browser-flow evidence, while the remaining live proof is a maintainer merge check.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Repository context marks the author as a member; the PR also supplies a UI screenshot and focused browser-flow evidence, while the remaining live proof is a maintainer merge check.

Evidence

What I checked:

  • Gateway owner boundary: The cursor branch now bounds the authoritative active-run snapshot against the delta payload and returns it with the delta response, matching the full-history response’s bounded snapshot behavior. (src/gateway/server-methods/chat-history-handler.ts:499, f84fc57393c4)
  • UI replay path: Both cursor and full-history responses call the same active-run adoption and replay path, which fences stale projections before rendering commentary or tool activity. (ui/src/pages/chat/chat-history.ts:415, f84fc57393c4)
  • Protocol and native client contract: The additive optional inFlightRun field is accepted by the closed cursor-result schema and represented by the generated Swift cursor model. (packages/gateway-protocol/src/schema/logs-chat.ts:48, f84fc57393c4)
  • Regression coverage: Focused Gateway, UI cursor-cache, prefetch, protocol, and browser-flow tests cover an empty cursor delta carrying active commentary and tool replay. (ui/src/e2e/chat-active-cursor-replay.e2e.test.ts:15, f84fc57393c4)
  • Feature history: Peter Steinberger’s recent merged cursor/history work includes the cursor revalidation foundation and bounded history unification, making this the closest current-main ownership trail. (ui/src/pages/chat/chat-history.ts:415, 079a874159fb)
  • Current-main comparison gap: The checkout is grafted and its promisor remote could not resolve GitHub, so direct current-main source comparison and release containment could not be completed locally; this does not establish an implementation-on-main close. (dfe29eda2daa)

Likely related people:

  • Peter Steinberger: Recent merged work established cursor-history revalidation and unified bounded chat-history behavior; local history also shows the strongest contribution concentration on the affected UI history path. (role: recent area contributor; confidence: high; commits: 079a874159fb, a99317ef97af, b1b26be853d3; files: ui/src/pages/chat/chat-history.ts, src/gateway/server-methods/chat-history-handler.ts)

Rank-up moves

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

  • Capture a redacted isolated-Gateway Control UI recording that navigates away from and back to a still-active session.

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 (1 earlier review cycle)
  • reviewed 2026-08-25T22:44:33.803Z sha 2b01e7f :: needs maintainer review before merge. :: none

@jalehman
jalehman enabled auto-merge (squash) August 25, 2026 23:54
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Aug 26, 2026
@jalehman
jalehman merged commit 2dbaeef into main Aug 26, 2026
209 checks passed
@jalehman
jalehman deleted the fix/webchat-inflight-cursor-replay branch August 26, 2026 00:27
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…9640)

* fix(ui): restore active commentary after navigation

* test(ui): wait for responsive activity layout
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 gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

[Bug]: Control UI drops active commentary after session navigation

1 participant