Skip to content

[voice] 🤖 feat: add local speech models - #8163

Open
coadler wants to merge 9 commits into
mainfrom
local-models-ecjn
Open

coadler wants to merge 9 commits into
mainfrom
local-models-ecjn

Conversation

@coadler

@coadler coadler commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add local speech recognition in Settings → Voice. Users can download and select Parakeet TDT v2 or v3. OpenAI Whisper remains an explicit cloud option.

Background

Voice input currently requires an OpenAI API key. Local models let users dictate without sending audio to a cloud provider.

Implementation

  • Run Parakeet in a dedicated browser worker with bundled ONNX WebAssembly assets.
  • Keep audio on the client device, including when Xum uses a remote backend.
  • Pin model revisions, sizes, and SHA-256 hashes. Reject incomplete or altered downloads.
  • Store downloads in the browser or app profile. Support download cancellation, removal, and cross-window updates.
  • Keep the selected provider fixed for each recording. Never fall back from local transcription to OpenAI.
  • Support transcription cancellation through Escape or the recording control.
  • Queue concurrent local transcriptions with a cancellable lock instead of discarding recordings.
  • Disable voice in restricted Electron server windows. Keep microphone permissions unchanged and direct users to a browser.
  • Stop local capture at 120 seconds and transcribe the recording. Bound worker execution time.
  • Keep touch-device downloads disabled because those devices use native keyboard dictation.

Validation

An isolated local Xum deployment verifies both models with a real speech recording. External network requests stay blocked during transcription. Both models place the expected transcript in the composer.

The same deployment verifies download cancellation, transcription cancellation, model removal, and cross-window selection updates. Chromium and WebKit show the complete settings dialog at phone widths.

An isolated Electron instance verifies the production worker and bundled runtime from local files.

Screenshots

Desktop

Voice settings

Phone (375 px)

Voice settings on a phone

Download error

Download error

Restricted Electron server window (375 px)

Restricted Voice controls

Review status

Not ready. Review work pauses for a scope decision.

Six earlier findings have fixes and resolved threads. The current review adds two unresolved findings:

The repeated cross-window findings show that the model-removal lifecycle needs a simpler contract. I pause under the review-loop rule instead of adding another reservation mechanism.

Proposed scope reduction: keep the CPU-only runtime correction here, but remove model-removal controls from the initial feature. Track model removal separately with an explicit active-recording contract. This proposal needs maintainer direction. No scope reduction applies yet, and both findings remain open.

The Codex gate fails. CI and visual review remain incomplete. No merge or auto-merge is enabled.

Risks

  • Each model uses approximately 660–670 MB of storage and requires several GB of free memory.
  • Clearing browser or app profile data removes downloaded models.
  • Recording lifecycle changes affect both local and cloud transcription. Existing OpenAI routing remains unchanged.

Generated with xum • Model: openai:gpt-6-astra • Thinking: xhigh • Cost: $55.38

Mux added 2 commits November 12, 2026 11:25
Add verified Parakeet model downloads and device-local transcription.
Keep OpenAI as an explicit cloud option.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$21.69`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=21.69 -->
Keep voice availability in the model hook.
Separate model actions and recording key decisions.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$21.69`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=21.69 -->
@coadler

coadler commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T18:56:01.303730Z 36e7bca Manual request
🔒 Security Review ✅ Completed 2026-11-12T18:52:39.682680Z 36e7bca Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 315eb9a2d0

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 47.3k tokens (23% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 6.2s
🟢 a chat survives a restart of the server 1 step · 1 call 6.2s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 4.9s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 4.9s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 11.3s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 11.3s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 10.2s
🟢 a chat survives trips through Settings 2 steps · 1 call 10.2s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 5.3s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 5.3s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 3.0s
🟢 the agent opens the playground workspace 2 steps · 1 call 3.0s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 7.4s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 7.4s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 3.3s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 3.3s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 24.8s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 4.2s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.3s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 5.0s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 4.1s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.8s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.3s

e2e 0.20.0 · 1m 21s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 7.9k tokens (22% cached)
Spend: $0.02 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 8.6s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 8.6s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 7.4s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 7.4s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 6.4s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 6.4s

e2e 0.20.0 · 25.6s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 7.9s · 2 targets (web, phone) · run artifacts

Use dark-only desktop and phone variants. Existing stories do not show local model controls.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$30.94`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=30.94 -->
@coadler

coadler commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 6d0c13b9d3

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 6d0c13b9d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coadler

coadler commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 3622b471f6

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3622b471f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3622b471f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coadler

coadler commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 320659221e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 320659221e

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@coadler

coadler commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2c6d18076c

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c6d18076c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/stores/LocalVoiceStore.ts Resolved
Mux added 6 commits November 12, 2026 12:47
Test audio downmix, cache-only requests, and resource cleanup.
Cover concurrent calls, duration limits, missing cache entries, and cancellation.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$42.86`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=42.86 -->
Check download gating, cancellation, model selection, removal, errors, and provider navigation.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$38.71`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=38.71 -->
Check the completed cache after acquiring the download lock. Keep incomplete-cache cleanup unchanged.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$41.98`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=41.98 -->
Use a cancellable Web Lock for the full transcription lifecycle.
Keep queued audio until inference starts, and clean resources before releasing the lock.
Test queued cancellation and serialization after success, failure, and abort.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$42.86`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=42.86 -->
Disable voice in restricted Electron server windows without changing permissions. Release download chunks before checksum allocation.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$42.86`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=42.86 -->
Stop local capture at its deadline and preserve audio for transcription.
Trim PCM to the processing limit when the capture timer runs late.
Share the existing touch restriction between recording and model controls.
Test deadline cleanup, cloud behavior, touch support, and PCM boundaries.

Co-authored-by: Mux <noreply@coder.com>

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$42.86`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=42.86 -->
@coadler

coadler commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 36e7bca6f8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36e7bca6f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3 to +4
import wasmUrl from "onnxruntime-web/ort-wasm-simd-threaded.jsep.wasm?url";
import mjsUrl from "onnxruntime-web/ort-wasm-simd-threaded.jsep.mjs?url";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Load the WASM-only runtime for CPU inference

On macOS Safari, which supportsLocalVoice() admits as a non-touch browser, these JSEP assets make CPU-only backend: "wasm" inference consume several gigabytes and potentially terminate the tab. The upstream ONNX Runtime report reproduces this across releases beginning with 1.21, including the 1.24 family pinned here, while the plain WASM bundle avoids the blow-up. Use onnxruntime-web/wasm and the non-JSEP assets for this CPU-only worker.

Useful? React with 👍 / 👎.


export async function removeVoiceModel(id: LocalVoiceModelId): Promise<void> {
await navigator.locks.request(voiceModelCacheName(id), async () => {
await caches.delete(voiceModelCacheName(id));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve model caches used by active recordings

When the selected model is removed from Settings—particularly from another app window—while a recording is active, queued, or decoding, this deletion can finish before transcribeLocally() acquires the cache lock. The completed recording then fails with the missing-download error and its dictation is discarded. Reserve the model from capture through cache loading, or defer removal while recordings depend on it.

AGENTS.md reference: AGENTS.md:L118-L118

Useful? React with 👍 / 👎.

@coadler

coadler commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Review status

Not ready. Review work pauses for a scope decision.

Six earlier findings have fixes and resolved threads. The current review adds two unresolved findings:

The repeated cross-window findings show that the model-removal lifecycle needs a simpler contract. I pause under the review-loop rule instead of adding another reservation mechanism.

Proposed scope reduction: keep the CPU-only runtime correction here, but remove model-removal controls from the initial feature. Track model removal separately with an explicit active-recording contract. This proposal needs maintainer direction. No scope reduction applies yet, and both findings remain open.

The Codex gate fails. CI and visual review remain incomplete. No merge or auto-merge is enabled.


Generated with xum • Model: openai:gpt-6-astra • Thinking: xhigh • Cost: $55.38

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant