Skip to content

fix: preserve dictation text across xAI chunks and Stop - #180923

Merged
steipete merged 4 commits into
openclaw:mainfrom
mushuiyu886:fix/issue-180845-xai-chunk-final
Oct 23, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
mushuiyu886:fix/issue-180845-xai-chunk-final

Conversation

@mushuiyu886

@mushuiyu886 mushuiyu886 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #180845

What Problem This Solves

Fixes: Control UI dictation loses earlier words after short pauses with xAI, and loses trailing words when Stop commits a nonempty preview before transcription finishes.

User Impact

Dictation retains successive locked chunks and inserts the completed transcript after Stop. Capture stops and the composer unlocks immediately; timeout, disconnection, or failed finalization preserves the received preview. Canceling, changing draft/session/connection, or starting another voice action retires the pending insertion. No configuration changes or migration are required.

Why This Change Was Made

The xAI adapter forwarded tail-only interim events as complete previews. The initial contributor fix retained one chunk but replaced it on the next chunk final and carried it into replacement streams. The maintainer rewrite accumulates every locked chunk, emits xAI's already-stitched utterance final unchanged, and settles locked text before a replacement stream starts. Reconnect intentionally discards the old stream's unconfirmed tail.

The composer also committed nonempty snapshots before its existing final drain could receive trailing words. Stop now uses that drain for every transcript, preserving the pre-Stop preview on failed finalization and rechecking ownership before insertion. Removing the immediate-commit branch and obsolete finalization flag keeps dictation and Split Talk on one finalization path.

Thanks @mushuiyu886 for the initial fix and regression. The contributor commit remains in this PR's history; main was merged without rebasing.

Evidence

  • Source-confirmed on reviewed main e2b9abadc93d7f177e6bf8e77829a585ec850cbc: the xAI nonterminal branch calls onPartial(text) unchanged, and the composer immediately commits a nonempty snapshot before calling finish() without draining.
  • Provider regressions use the real WebSocket session with synthetic events. Successive chunk finals retain the full prefix; stitched finals avoid duplication and reset the next turn; replacement streams settle the old locked prefix before accepting new partials. On main, the partial-prefix assertions and reconnect transcript assertion fail.
  • The existing composer Stop regression now receives a partial before Stop and its corrected final afterward, expecting one complete insertion. Main fails its no-early-commit assertion. Existing tests also cover fallback on timeout/disconnect/failure and rejection after draft/session/client replacement. Fake clocks and deferred receipts are used; no new real sleeps or polling.
  • Local dependency installation was attempted once on trusted main and refused because this host has Node 26.12.0 while main requires at least 26.12.1 on Node 26. Per maintainer policy, local tests, lint/format, and typechecks were skipped without bypassing engines. Test durations and red/green execution remain unmeasured locally; PR CI owns those checks.
  • Live Gateway/channel/Control UI e2e was skipped per maintainer proof policy. No live or screenshot proof is claimed.
  • git diff --check: passed. Simplification pass: removed the early commit path and obsolete finalization option. Production +49/-29 (net +20), tests +161/-44 (net +117), docs +9/-0. Remaining production growth stores locked chunks and preserves failure/ownership behavior; unrelated deletions were not used to meet a line quota.
  • Codex autoreview: scoped-clean through P2, no accepted/actionable findings. Static review only.
  • Exact-head CI run 39901721044 passed at 720b6311d32e8e43c282b0bcc28c75c8f8593ac7; the final check rollup was 47 passing, 55 skipped, zero failures/pending. Lint, format, production/test types, UI suites, and changed Node/extension checks passed without reruns.
  • CI logs confirm both new xAI regressions passed (24 ms for successive chunks; 19 ms for replacement streams). The composer dictation suite passed with 578 ms of reported test execution; its direct-dictation consumer suite (118 ms) and Split Talk sibling suite (177 ms) also passed. These are CI test durations, not local or full-job wall times.

ClawSweeper's exact-head re-review confirms a complete fix and no actionable code findings. The previous successive-chunk P1 and reconnect P2 are resolved. Its only remaining hold requests live Control UI/Gateway proof; the maintainer proof policy above explicitly overrides that proof-only hold.

…iews

xAI chunk-final events (is_final without speech_final) lock the utterance so
far, and the following interims carry only the tail after the locked chunk.
The provider forwarded every non-terminal event as a plain partial, so the
composer preview shrank mid-utterance and stopping in that window lost the
locked text permanently. Chunk finals are now retained and stitched onto
later interims, matching the Deepgram provider; the utterance final still
emits the full transcript and clears the lock.
@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The PR retains successive xAI transcription chunks and waits for final transcription after Stop before inserting dictated text.

Example: xAI locks “First.”, previews “Second.”, and completes transcription after the user presses Stop.

  • Before: The composer can insert only “Second.” and discard the later complete transcript.
  • After: The composer inserts “First. Second.” once finalization completes.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation resolves the earlier findings and has useful regression coverage, but required after-fix behavior evidence is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Dictation can drop earlier words after short pauses and omit trailing words when the user presses Stop.
Reason: The report establishes lost text in ordinary use, and the recorded maintainer rewrite explicitly supports this focused direction.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: current main still loses dictated text, and the focused rewrite addresses both previous findings without a new concrete correctness finding.

Priority: P1
Reviewed head: 720b6311d32e8e43c282b0bcc28c75c8f8593ac7

Before merge

  • Add real behavior proof - The supplied evidence consists of a real-WebSocket provider test harness and mocked-browser owner regressions, with local execution and live Control UI proof explicitly skipped. Before merge, the contributor should provide redacted recording, logs, or live output from the changed Control UI and Gateway showing successive xAI chunks retained, Stop receiving the complete trailing final, and cancellation or draft switching rejecting pending insertion; redact IPs, API keys, phone numbers, and non-public endpoints. The comment's claimed proof-policy exemption does not satisfy this external PR's required behavior-proof gate. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: After-fix Control UI dictation through the Gateway is not demonstrated, and the rewritten regressions have no supplied base-failing/head-passing execution.
Agent review details

How this fits together

Browser microphone audio passes through Gateway Talk transcription to the xAI WebSocket adapter; partial and final events return to the dictation session, which inserts text into the owning composer draft.

flowchart LR
  A[Browser microphone] --> B[Dictation session]
  B --> C[Gateway Talk relay]
  C --> D[xAI transcription adapter]
  D --> E[xAI WebSocket service]
  E --> D
  D --> C
  C --> B
  B --> F[Composer draft]
Loading

Technical review

Best possible solution:

Retain xAI chunks in the provider and route every Stop through the existing session drain while preserving preview fallback and draft cancellation.

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

The linked report provides Chromium and xAI event traces, and current-main source independently shows both truncation mechanisms; no target code was executed during this review.

Is this the best way to solve the issue?

The patch fixes each cause at its existing owner, removes the competing immediate-commit path, and updates Split Talk to the same finalization contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 853e92c5110d.

Provenance checked

  • xAI partial accumulation and utterance finalization keeps the original intent (67f09ea: xAI realtime transcription supplied partial and final callbacks; the later merged repair at 0d20999 preserved repeated utterances while suppressing final/terminal echoes.)
  • Nonempty Stop snapshots changes intended behavior with a stated reason (925056c: The earlier repair intentionally drained late finals only for empty snapshots while unlocking the composer and preserving live edits.)
  • Failed finalization and shared speech lifecycle changes intended behavior with a stated reason (c4649b0: Configured Gateway speech introduced the shared capture owner, buffered finalization, and cancellation of failed pending results; this PR explicitly retains the pre-Stop preview instead of accepting a failed provisional result.)
  • Draft ownership and reactive observation keeps the original intent (288e650: The voice-owner refactor kept synchronous admission and canceled capture before adopting another draft's callbacks.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6938f6e adds extensions/xai/realtime-transcription-provider-factory.ts:57 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6938f6e782a9; files: extensions/xai/realtime-transcription-provider-factory.ts)
  • Ayaan Zaidi: Raw commit 925056c adds ui/src/pages/chat/composer-dictation.ts:695 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 925056cc25c2; files: ui/src/pages/chat/composer-dictation.ts)

PR surface

Source +20, Tests +117, Docs +9. Total +146 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 49 29 +20
Tests 2 161 44 +117
Docs 2 9 0 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 219 73 +146

Review metrics

Metric Value Why it matters
Production versus regression code Production +49/-29; tests +161/-44 The production growth retains locked chunks and failure fallback within existing owners; tests cover distinct chunk ordering, replacement-stream, Stop, failure, and ownership cases.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Normal dictation on an official release can silently omit spoken words from the inserted draft.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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 (1 earlier review cycle)
  • reviewed 2026-10-22T19:31:08.887Z sha 5f542e2 :: needs real behavior proof before merge. :: [P1] Accumulate successive chunk finals instead of replacing the lock | [P2] Settle locked text before accepting a replacement stream

Reviewed October 23, 2026, 12:48 AM ET / 04:48 UTC (Revision 2).

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: M and removed size: XS labels Oct 23, 2026
@steipete steipete changed the title fix(xai): keep locked chunk-final text in realtime transcription previews fix: preserve dictation text across xAI chunks and Stop Oct 23, 2026
@steipete

Copy link
Copy Markdown
Contributor

Addressed both concrete findings in the maintainer rewrite: successive chunk finals now accumulate, and a replacement stream settles the old locked prefix before accepting new partials. The rewrite also fixes the issue's nonempty Stop path by using the existing final drain, with preview fallback and current draft/session/connection checks. The contributor commit is preserved.

The PR body records the regression assertions, scoped-clean Codex autoreview through P2, and local execution limitations. Live Gateway/channel/Control UI proof was skipped under the maintainer proof policy; exact-head PR CI supplies tests and lint.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 23, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer disposition of the exact-head re-review: both previous code findings are resolved, and the review now reports a complete fix with no actionable findings.

The remaining hold is proof-only. For this maintainer takeover, the approved proof policy explicitly uses PR CI for execution and skips live Gateway/channel/Control UI e2e. That proof-only hold is overridden for this task; it does not require a code change or another re-review.

Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/39901721044 passed at 720b6311d32e8e43c282b0bcc28c75c8f8593ac7, with 47 passing checks and no failures or pending checks. Logs confirm both xAI regressions, the composer dictation suite, direct-dictation consumer suite, and Split Talk sibling suite passed. Base-failing behavior is source-confirmed; no local red/green or live proof is claimed. The PR body contains the detailed evidence and limitations.

The PR remains open and unmerged for the separate landing step.

@steipete
steipete merged commit 71eb77b into openclaw:main Oct 23, 2026
146 of 150 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 24, 2026
)

* fix(xai): keep locked chunk-final text in realtime transcription previews

xAI chunk-final events (is_final without speech_final) lock the utterance so
far, and the following interims carry only the tail after the locked chunk.
The provider forwarded every non-terminal event as a plain partial, so the
composer preview shrank mid-utterance and stopping in that window lost the
locked text permanently. Chunk finals are now retained and stitched onto
later interims, matching the Deepgram provider; the utterance final still
emits the full transcript and clears the lock.

* fix: preserve dictation text through chunking and stop

---------

Co-authored-by: Peter Steinberger <[email protected]>
CompleteDotTech added a commit to CompleteDotTech/openclaw that referenced this pull request Nov 26, 2026
Address the ClawSweeper source review of draft PR openclaw#205794 at
95b1575. Related: openclaw#205645.

- Reuse the existing Gateway presentation scope so transport-only epoch
  changes do not discard an admitted recording. Existing client, account,
  session, permission and draft guards still retire actual destination changes.
- Remove the lexical correction planner. Every Explicit preparation retains
  the exact original and returns unavailable with no edit plan. This also
  preserves "I work Tuesday, no Wednesday shifts are available" without
  adding keyword exceptions. Off and one-capture Literal keep their raw paths.
- Keep unresolved capture ownership and the policy sampled at admission.
  Refuse another enabled capture until the pending one is resolved. Preserve
  Escape cancellation during lazy preparation and Off final drain, while an
  open composer menu gets the first Escape.
- Preserve the received-preview recovery intent of PR openclaw#180923 / 71eb77b
  in the existing capture/final-drain/ordered-commit owner. Author regressions
  through the actual lifecycle/context builder for disconnect, delayed final,
  timeout, failure and retained late callbacks.
- Align review copy and WebChat documentation with original-only availability.
  Extend actual preference-sync and mounted control fixtures; distinguish
  injected presentation cases from real capture and provider qualification.

Validation for this revision: independent static source review; native Git
whitespace and tree checks; trusted text/hash and literal-LF accounting only.
No repository code was executed. Focused tests, types, lint, formatter,
canonical localization/baseline and ratchet gates, builds, real browser/Gateway,
microphone/provider, assistive technology and stable-upgrade proof are NOT RUN
or NOT COLLECTED. The permitted isolation probe failed before repository code;
no weaker isolation, workflow dispatch or re-review request was used. Earlier
branch test summaries do not qualify these changed files.

Test allocation is 1,859 beyond the ordinary 400 lines: the complete feature
adds 2,259 literal test lines against b48d578.
The distinct boundaries are lifecycle recovery, ordered cancellation, capture
admission, local preference sync, mounted input ownership, presentation and
structural range validation. This repair removes 302 production lines and
adds 810 test lines relative to the reviewed parent. The complete feature still
adds 1,261 production lines; the reduction is not a whole-feature size claim.

Semantic correction generation, placement, shared preference decisions and
the broader acceptance criteria remain unresolved. This is a draft repair,
not a feature-completion, maintainer-acceptance or product-validation claim.
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 extensions: xai P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M 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.

[Bug]: xAI realtime transcription drops locked chunk-final text from dictation preview (Control UI)

2 participants