Skip to content

Prevent mobile realtime speaker echo loops - #712

Merged
rogerchappel merged 2 commits into
mainfrom
codex/fix-mobile-realtime-echo-loop
Jul 20, 2026
Merged

rogerchappel merged 2 commits into
mainfrom
codex/fix-mobile-realtime-echo-loop

Conversation

@rogerchappel

Copy link
Copy Markdown
Owner

Summary

  • hold mobile microphone PCM back while assistant playback is inside its grace/candidate window
  • require stronger, longer speech before treating mobile double-talk as intentional barge-in
  • suppress the short acoustic tail after phone-speaker playback ends
  • leave desktop realtime barge-in behavior unchanged

Why

The browser already requests echo cancellation, noise suppression, and gain control, but CrewCMD currently transports raw PCM through the OpenClaw gateway relay rather than WebRTC. Speaker leakage above the local energy threshold was forwarded upstream before interruption was confirmed, allowing the assistant to hear itself and enter a response loop.

Verification

  • pnpm test -- src/lib/realtime-voice-gateway-relay.test.ts — 12 tests passed
  • pnpm typecheck
  • targeted ESLint
  • git diff --check
  • pre-push production build

Manual QA

On an iPhone without headphones, let a realtime response finish at normal speaker volume and confirm it does not create a new user turn. Then speak clearly over a response for about one second and confirm deliberate barge-in still works.

Risk

Medium. Mobile speaker-mode barge-in is intentionally less eager; desktop behavior is unchanged.

@rogerchappel
rogerchappel merged commit a982bb3 into main Jul 20, 2026
2 checks 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