Skip to content

refactor(google-meet): merge host and node realtime engines behind one audio transport#109413

Merged
steipete merged 2 commits into
mainfrom
refactor/meet-realtime-engine
Jul 17, 2026
Merged

refactor(google-meet): merge host and node realtime engines behind one audio transport#109413
steipete merged 2 commits into
mainfrom
refactor/meet-realtime-engine

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

extensions/google-meet shipped two near-duplicate realtime audio engines: src/realtime.ts (Gateway-host path, SoX subprocess audio I/O) and src/realtime-node.ts (paired-node path, pullAudio/pushAudio relay over runtime.nodes.invoke). Every behavior fix (echo suppression, barge-in, TTS queueing, talk events) had to be made twice, and the copies had already drifted apart in event coverage, teardown ordering, and TTS completion semantics.

Why This Change Was Made

This is phase 1 of consolidating OpenClaw's meeting/voice stack so new meeting platforms (Microsoft Teams, later Zoom) can reuse one engine. The realtime engine is now written once and parameterized by a narrow MeetRealtimeAudioTransport contract (start input, write/clear output, fatal signal, optional barge-in monitor + health). Two transports implement it:

  • realtime-local-audio-transport.ts — SoX subprocesses (previous realtime.ts behavior), including the optional local human barge-in monitor.
  • realtime-node-audio-transport.ts — node relay loop (previous realtime-node.ts behavior).

realtime-node.ts (772 LOC) is deleted outright; no compat shims or re-exports.

Where the two copies had drifted, the safer variant was chosen deliberately:

  1. Talk-session observability: node agent path now emits the full lifecycle/turn/transcript event set the local path already had (event shapes unchanged; node payloads keep bridgeId/nodeId).
  2. TTS output completion now follows transport acceptance (node semantics) instead of completing on process write.
  3. Barge-in/flush ordering: flush output and reset suppression before finishing output state (local semantics).
  4. Fatal-before-startup is now handled explicitly: onFatal replays a pre-registration transport failure synchronously and the engine aborts before creating a provider session it could never close (review-found; regression test added).
  5. Input draining starts before connect() awaits so the capture pipe never backpressures during provider setup (review-found). The agent/STT engine drops pre-ready chunks instead of delivering a stale burst; the bidi engine forwards pre-connect audio to the voice bridge, matching the previous local command-pair behavior.
  6. Human barge-in remains a local-only optional transport capability; no node equivalent was invented.

User Impact

No config changes and no intended behavior changes beyond the drift resolutions above. Google Meet chrome and chrome-node sessions (agent, bidi, transcribe modes) behave as before, with the node path gaining the fuller talk-event observability.

Evidence

  • node scripts/run-vitest.mjs extensions/google-meet: 18 files, 263 tests passed (includes new regression tests for transport-fatal-during-setup and pre-startup-fatal abort).
  • git diff --check clean.
  • Autoreview (Codex gpt-5.6-sol, xhigh): two findings across rounds, both fixed (items 4 and 5 above); final round clean.
  • LOC: net −326 total; engine/transport production surface 2,128 → ~1,600.
  • Live meeting E2E was not run for this behavior-neutral refactor; the realtime process tests exercise real child-process stream failures. Stale max-lines baseline entry for the deleted file removed.

@steipete
steipete force-pushed the refactor/meet-realtime-engine branch from f95f841 to 3bf4842 Compare July 17, 2026 00:26
@steipete
steipete merged commit edd0529 into main Jul 17, 2026
183 of 185 checks passed
@steipete
steipete deleted the refactor/meet-realtime-engine branch July 17, 2026 00:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant