Skip to content

feat(control-ui): stream live draft previews in the typing indicator - #126994

Merged
steipete merged 3 commits into
mainfrom
steipete/typing-indicator-bubbles-5f5285
Aug 21, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/typing-indicator-bubbles-5f5285

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

In multi-identity sessions the Control UI typing indicator only shows a three-dot bubble, so viewers know that a teammate is typing but not what is coming. Inspired by Amp's multiplayer threads, this streams the typist's draft text live into the indicator bubble so co-watchers can follow along and react before the message lands.

Why This Change Was Made

The wire path already existed: the composer fires a session.typing request on every keystroke and the gateway throttles a boolean broadcast. This change threads an optional bounded preview through that existing path instead of building a new channel:

  • Protocol (additive): optional preview (maxLength: 400, typebox counts code points — verified against typebox 1.3.6) on SessionTypingParams and SessionTypingEvent.
  • Client send: the composer passes the draft through; sendTypingState sends the last 300 code points, omitted entirely when empty or when typing: false.
  • Gateway throttle: broadcastTypingThrottled generalized to a payload signature + intervalMs — 250ms cadence when a preview is present, unchanged 1s for boolean-only; the trailing edge always emits the latest draft. Preview lives only in the pending-emit closure, never in stored state.
  • Render: per-actor preview rows (avatar + "Name is typing…" + text bubble with a blinking caret, 6-line cap, newest text kept visible via align-content: end); actors without preview keep the aggregated three-dot bubble — which stays the permanent form for any future boolean-only sources, since chat platforms expose no draft text.

Privacy invariants: previews ride the existing ≥2-live-viewers, sharing-role, and incognito gates; they are never persisted, never enter the session transcript or the model's context, and are excluded from screen-reader live regions (only "X is typing…" is announced). No new config surface; the indicator keeps its 2.5s idle fade.

User Impact

Watching a shared session now feels live: a teammate's draft streams word-by-word into their bubble, Amp-style. Single-user gateways are unchanged (the indicator only exists with multiple live identities). Docs updated in docs/concepts/multi-user.md.

Production LOC: +~75 (new capability: preview plumbing + per-actor render path); tests +~190.

Evidence

  • Unit/behavior: 33 gateway + protocol tests (session-typing-state.test.ts new: changed-preview re-emit, 250/1000ms cadence, trailing-edge latest-wins; handler: bounded previews, no preview after typing: false; schema: optional/bounded), 285 chat UI tests.
  • E2E (mock gateway, real browser): ui/src/e2e/session-suggestions.e2e.test.ts — new streaming test drives session.typing events with growing previews and asserts each chunk renders, preview + dots coexist, and the sr-only status never contains draft text; the existing send-path assertion now proves the composer request carries the preview. 5/5 passing.
  • check-changed clean; Codex autoreview clean ("patch is correct (0.99)", no findings).

Before (dots only):

before

After (live draft + caret):

after

Mixed fidelities (preview + boolean-only dots):

mixed

Live streaming capture:

typing-preview-stream.mp4

Multi-identity sessions now show what a teammate is typing, not just that
they are typing: the composer's per-keystroke session.typing sends carry a
bounded tail of the draft (optional preview field, 400 code points max),
the gateway throttle re-emits on changed payloads at 250ms (boolean-only
stays at 1s, trailing edge keeps the latest draft), and the transcript
renders a per-actor bubble with the live text plus a blinking caret.
Actors without preview data keep the three-dot bubble.

Previews are ephemeral presence: never persisted, never part of the
session transcript or model context, excluded from aria-live regions, and
gated by the existing >=2-live-viewers, sharing-role, and incognito
checks. No new config surface.
@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 21, 2026 04:16
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 21, 2026, 1:13 AM ET / 05:13 UTC.

ClawSweeper review

What this changes

Adds optional live draft previews to Control UI shared-session typing events while retaining the three-dot indicator for typists without preview text.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep open: the per-connection state repair still fails to broadcast removal of a stopped tab’s preview, leaving stale unsent text visible while another tab for the same actor remains typing.

