Skip to content

fix: clear stuck Responding after external channel replies in Companion - #2392

Merged
daniel-lxs merged 16 commits into
mainfrom
openclaw/companion-external-dm-progress
Nov 28, 2026
Merged

daniel-lxs merged 16 commits into
mainfrom
openclaw/companion-external-dm-progress

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2310. Community report. Paired with Gateway PR #207051.

What Problem This Solves

Windows Companion could stay on Responding after an external reply, omit a quoted reply until reload, or lose a new prompt and its clock when the session roster caught up. Refreshing the latest transcript page could also move the message the reader was looking at. A pending queue can look empty when the Gateway reads it before projecting the terminal run. Separate pages can also reflect different points in time.

User Impact

Companion shows the saved reply once and checks fresh Gateway history before settling activity. A prompt from the new physical session and its running clock survive roster acknowledgment. A latest-page refresh retains older rows and the reader's position. Load earlier messages still works while a legacy Gateway queue confirmation is pending.

Why This Change Was Made

Saved replies and invalidations trigger history reads, not completion by themselves. Recovery checks the physical session, run, original prompt, and queued work. Companion opts in with chat-history-queue-observation and uses the paired Gateway's queue-wide observation when present. On older Gateways, a complete legacy page is a hint. After seeing the terminal run, Companion starts a fresh read to confirm the same run and an empty queue without blocking transcript paging. A newer latest history result supersedes the old confirmation; older pages do not. Partial pages cannot prove emptiness, and Companion does not combine them. A tracked run can still finish and dispatch its queued successor. Ordinary refreshes no longer reinitialize tail navigation.

Evidence

Scenario Observed result
Load earlier while legacy confirmation is held On Windows main, one activation loaded the older row. On earlier PR head baca75ab, the first activation sent no request while confirmation was held; the second worked after release. The corrected app sent one real cursor request and rendered older sequence 001 with the same confirmation still held.
Legacy Gateway: queue sampled before terminal projection The previous Windows build went idle early. The current candidate stayed active when the fresh read found queued work. When the queue was genuinely empty it stayed active until the confirmation response was released, then settled.
Early replacement prompt and quoted history-only reply The prompt survives, the clock keeps advancing through roster acknowledgment, and fresh history settles a matching saved reply.
Foreground reader scrolled away from the tail Answer 104 stayed at Y=263 physical viewport px before the request, while the latest-200 response was held, and after the refreshed text rendered. Jump to latest stayed visible and answer 202 stayed out of view.
Mounted reader and foreground follow mode Mounted answer stayed at 316 DIP; foreground follow landed on genuinely new answer 204.
Mixed completion and durable queued input; retryable history response Actual captured Gateway responses keep Companion active where work remains queued; the empty terminal control settles.

Required proof pools

Validation

Real behavior proof

The foreground main and previous PR comparison and foreground correction used actual Windows Hub executables and an authenticated Gateway built from main. Each paging arm used 203 persisted entries and the real latest-200 reply. The wire observer held only the post-terminal queue confirmation, never the older-page reply. On the corrected build, one enabled Load earlier messages activation sent one cursor request, and the previously absent older row was visible before confirmation release. The candidate also passed both queue controls. Earlier native queue proof isolates the original false-idle bug from this paging correction.

The earlier foreground viewport replay used the actual Hub on an interactive Windows session with synthetic Gateway fixture messages. Native keyboard input on the history rail moved the reader away from the tail. Both images use the same earlier 2f22cf83 build: first the response is held, then the refresh marker is painted on the same answer at the same Y. This verifies a settled reader viewport, not refresh during wheel motion.

Clean comparison

Latest-200 response held After the refreshed answer is painted
Off-tail answer 104 while the latest history response is held Refreshed answer 104 at the same visible position with Jump to latest still present

Annotated comparison

Before release After rendering
Callouts mark answer 104 at 263 px and the Jump to latest control Callouts mark refreshed answer 104 still at 263 px and the Jump to latest control

The native C# production-socket replay passed 3/3 with the actual AWS Gateway capture; the held pair had two false-idle failures and passed the empty control. The replay preserved captured success and retryable error envelopes except for request correlation IDs. The Gateway and cold legacy Chromium run verified old clients did not receive the new field. Archived evidence includes the previous exact-head 17/17 Windows client replay on c4da409b, not the current head.

Worked on by:

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

🦞 Made with OpenClaw

roboclaw-bot and others added 2 commits November 27, 2026 18:57
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: d807c062-fb3c-4e82-86d6-5bf42087639e
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦞👀
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 priority bug or improvement with limited blast radius. impact:session-state This issue is about session, memory, transcript, context, or agent state drift. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codex review: passed.

What this changes

The PR clears completed external replies through fresh Gateway history while preserving queued work, replacement-session prompts, transcript paging, and reader position.

Example: A WeChat reply finishes while Companion displays the conversation.

  • Before: The saved answer appears, but Responding and its elapsed timer continue indefinitely.
  • After: Matching fresh history confirms completion and an empty queue, allowing Companion to clear Responding.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A worthwhile repair with focused boundary coverage, native-app evidence, passing head checks, and no identified blocking defect.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): Supplied native-app and production-socket scenarios report corrected completion, queue, and paging behavior; inspected screenshots support viewport preservation on unchanged rendering code. Hosted run pages were inaccessible here, limiting independent verification of their detailed receipts. The earlier upgrade-receipt suggestion is unnecessary: added transcript provenance is runtime-only and JSON-ignored, and persisted cache/settings formats are unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Completed external replies leave Companion visibly Responding, and recovery refreshes can disturb prompts or transcript navigation.
Reason: The released behavior has a concrete report, and the maintainer-directed repair preserves the existing ownership and completion-safety contracts.

Merge readiness

✅ Ready for maintainer review

This PR addresses a recovery gap still present on main; this review found no blocking defect.

Reviewed head: 1d5bf14efe0279d546fac2da8e4ad6fa37ba91fa

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway transcript events and history responses enter the shared client; existing conversation and history owners reconcile them into the native chat timeline and activity state.

flowchart LR
 A[Gateway transcript events] --> B[Shared Gateway client]
 C[Gateway history responses] --> B
 B --> D[Chat history loader]
 D --> E[Conversation state]
 E --> F[Reactor chat timeline]
Loading

Technical review

Best possible solution:

Settle external turns through identity-matched fresh history and sound queue observations within the existing runtime owners.

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

Main's registered-run requirement explains the reported transcript-only failure, and the PR supplies matching event-sequence regressions and reported baseline failures; this review did not execute a reproduction.

Is this the best way to solve the issue?

Extending the existing history-recovery path is appropriate, and the independent legacy confirmation avoids treating an earlier queue sample as terminal authority.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • History recovery and runtime ownership keeps the original intent (8b09e5f: Recover missing terminal events only through fresh observations fenced to the registered run and physical session.)
  • History request coalescing keeps the original intent (6438564: Retain refresh requests arriving during an existing history load.)
  • Initial timeline navigation changes intended behavior with a stated reason (8ffe470: Coordinate initial-tail positioning and native chat motion across timeline updates.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit f8a8825 adds src/OpenClaw.Tray.WinUI/Chat/ChatHistoryState.cs:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f8a8825ccbb4; files: src/OpenClaw.Tray.WinUI/Chat/ChatHistoryState.cs)
  • Scott Hanselman: Raw commit 6438564 adds src/OpenClaw.Tray.WinUI/Chat/ChatHistoryLoader.cs:68 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 64385643f853; files: src/OpenClaw.Tray.WinUI/Chat/ChatHistoryLoader.cs)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production and test delta Production +596/-141 lines; tests and fixtures +1043/-7 lines The growth covers distinct protocol, reconciliation, paging, session-replacement, and mounted-rendering failures using existing owners.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (6 earlier review cycles)
  • reviewed 2026-11-27T19:19:18.087Z sha 26e547b :: passed. :: none
  • reviewed 2026-11-27T19:50:52.891Z sha 26e547b :: passed. :: none
  • reviewed 2026-11-27T21:29:21.268Z sha 7a98e94 :: needs changes before merge. :: none
  • reviewed 2026-11-27T22:47:22.727Z sha fec7261 :: needs changes before merge. :: none
  • reviewed 2026-11-28T00:46:31.441Z sha c4da409 :: needs changes before merge. :: none
  • reviewed 2026-11-28T03:38:08.558Z sha 2f22cf8 :: passed. :: none

Reviewed November 28, 2026, 3:58 AM ET / 08:58 UTC (Revision 7).

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 27, 2026 19:47
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

roboclaw-bot and others added 2 commits November 27, 2026 21:04
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: e1d30844-fa9b-4251-ac14-e3cc2df6554c
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 27, 2026
roboclaw-bot and others added 2 commits November 27, 2026 22:19
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 807d90b0-7273-49f0-ae45-c30ebc41b261
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

roboclaw-bot and others added 2 commits November 27, 2026 23:20
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 0c09821c-6b04-481b-a365-6bc6d1fca14d
roboclaw-bot and others added 2 commits November 28, 2026 00:07
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 265e2000-2a0f-4e8a-9b3e-32090e86a168
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

roboclaw-bot and others added 2 commits November 28, 2026 01:27
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 6610cc4f-6060-4bc9-b373-798fa27b18e1
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 28, 2026
roboclaw-bot and others added 4 commits November 28, 2026 05:20
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: b29bf36f-57f5-4c32-a0e2-c29787997aaf
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: c6a7dea0-7a5a-448c-8070-9bf67b8aeb95
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Nov 28, 2026
@daniel-lxs daniel-lxs added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Nov 28, 2026
@daniel-lxs
daniel-lxs merged commit 1cd641d into main Nov 28, 2026
35 checks passed
@daniel-lxs
daniel-lxs deleted the openclaw/companion-external-dm-progress branch November 28, 2026 11:21
@daniel-lxs daniel-lxs removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:session-state This issue is about session, memory, transcript, context, or agent state drift. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native chat window: permanent "Answering · Ns" card after every channel reply (v2026.11.3)

2 participants