Skip to content

fix(chat): restore active turns after cursor reconnects - #126549

Closed
NianJiuZst wants to merge 1 commit into
openclaw:mainfrom
NianJiuZst:codex/fix-ui-cursor-inflight
Closed

NianJiuZst wants to merge 1 commit into
openclaw:mainfrom
NianJiuZst:codex/fix-ui-cursor-inflight

Conversation

@NianJiuZst

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where the Control UI could lose the visible active assistant/tool state after reconnecting with a valid chat-history cursor. A full history response carried the bounded in-flight snapshot, but a successful cursor delta omitted it and the UI returned before running active-turn recovery.

Why This Change Was Made

The Gateway already computes and bounds inFlightRun before choosing full versus delta output. This change adds that optional field to the closed delta protocol, sends the same snapshot on delta catch-up, and makes full and delta responses share one in-flight reconciliation owner in the UI.

The existing startup cursor optimization remains intact: the client still requests a delta rather than forcing a full tail fetch.

User Impact

After reconnect, an active response can immediately restore its text, tool activity, and Stop control even when the Gateway only needs to return a cursor delta. Operators avoid both a blank active turn and an unnecessary 100-message tail reload.

Evidence

  • Final base: 4b55192f818c0bfd00cd2bb2d9447fd38dca7e39; commit: f96bfcced92e5ec857a13fb537921f1d60e6337a.
  • Red UI regression: before the fix, cursor catch-up returned but the expected active stream was null.
  • Green on the final head: UI cursor tests 5/5; Gateway cursor tests 16/16; protocol schema tests 5/5.
  • Chromium mocked-Gateway flow on the final head: 1 passed, 3 skipped. It first seeds a cursor, verifies reconnect sends that cursor, serves only a delta with inFlightRun, then observes restored assistant text, tool activity, and Stop.
  • Production LOC: +106/-67 (net +39); tests: +94/-4; docs: +1/-1. The UI diff moves the existing 67-line full-response reconciliation into one shared owner, then calls it from both response paths; the remaining growth is the additive protocol/data flow and delta coverage.
  • git diff --check passed. No compatibility fallback or forced full fetch was added. The browser proof uses a mocked Gateway; no live provider/channel run was performed.

AI-assisted: yes

@clawsweeper

clawsweeper Bot commented Aug 20, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M labels Aug 20, 2026
@NianJiuZst
NianJiuZst marked this pull request as ready for review August 20, 2026 05:28
@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 28, 2026, 8:19 PM ET / September 29, 2026, 00:19 UTC.

ClawSweeper review

What this changes

The branch adds active-run snapshots to Gateway cursor responses and reconciles them in the Control UI so an active reply remains visible after reconnecting.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open. PR close coverage proof kept this PR open against #129640: model PR close coverage proof was incomplete: The source report identifies the same Gateway omission and UI recovery path in merged PR B and current main. PR A has no distinct remaining behavior requiring separate review.

Priority: P2
Reviewed head: f96bfcced92e5ec857a13fb537921f1d60e6337a

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch targets the right boundary, but its branch-specific behavior proof uses a mocked Gateway and its work is superseded.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The submitted branch reports a Chromium Control UI reconnect flow against a mocked Gateway, but no after-fix run through a real Gateway; the inspected screenshot is evidence for the merged replacement PR. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The submitted branch reports a Chromium Control UI reconnect flow against a mocked Gateway, but no after-fix run through a real Gateway; the inspected screenshot is evidence for the merged replacement PR. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items PR close coverage proof: PR close coverage proof kept this PR open against #129640: model PR close coverage proof was incomplete: The source report identifies the same Gateway omission and UI recovery path in merged PR B and current main. PR A has no distinct remaining behavior requiring separate review.
Pinned PR change: The introduced Gateway hunk adds the bounded active-run snapshot to a delta response; the UI hunk invokes reconciliation on that response.
Merged canonical repair: GitHub records #129640 as merged. Its body explicitly describes cursor responses omitting inFlightRun and formally closes the equivalent report at #129639.
Findings None None.
Security None None.

How this fits together

The Gateway turns chat history and active-run state into full or cursor-delta responses. The Control UI consumes those responses to restore visible assistant text, tool activity, and the Stop control.

