Repository navigation
feat(control-ui): stream live draft previews in the typing indicator - #126994
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 21, 2026, 1:13 AM ET / 05:13 UTC. ClawSweeper reviewWhat this changesAdds optional live draft previews to Control UI shared-session typing events while retaining the three-dot indicator for typists without preview text. Merge readinessKeep 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 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe 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]
Decision needed
Why: The patch intentionally expands what is sent across the shared-session viewer boundary; code review cannot decide the acceptable privacy default. Before merge
Findings
Agent review detailsSecurityNeeds attention: The implementation intentionally broadens shared-session viewer data to include unsent drafts, which needs an explicit privacy-default decision before merge. PR surfaceSource +143, Tests +477, Docs +2, Other +8. Total +630 across 21 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Mantis proof suggestionA 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: Merge-risk optionsMaintainer options:
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against df8fedcc00dc. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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).
|
Merged via squash.
|
…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).
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.typingrequest on every keystroke and the gateway throttles a boolean broadcast. This change threads an optional boundedpreviewthrough that existing path instead of building a new channel:preview(maxLength: 400, typebox counts code points — verified against typebox 1.3.6) onSessionTypingParamsandSessionTypingEvent.sendTypingStatesends the last 300 code points, omitted entirely when empty or whentyping: false.broadcastTypingThrottledgeneralized to a payloadsignature+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.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
session-typing-state.test.tsnew: changed-preview re-emit, 250/1000ms cadence, trailing-edge latest-wins; handler: bounded previews, no preview aftertyping: false; schema: optional/bounded), 285 chat UI tests.ui/src/e2e/session-suggestions.e2e.test.ts— new streaming test drivessession.typingevents 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-changedclean; Codex autoreview clean ("patch is correct (0.99)", no findings).Before (dots only):
After (live draft + caret):
Mixed fidelities (preview + boolean-only dots):
Live streaming capture:
typing-preview-stream.mp4