Skip to content

fix(webchat): keep waiting replies visible after yielding - #162272

Open
roboclaw-bot wants to merge 2 commits into
mainfrom
openclaw/webchat-yield-acknowledgment-delivery
Open

roboclaw-bot wants to merge 2 commits into
mainfrom
openclaw/webchat-yield-acknowledgment-delivery

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Related: #87321

What Problem This Solves

Fixes: a waiting acknowledgment can be missing from WebChat, or disappear after refresh, when an otherwise-silent agent yields for ongoing work.

User Impact

User impact: explicit acknowledgments and the default waiting reply appear once and remain in history for direct and queued WebChat turns. A storage failure is reported instead of silently treating the acknowledgment as delivered. No configuration, schema, or migration change is required.

Why This Change Was Made

WebChat now persists the public continuation payload through the existing assistant-transcript owner before publishing it or settling continuation delivery. The transcript transaction consumes the original live authority check after awaited preparation. Canonical acknowledgment messages stay separate from neighboring notices, so live events and history reconcile to one row. Native model completion remains distinct from a later host-delivery failure.

This does not read private yield context, promote tool-result text, or change quiet-turn/visible-reply suppression and child-wake policy. #87471 is an older replay attempt; historical tool-result migration is not part of this repair.

Contributor credit: @jalehman identified the affected workflow and drove this repair.

Work sessions

Evidence

  • Real Gateway boundary: all 19 WebSocket/history cases pass for direct and queued turns, explicit/default acknowledgments, media, duplicate delivery, mixed notices, and reload. The actual Gateway-client projection reconciles live/history events in either order without duplicating the acknowledgment or exposing private context.
  • Authority and settlement: deferred abort/replacement and reentrant revocation cannot commit or publish a transcript row. Native and queued storage failures, plus post-dispatch source preparation failure, produce an error and failed replay instead of premature success. Queued execution is preserved. Two real UI-handler cases verify separate late-error presentation and newer-run isolation without relabeling completed model execution.
  • Verification: 180 focused tests and 25 requester-wake E2E tests pass on the exact candidate. Ordinary writers, aliases/storage environments, cold restoration, Goal turns, media and cancellation siblings also passed during the repair. Fresh AutoReview is scoped-clean through P2. Independent full-source re-review of commit 3d038b6405e211fea4e83f3e5615c66bf0ea8f44 also found no actionable P0–P2 issues and verified all three earlier findings resolved.
  • Full changed-file plan: all 32 maintained check-plan commands pass, including production types and all 27 core test-type graphs, formatting, lint, i18n, boundaries, schema and safety guards. The supported full-stripe typecheck runner used concurrency 4; Vitest stayed serial. Blacksmith Testbox environment, Node 24.19; this is prepublication proof, not PR CI.
Measured test cost

Serial runs use node scripts/run-vitest.mjs <file> --maxWorkers=1:

  • server.chat-queued-followup.test.ts: 19 cases, 57.34 s wall including compilation; the 13 added cases take 12.76 s combined. One suite-level Gateway is reused.
  • transcript-write-context.test.ts: 26 cases, 23.55 s wall including compilation; the seven added cases take 1.20 s combined.
  • chat-gateway.late-delivery-error.test.ts: two cases take 18 ms combined; its isolated UI shard takes 2.26 s.
  • PR CI timing is not yet available. Added tests use controlled promises and observable completion, not sleeps or polling.

Before and after

Before — the public waiting acknowledgment is absent from replay.

Before: waiting acknowledgment absent

After — one public waiting acknowledgment remains visible.

After: one durable waiting acknowledgment

Boundary proof uses controlled upstream execution; Gateway dispatch, WebSocket delivery, SQLite persistence, history RPCs, and client projection are real. The inspected screenshots use the actual unchanged Control UI with a sanitized synthetic history replay of those proven Gateway outcomes. They show rendering/reload behavior, not a fresh live-provider conversation.

Scope and line-count accounting

Production: +247/−66 (net +181); tests: +612/−1 (net +611). Growth supplies missing durable host-reply publication and settlement, consumes the existing live-owner assertion at the transaction boundary, and preserves canonical message identity across mixed notices. It reuses existing transcript storage and removes the competing media-write path; there is no new store, schema, protocol, dependency, or configuration surface.

roboclaw-bot and others added 2 commits September 30, 2026 23:42
Persist public continuation replies through the shared source finalizer, retain live admission and transcript guards, and leave one owner for media-bearing acknowledgments. Cover direct and queued WebSocket publication, history reloads, privacy, and duplicate delivery.

Co-authored-by: jalehman <[email protected]>
Enforce live ownership at the expected transcript commit, keep waiting acknowledgments separate from neighboring notices, and join continuation settlement to host persistence and publication. Preserve model and queued execution outcomes while reporting host delivery failures.

Co-authored-by: jalehman <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 1, 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 app: web-ui App: web-ui gateway Gateway runtime size: L labels Oct 1, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 1, 2026 01:53
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 10:00 PM ET / October 1, 2026, 02:00 UTC.

ClawSweeper review

What this changes

The branch saves public WebChat waiting replies as assistant transcript messages before live delivery and reports late storage failures.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still lacks durable persistence for new public waiting replies. The older draft replay PR addresses historical records and does not replace this repair.

Priority: P2
Reviewed head: 3d038b6405e211fea4e83f3e5615c66bf0ea8f44

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused existing-owner repair has substantial boundary coverage and inspected visual evidence, with no actionable defect found.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The changed Gateway finalizer and transcript writer are covered by a real WebSocket chat.send/chat.history harness using SQLite for direct and queued yields, storage failures, and guarded writes; inspected UI images show the resulting replay state. The linked Testbox run does not independently confirm every claimed check, but its logs were unavailable to this reviewer. Existing transcript format is reused without a stored-data contract change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The changed Gateway finalizer and transcript writer are covered by a real WebSocket chat.send/chat.history harness using SQLite for direct and queued yields, storage failures, and guarded writes; inspected UI images show the resulting replay state. The linked Testbox run does not independently confirm every claimed check, but its logs were unavailable to this reviewer. Existing transcript format is reused without a stored-data contract change.
Evidence reviewed 10 items Current main behavior: The current-main source finalizer constructs and broadcasts a reply but has no waiting-reply transcript append in this path.
Introduced persistence path: The PR appends only the prepared public continuation content through the existing assistant-transcript owner, with session identity, lifecycle expectation, and an idempotency key.
Commit authority: The captured live-owner assertion is checked inside the SQLite write transaction and again after synchronous preparation, before the transaction returns.
Findings None None.
Security None None.

How this fits together

WebChat sends turns to the Gateway, which dispatches agent replies and stores conversation history. The Gateway sends live chat events and serves saved messages to the UI after refresh.

flowchart LR
A[WebChat turn] --> B[Gateway reply dispatch]
B --> C{Waiting reply?}
C -->|Yes| D[Guarded transcript write]
D --> E[Live chat event]
D --> F[Saved chat history]
E --> G[WebChat display]
F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +181, Tests +611. Total +792 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 247 66 +181
Tests 3 612 1 +611
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 859 67 +792

Review metrics

Metric Value Why it matters
Production and test growth production net +181 LOC; tests net +611 LOC The PR body attributes production growth to durable publication and settlement, with boundary coverage for the new path.
Added Gateway case cost 13 cases; 12.76 s combined The measured added cases reuse one Gateway fixture, limiting recurring test startup cost.

Technical review

Best possible solution:

Keep public acknowledgments in the existing guarded transcript path and leave privacy-sensitive historical replay to its separate review.

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

Yes. A yielding, otherwise silent WebChat turn can send a waiting reply live and then reload history; current main's finalizer does not append that reply. This review did not execute a current-main run.

Is this the best way to solve the issue?

Yes. The branch uses the existing assistant-transcript owner and checks live authority before commit, without projecting private yield context or adding a parallel store.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The fix addresses lost waiting text in a bounded WebChat workflow, with no demonstrated core outage.
  • 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. Sufficient (screenshot): The changed Gateway finalizer and transcript writer are covered by a real WebSocket chat.send/chat.history harness using SQLite for direct and queued yields, storage failures, and guarded writes; inspected UI images show the resulting replay state. The linked Testbox run does not independently confirm every claimed check, but its logs were unavailable to this reviewer. Existing transcript format is reused without a stored-data contract change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Gateway finalizer and transcript writer are covered by a real WebSocket chat.send/chat.history harness using SQLite for direct and queued yields, storage failures, and guarded writes; inspected UI images show the resulting replay state. The linked Testbox run does not independently confirm every claimed check, but its logs were unavailable to this reviewer. Existing transcript format is reused without a stored-data contract change.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed Gateway finalizer and transcript writer are covered by a real WebSocket chat.send/chat.history harness using SQLite for direct and queued yields, storage failures, and guarded writes; inspected UI images show the resulting replay state. The linked Testbox run does not independently confirm every claimed check, but its logs were unavailable to this reviewer. Existing transcript format is reused without a stored-data contract change.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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.

This branch has not been deployed

No deployments
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 P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

1 participant