Priority: P2
Reviewed head: 929ec41ae64e399be8ad87ab631f92f5e1579c20
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The feature has substantial focused coverage and visible evidence, but a P2 stale-preview path and an unresolved privacy-default decision prevent merge readiness.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a member-owned, maintainer-labeled PR, so the external-contributor proof gate does not apply; the PR body nevertheless includes browser evidence for the visible feature.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a member-owned, maintainer-labeled PR, so the external-contributor proof gate does not apply; the PR body nevertheless includes browser evidence for the visible feature.
Evidence reviewed 6 items Preview-removal broadcast is skipped: After connection aggregation removes a preview tab and returns effective typing without preview, this early return skips the throttle and event emission; remote viewers retain the prior preview until their local expiry timer.
Connection owner reports the needed state transition: The state owner correctly returns { typing: true } after the preview connection stops while another connection remains live, but its result is not propagated by the handler.
Regression coverage stops below the Gateway boundary: The added state test proves preview removal in memory, while the handler test proves only that a second boolean-only connection preserves an active preview; neither asserts the stop transition emits a no-preview typing event.
Findings 1 actionable finding [P2] Emit the preview-clearing update when one tab stops
Security Needs attention Confirm unsent-draft recipient policy: The event now includes unsent preview text for all eligible shared-session viewers; this is a material expansion beyond the prior presence-only signal and should be explicitly approved as the intended privacy boundary.

Live Verification

Command: node scripts/run-vitest.mjs ui/src/e2e/session-suggestions.e2e.test.ts

Result: FAIL (partial) — step 2 expect_output streams a remote draft into a live preview bubble: expected terminal output was not visible within 30 seconds: "streams a remote draft into a live preview bubble"

runner@runnervm76f27:/tmp/clawsweeper-live-proof-126994-fo5vur/target$ node scripts/run-vitest.mjs ui/src/e2e/session-suggestions.e2e.test.ts
[test] starting test/vitest/vitest.ui-e2e.config.ts
[test] preflight test/vitest/vitest.ui-e2e.config.ts
node scripts/run-vitest.mjs ui/src/e2e/session-suggestions.e2e.test.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-126994-fo5vur/profile/cache/ms-playwright/ffmpeg-1011

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126994-fo5vur/target






























Assertions:

  • FAIL expect_output: streams a remote draft into a live preview bubble

How this fits together

The Control UI sends composer typing state to the Gateway, which applies session-sharing checks and broadcasts ephemeral typing events to other live viewers. The receiving Control UI renders those events above the composer.

flowchart LR
A[Control UI composer] --> B[Typing request]
B --> C[Gateway sharing checks]
C --> D[Per-connection typing state]
D --> E[Throttled shared typing event]
E --> F[Other viewers typing indicator]
Loading

Decision needed

Question Recommendation
Should eligible viewers of an existing shared session receive unsent Control UI draft text by default, rather than only a presence signal? Confirm the shared-viewer default: Keep previews for eligible shared viewers after the propagation fix and document that drafts are ephemeral but visible to those viewers.

Why: The patch intentionally expands what is sent across the shared-session viewer boundary; code review cannot decide the acceptable privacy default.

Before merge

  • Emit the preview-clearing update when one tab stops (P2) - The new state owner correctly returns typing: true without a preview when the preview tab stops but another tab remains live. This branch returns before broadcastTypingThrottled, so viewers keep the old unsent draft until expiry instead of immediately falling back to dots; cover this two-connection transition at the handler boundary.
  • Resolve security concern: Confirm unsent-draft recipient policy - The event now includes unsent preview text for all eligible shared-session viewers; this is a material expansion beyond the prior presence-only signal and should be explicitly approved as the intended privacy boundary.
  • Resolve merge risk (P1) - Merging would make unsent draft contents visible by default to eligible shared-session viewers, expanding the prior presence-only privacy behavior without a per-session choice.
  • Resolve merge risk (P1) - The checkout could not hydrate current-main blobs or inspect TypeBox 1.3.6 source because its GitHub remote could not resolve; this does not affect the direct head-level P2 finding.

Findings

  • [P2] Emit the preview-clearing update when one tab stops — src/gateway/server-methods/sessions-suggestions.ts:593-595
  • [low] Confirm unsent-draft recipient policy — src/gateway/server-methods/sessions-suggestions.ts:634
Agent review details

Security

Needs attention: The implementation intentionally broadens shared-session viewer data to include unsent drafts, which needs an explicit privacy-default decision before merge.

PR surface

Source +143, Tests +477, Docs +2, Other +8. Total +630 across 21 files.

View PR surface stats
Area Files Added Removed Net
Source 13 190 47 +143
Tests 6 480 3 +477
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 1 9 1 +8
Total 21 681 51 +630

Review metrics

Metric Value Why it matters
Production versus test delta production +187/-46; tests/test support +483/-4; generated Swift +9/-1; docs +2 The feature adds a cross-Gateway/UI behavior and substantial focused coverage; the production growth is attributable to the new protocol, state, and rendering path.
Protocol surface 2 optional preview fields added across session.typing input and event schemas The additive Gateway payload reaches generated Swift models and all Control UI consumers, so its privacy and upgrade behavior merits explicit review.

Stored data model

Persistent data-model change detected: serialized state: packages/gateway-protocol/src/schema/sessions-suggestions.test.ts, serialized state: packages/gateway-protocol/src/schema/sessions-suggestions.ts, serialized state: src/gateway/server-methods/session-typing-state.test.ts, serialized state: src/gateway/server-methods/session-typing-state.ts, serialized state: src/gateway/server-methods/sessions-suggestions.ts, serialized state: src/gateway/server-methods/sessions-typing.test.ts, and 6 more. Confirm migration or upgrade compatibility proof before merge.

Mantis proof suggestion

A web UI chat proof would directly demonstrate the corrected two-connection transition that ordinary screenshots miss. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis web UI chat proof: verify that a shared user's draft bubble returns to the three-dot indicator when that user's draft tab stops while another tab remains typing.

Merge-risk options

Maintainer options:

  1. Repair propagation and confirm the privacy default (recommended)
    Remove the no-broadcast stop path, cover the two-connection transition at the handler boundary, and obtain explicit approval for viewer-visible unsent drafts.
  2. Make draft contents opt-in
    Preserve the existing presence-only default and expose previews only through an explicitly chosen shared-session setting.
  3. Pause the feature
    Do not merge draft previews if maintainers do not want shared-session viewers to receive unsent text by default.

Technical review

Best possible solution:

Remove the handler short-circuit, add a Gateway-boundary regression for preview-tab stop plus a still-typing sibling tab, then explicitly confirm that shared viewers may receive unsent drafts by default.

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

Yes, from source: send a preview from one connection, keep a second same-actor connection typing, then stop the preview connection; the handler returns before emitting the no-preview update.

Is this the best way to solve the issue?

No: per-connection aggregation is the right owner, but its no-preview result is discarded by the handler’s early return instead of reaching the throttled broadcaster.

Full review comments:

  • [P2] Emit the preview-clearing update when one tab stops — src/gateway/server-methods/sessions-suggestions.ts:593-595
    The new state owner correctly returns typing: true without a preview when the preview tab stops but another tab remains live. This branch returns before broadcastTypingThrottled, so viewers keep the old unsent draft until expiry instead of immediately falling back to dots; cover this two-connection transition at the handler boundary.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Existing shared sessions change from a presence-only typing signal to viewer-visible draft content by default.
  • add merge-risk: 🚨 security-boundary: The patch expands the data delivered to eligible viewer connections from typing presence to unsent text.

Label justifications:

  • P2: A normal shared-session workflow can leave stale unsent draft text visible after the source tab stops typing.
  • merge-risk: 🚨 compatibility: Existing shared sessions change from a presence-only typing signal to viewer-visible draft content by default.
  • merge-risk: 🚨 security-boundary: The patch expands the data delivered to eligible viewer connections from typing presence to unsent text.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This is a member-owned, maintainer-labeled PR, so the external-contributor proof gate does not apply; the PR body nevertheless includes browser evidence for the visible feature.

Evidence

Security concerns:

  • [low] Confirm unsent-draft recipient policy — src/gateway/server-methods/sessions-suggestions.ts:634
    The event now includes unsent preview text for all eligible shared-session viewers; this is a material expansion beyond the prior presence-only signal and should be explicitly approved as the intended privacy boundary.
    Confidence: 0.94

What I checked:

  • Preview-removal broadcast is skipped: After connection aggregation removes a preview tab and returns effective typing without preview, this early return skips the throttle and event emission; remote viewers retain the prior preview until their local expiry timer. (src/gateway/server-methods/sessions-suggestions.ts:593, 929ec41ae64e)
  • Connection owner reports the needed state transition: The state owner correctly returns { typing: true } after the preview connection stops while another connection remains live, but its result is not propagated by the handler. (src/gateway/server-methods/session-typing-state.ts:180, 929ec41ae64e)
  • Regression coverage stops below the Gateway boundary: The added state test proves preview removal in memory, while the handler test proves only that a second boolean-only connection preserves an active preview; neither asserts the stop transition emits a no-preview typing event. (src/gateway/server-methods/sessions-typing.test.ts:145, 929ec41ae64e)
  • Feature-history provenance: The existing session typing indicator dates to the session-suggestions feature commit, and the current repair is by the same area contributor. (src/gateway/server-methods/session-typing-state.ts:157, 90aee8279359)
  • Release provenance: The PR head is not contained in a local release tag; the latest supplied release is v2026.7.1-2 at 0790d9f, predating this August PR head. (0790d9f593ad)
  • Current-main inspection limitation: The partial checkout could list current-main paths but could not hydrate older blobs because its promisor remote could not resolve GitHub; the finding above is directly proven from the reviewed head. (df8fedcc00dc)

Likely related people:

  • steipete: Git history attributes the original session typing feature and the current connection-aggregation repair to Peter Steinberger. (role: feature introducer and recent area contributor; confidence: high; commits: 90aee8279359, 929ec41ae64e; files: src/gateway/server-methods/session-typing-state.ts, src/gateway/server-methods/sessions-suggestions.ts)
  • Vyctor H. Brzezowski: Recent UI history includes the transcript typing-indicator repair in the same rendering surface. (role: adjacent Control UI typing contributor; confidence: medium; commits: e97b42a43ad8; files: ui/src/pages/chat/chat-pane-sharing.ts)

Rank-up moves

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

  • Remove the early return and add a handler-level two-connection stop regression.
  • Record maintainer confirmation of the intended shared-viewer privacy default.

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-21T04:27:13.769Z sha 72e5d28 :: found issues before merge. :: [P2] Preserve an active preview across same-actor connections

A boolean-only session.typing update from a second connection of the same
actor (another tab or device) erased their live draft preview, because
typing liveness aggregated per actor while the broadcast preview came only
from the latest request. Preview aggregation now lives with the connection
aggregation owner: updateTypingConnections tracks per-connection previews
and returns the newest non-empty preview among live connections, so the
broadcast keeps the active draft until its connection stops or expires.

Regression fails pre-fix (event lost its preview field).
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Aug 21, 2026
@steipete
steipete merged commit e7cfff2 into main Aug 21, 2026
242 checks passed
@steipete
steipete deleted the steipete/typing-indicator-bubbles-5f5285 branch August 21, 2026 05:30
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
…penclaw#126994)

* feat(control-ui): stream live draft previews in the typing indicator

Multi-identity sessions now show what a teammate is typing, not just that
they are typing: the composer's per-keystroke session.typing sends carry a
bounded tail of the draft (optional preview field, 400 code points max),
the gateway throttle re-emits on changed payloads at 250ms (boolean-only
stays at 1s, trailing edge keeps the latest draft), and the transcript
renders a per-actor bubble with the live text plus a blinking caret.
Actors without preview data keep the three-dot bubble.

Previews are ephemeral presence: never persisted, never part of the
session transcript or model context, excluded from aria-live regions, and
gated by the existing >=2-live-viewers, sharing-role, and incognito
checks. No new config surface.

* chore(protocol): regenerate Swift gateway models for typing preview

* fix(gateway): aggregate typing previews across same-actor connections

A boolean-only session.typing update from a second connection of the same
actor (another tab or device) erased their live draft preview, because
typing liveness aggregated per actor while the broadcast preview came only
from the latest request. Preview aggregation now lives with the connection
aggregation owner: updateTypingConnections tracks per-connection previews
and returns the newest non-empty preview among live connections, so the
broadcast keeps the active draft until its connection stops or expires.

Regression fails pre-fix (event lost its preview field).
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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant