Skip to content

Reduce dictation device startup and post-release overhead - #80

Open
DevelopedByDev wants to merge 3 commits into
mainfrom
codex/dictation-latency
Open

DevelopedByDev wants to merge 3 commits into
mainfrom
codex/dictation-latency

Conversation

@DevelopedByDev

@DevelopedByDev DevelopedByDev commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Automatic microphone discovery now runs at launch and on device changes. A shortcut opens the cached built-in microphone immediately, or the system default while the initial scan is pending. A device query can no longer hold capture open; stale scan completions cannot replace newer choices. Discovery does not acquire a microphone, and existing device fallback remains.

An admitted HUD take now reuses that take's native session admission when sending audio after release. Previously, recordings exceeding the five-second session cache could add another native session HTTP request before upload. Standalone bridge uploads still admit independently, explicit retries re-admit, and the web endpoint still enforces current authentication, workspace access, plan limits and billing.

An expired-session 401 triggers one forced session refresh and upload replay with the same idempotency key. Cancellation aborts that refresh. A failed cached device is discarded so unavailable device discovery cannot keep retrying a removed input.

Validation: nine focused capture/lifecycle tests, native TypeScript checking and targeted lint passed locally. Full tests, real Electron interaction checks and packaging run in CI. Electron coverage includes pending device enumeration, delayed flush cancellation, a take longer than the admission cache, retry admission, expired-session replay and its cancellation, provider cancellation and denied uploads. Heavy checks stay in CI.

This removes overhead from the existing batch path. It does not implement incremental speech recognition or claim zero-latency first device opening. No provider, billing policy or binary publication setting changes.

@DevelopedByDev

Copy link
Copy Markdown
Contributor Author

QA handoff

Tested head: 6a34d17bac86e87e48da5cc5710460b59c286f09.

Microphone discovery is cached without acquiring an idle microphone. Capture no longer waits for enumeration, retains the last known choice during pending discovery, rejects stale scan results, and discards a failed cached device. An admitted private dictation take avoids a redundant session request on release. HTTP 401 forces one session refresh and one replay with the same operation key; cancellation aborts refresh and prevents replay. Public bridge calls still authenticate independently.

Validation:

  • Current-head native CI passed: 81 unit tests, 10 Electron Playwright tests, compilation, source/security checks and unsigned packaging.
  • Sequential local checks passed: 9 focused tests (vitest run src/main/services/recorder-lifecycle.test.ts src/main/services/dictation-audio.test.ts), native TypeScript and targeted ESLint. Heavy suites and packaging ran in CI.
  • Actual Electron HTTP fixtures cover a take exceeding the session-cache window without an extra stop-time GET, explicit Retry admission, 401 refresh/replay with stable idempotency, cancellation while refresh is held, denied admission and subsequent recovery. Audio capture also succeeds with discovery permanently pending.
  • CI reproduction: npm test, npm run build, then npx playwright test e2e/bridge.e2e.ts e2e/migration.e2e.ts e2e/recorder.e2e.ts. Expect capture despite blocked discovery; direct upload after admitted recording; one refresh/replay after 401; no replay after dismissal.

Companion: LayerNorm/overlay-web#368. It pins df517c125cbfd870950ddbfadb65c99d8fa5e521; the only later native change is an E2E fixture timing correction. Application source, packages and native artifact manifest are identical at the pinned and tested heads.

No hosted Preview was requested: no web UI/API, backend, provider, billing or environment behavior changed. These tests use an isolated local HTTP fixture in actual Electron. No new physical-device latency benchmark or real-provider latency distribution was measured. Cold hardware opening remains; streaming recognition is a proposed next phase, not implemented here. Microphone remains off until invoked. No installer published.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T00:14:11.655817Z 6a34d17 Draft marked ready
ℹ️ 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.

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