Skip to content

Fix native recording lifecycle - #2

Merged
roprgm merged 18 commits into
mainfrom
agent/fix-native-recording-lifecycle
Jul 25, 2026
Merged

roprgm merged 18 commits into
mainfrom
agent/fix-native-recording-lifecycle

Conversation

@roprgm

@roprgm roprgm commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • align recording controls with confirmed browser audio capture
  • treat empty and no-speech completion as successful while preserving existing input
  • stop false recording states on capture end or microphone disconnection
  • preserve valid transcript text when a later recognition error arrives
  • document the predictable recording lifecycle and reorganize tests as a behavior specification

Root cause

The native adapter used a separate microphone stream for the waveform while the provider inferred recording state from the transcription object. A recognition service could therefore end while the waveform UI remained active. The provider also handled only rejected final-text promises, and the native adapter treated every recognition error as fatal even after valid text had been emitted.

Behavior

  • checks speech-recognition support synchronously before requesting microphone access
  • requests the microphone immediately and waits for audiostart before reporting recording
  • exposes captureEnded so recording visuals stop during final-text processing
  • handles microphone track termination and cleans up tracks and listeners
  • returns to idle without an error when recognition ends with no text
  • keeps permission, device, startup, and recognition failures retryable

Validation

  • pnpm test — 41 tests passed
  • pnpm check
  • pnpm build

@vercel

vercel Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat-voice-input Ready Ready Preview, Comment Jul 25, 2026 8:06pm

Request Review

@roprgm
roprgm force-pushed the agent/fix-native-recording-lifecycle branch from 890642e to 3557284 Compare July 25, 2026 20:06
@roprgm
roprgm merged commit e0a764f into main Jul 25, 2026
5 checks passed
@roprgm
roprgm deleted the agent/fix-native-recording-lifecycle branch July 25, 2026 20:07

This branch was successfully deployed

1 active deployment
Preview — 35572846 Deployed Jul 25, 2026 by vercel[bot]
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