Skip to content

fix: recover native voice capture in background#361

Merged
rogerchappel merged 1 commit into
mainfrom
fix/native-background-voice-turns
May 11, 2026
Merged

fix: recover native voice capture in background#361
rogerchappel merged 1 commit into
mainfrom
fix/native-background-voice-turns

Conversation

@rogerchappel
Copy link
Copy Markdown
Owner

Summary

  • keep the native iOS voice session alive with a session-level background task while Agent Mode listening is active
  • recover the AVAudioEngine after app backgrounding, audio interruptions, route changes, and media-service resets
  • add native diagnostics for applicationState, engineRunning, and lastAudioBufferAt so background capture stalls are visible on-device
  • align the generated iOS audio-session bootstrap with .mixWithOthers as well as the native voice-session plugin

Context

Roger tested the merged native voice branch and found that output works in the background / locked screen, but input still stops producing usable turns after switching apps even though the iOS notch microphone indicator remains active.

This PR targets the generated native plugin source in apps/mobile/scripts/ensure-ios-voice-session.mjs; in this worktree there is no checked-in apps/mobile/ios/App/App/CrewCmdVoiceSessionPlugin.swift, so the Swift source must be changed through the generator.

Important iOS caveat: if a foreground app such as Slack or another calling/recording app owns the microphone, iOS may still prevent simultaneous background microphone capture. This PR is intended to fix/recover the CrewCMD background/locked-screen case and provide diagnostics when iOS interrupts or stalls capture.

Validation

  • pnpm install --frozen-lockfile --ignore-scripts
  • pnpm lint:check -- apps/mobile/scripts/ensure-ios-audio-session.mjs apps/mobile/scripts/ensure-ios-voice-session.mjs — passed with existing repo warnings only, 0 errors
  • pnpm typecheck
  • cd apps/mobile && pnpm ios:audio-session && pnpm ios:voice-session && pnpm check
  • node --check apps/mobile/scripts/ensure-ios-audio-session.mjs
  • node --check apps/mobile/scripts/ensure-ios-voice-session.mjs
  • git diff --check

Notes

Exact generated-project identifiers preserved in the Xcode patcher path: CCVS000000000000000001, CCVS000000000000000002, 504EC3071FED79650016851F.

@rogerchappel rogerchappel merged commit b02144e into main May 11, 2026
1 check passed
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