flowchart LR
  A[Active chat run] --> B[Gateway history request]
  C[Saved history cursor] --> B
  B --> D{Full page or delta?}
  D --> E[Bounded active-run snapshot]
  E --> F[Control UI reconciliation]
  F --> G[Visible reply and controls]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The submitted branch reports a Chromium Control UI reconnect flow against a mocked Gateway, but no after-fix run through a real Gateway; the inspected screenshot is evidence for the merged replacement PR. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete close-coverage proof - Complete the pull request close-coverage proof before merge.
Agent review details

Security

None.

PR surface

Source +39, Tests +90, Docs 0. Total +129 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 106 67 +39
Tests 4 94 4 +90
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 201 72 +129

Review metrics

Metric Value Why it matters
Production versus tests production +39 net, tests +90 net The production growth carries the additive delta contract and shared reconciliation, which the merged repair now supplies.

Root-cause cluster

Relationship: superseded
Canonical: #129640
Summary: The merged PR owns the same cursor-snapshot omission and UI replay boundary.

Members:

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

Technical review

Best possible solution:

Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure.

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

No current-main failure is reproducible from the reported path: the Gateway now sends the snapshot on cursor deltas, and current browser coverage checks visible recovery. Tests were inspected, not executed in this read-only review.

Is this the best way to solve the issue?

No. The merged repair supplies the same recovery through shared UI hydration and also budgets the snapshot against delta contents.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 27de2f87db28; fix evidence: release v2026.9.6, commit 2dbaeef693ae.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The original cursor-reconnect failure affected visible chat progress, but the equivalent repair has shipped.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The submitted branch reports a Chromium Control UI reconnect flow against a mocked Gateway, but no after-fix run through a real Gateway; the inspected screenshot is evidence for the merged replacement PR. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • jalehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. clawsweeper-recovery-stuck and removed clawsweeper-recovery-stuck labels Aug 20, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 28, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Sep 22, 2026
steipete added a commit to openclaw/clawsweeper that referenced this pull request Sep 30, 2026
…ft (#1715)

* fix(apply): stop own acknowledgement edits from requeueing source drift

Exact PR review marks ClawSweeper's acknowledgement comment
(clawsweeper-pr-ack) complete after the review snapshot and before direct
publication. GitHub moves the PR updated_at for that edit, so close
proposals failed apply freshness with skipped_changed_since_review
("updated_at changed", sourceDriftVerified) and requeued another
source_drift_requeue review, which repeated the same edit forever
(openclaw/openclaw#126549 reached revision 25 on one head; #158447 revision
160 escaped only through a stale item read).

Apply freshness now accepts that edit as automation-only when a
ClawSweeper-authored acknowledgement for this item carries the item's
latest updated_at and the review's complete source, timeline, PR head, and
review-activity receipt still matches. Human comments, title/body and
non-managed label edits, PR reviews, new heads, other bots' comment edits,
and tuple-less legacy reviews still block apply and requeue as before.

* test(e2e): add real-transport source-drift final-effect proof

Drive the compiled non-dry-run apply-decisions CLI (exact-event publication
arguments) and ClawSweeper's own update-review-status acknowledgement edits
through native gh over http_unix_socket to a stateful synthetic GitHub API
seeded from a captured PR and rewound to its exact-review snapshot. The API
models updated_at and timeline effects of comment, label, title, push and
close writes and traces every request, so each scenario records the final
GitHub effects (close request, durable comment sync, label edits, lease
writes) for a baseline and a candidate build without mutating GitHub.
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 13, 2026
vincentkoc added a commit that referenced this pull request Oct 14, 2026
)

Document the optional bounded inFlightRun snapshot returned with cursor delta history. Replay the missed messages, then reconcile the snapshot as for a normal history tail.

Salvages the remaining documentation contribution from #126549; the runtime fix is already covered separately.

Co-authored-by: NianJiuZst <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
@vincentkoc

Copy link
Copy Markdown
Member

Thanks @NianJiuZst. The active-run cursor catch-up behavior is covered by #129640, and your remaining protocol documentation has now landed with co-author credit in #171183. Closing this PR as superseded. If you still see an uncovered cursor catch-up issue on current main, please share a reproduction.

@vincentkoc vincentkoc closed this Oct 14, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…claw#171183)

Document the optional bounded inFlightRun snapshot returned with cursor delta history. Replay the missed messages, then reconcile the snapshot as for a normal history tail.

Salvages the remaining documentation contribution from openclaw#126549; the runtime fix is already covered separately.

Co-authored-by: NianJiuZst <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
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 P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants