Skip to content

fix(meeting-bot): prevent stalled realtime playback from growing memory - #116589

Merged
vincentkoc merged 26 commits into
mainfrom
fix/meeting-realtime-egress-backpressure
Jul 31, 2026
Merged

vincentkoc merged 26 commits into
mainfrom
fix/meeting-realtime-egress-backpressure

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • bound and serialize meeting-bot realtime audio egress so a stalled playback sink cannot retain unbounded audio
  • make clear, stop, barge-in, and provider terminal events invalidate queued output through explicit response ownership and generation fencing
  • wait for local/node playback acceptance while preserving mixed-version node compatibility

Related: #116201

Rollout contract

Updated node hosts advertise audioBridge.outputGeneration: true in the existing start response. Updated controllers use generation fencing with those hosts, so clear remains immediate even while an older write is draining.

When an older host does not advertise support, the controller serializes push and clear commands per bridge. Stop bypasses that legacy queue so shutdown can interrupt a blocked write, and queued non-stop output is ignored after stop. Older controllers remain compatible with updated hosts because outputGeneration is optional on the receiving side.

The node invoke policy forwards only validated non-negative safe-integer generations. No provider, config, environment-variable, user-facing product, or public Plugin SDK surface is added.

Validation

Exact head: da243d6fecb5cbc642e2a7a9fe1ce9e8f7e7aa7f

  • node scripts/run-vitest.mjs src/meeting-bot/realtime-engine.test.ts src/meeting-bot/realtime-local-audio-transport.test.ts src/meeting-bot/realtime-node-audio-transport.test.ts src/meeting-bot/node-host.audio.test.ts src/meeting-bot/chrome-transport.test.ts extensions/google-meet/src/node-invoke-policy.test.ts extensions/google-meet/node-host.test.ts extensions/google-meet/index.test.ts - 209/209 passed
  • Blacksmith Testbox CI=true pnpm check:changed - passed, including core/extension types, lint, Plugin SDK API contract, dead exports, and import-cycle guards
  • live OpenAI gpt-realtime-2.1 smoke with real credentials - three backend audio round trips completed, each responseDone: true with lateAudioBytes: 0
  • live browser WebRTC smoke - audio answer present, remote description applied, connection state connected
  • final branch autoreview - clean, no accepted/actionable findings, correctness 0.83
  • Plugin SDK API contract manifest - unchanged

Mixed-version proof

Focused regressions cover the negotiated paths directly:

  • updated controller -> older host: push and clear are serialized; generation fields are omitted; stop interrupts a blocked push and suppresses queued clear
  • updated controller -> updated host: push and clear carry generations; clear is dispatched immediately across an in-flight push; stale host writes are ignored
  • older controller -> updated host: commands without outputGeneration remain accepted and retain legacy response shapes
  • policy path: valid generations reach the host; malformed generations are denied before node dispatch

The existing real-module harness also verifies audio reaches the sink in both mixed-version directions and that updated-host stale generations return { bridgeId, ok: true, stale: true } without writing stale bytes.

@vincentkoc vincentkoc self-assigned this Jul 30, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 11:04 PM ET / July 31, 2026, 03:04 UTC.

ClawSweeper review

What this changes

The PR prevents realtime meeting-bot audio playback from retaining unbounded queued output by serializing writes, clearing stale output on terminal events, and negotiating generation-aware behavior with remote node hosts.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This remains a live, maintainer-owned bug-fix PR rather than a cleanup close candidate. The current head adds bounded output handling plus a negotiated compatibility path for older and newer node hosts; the previous compatibility findings are addressed by explicit legacy serialization and generation fencing. Before merge, refresh the clean merge result against current main and rerun the focused mixed-version playback proof on that result.

Priority: P1
Reviewed head: da243d6fecb5cbc642e2a7a9fe1ce9e8f7e7aa7f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong exact-head mixed-version and live-path evidence supports a focused compatibility fix, with final-base verification still warranted before merge.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies exact-head focused regressions, successful Testbox changed checks, live provider audio cycles with zero late audio, and a connected browser WebRTC smoke; no private artifact link was available to inspect further.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies exact-head focused regressions, successful Testbox changed checks, live provider audio cycles with zero late audio, and a connected browser WebRTC smoke; no private artifact link was available to inspect further.
Evidence reviewed 5 items Exact-head implementation: The submitted head adds generation-aware remote transport dispatch, legacy per-bridge serialization, node-host stale-generation rejection, and output-write waiter release on clear/stop paths.
Compatibility boundary: The extension parses the optional audioBridge.outputGeneration capability from the existing node start response and sets it only on the internal transport object; malformed output generations are denied by the Google Meet node invoke policy.
Focused regression coverage: The PR body records 209 focused passing tests covering local drain behavior, node generation fencing, mixed-version controllers and hosts, stop interruption, and policy validation at the exact head.
Findings None None.
Security None None.

How this fits together

Meeting-bot realtime voice receives streaming provider audio and forwards it through local processes or remote browser-node bridges into meeting playback. The changed transport and node-host boundary decides whether audio is queued, cleared, rejected as stale, or written to the playback sink.

flowchart LR
  A[Realtime voice provider] --> B[Meeting realtime engine]
  B --> C[Output owner and bounded queue]
  C --> D{Playback bridge capability}
  D --> E[Local playback process]
  D --> F[Remote node bridge]
  E --> G[Meeting audio sink]
  F --> G
Loading

Decision needed

Question Recommendation
Should this compatibility-sensitive realtime playback fix be merged after a final rebase/merge-result refresh and focused mixed-version proof? Refresh and merge: Rebase or refresh the merge result, rerun the focused mixed-version playback proof on that exact result, then merge if it remains clean.

Why: The patch preserves existing node command shapes while adding optional receiver capability negotiation; the remaining decision is whether the final-base proof is sufficient for landing this maintained, user-impacting change.

Before merge

  • Resolve merge risk (P1) - The PR is cleanly mergeable but behind current main; because its optional node capability changes playback ordering across controller/host versions, the mixed-version proof should be rerun against the final merge result before landing.
Agent review details

Security

None.

PR surface

Source +577, Tests +1114. Total +1691 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 9 827 250 +577
Tests 8 1125 11 +1114
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 1952 261 +1691

Review metrics

Metric Value Why it matters
Node playback protocol 1 optional capability plus 1 validated generation field The added internal protocol data controls whether remote playback uses immediate stale-generation fencing or legacy serialized commands during mixed-version upgrades.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #116201
Summary: This PR addresses the audio-egress and stale-playback portion of the broader realtime resource-bounds issue; that issue also tracks independent provider, consult, and queue-retention paths.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Refresh compatibility proof before merge (recommended)
    Validate the rebased or GitHub merge-result head with the focused updated-controller/older-host and older-controller/updated-host playback regressions before landing.
  2. Accept current-head evidence
    Maintainers may accept the exact-head live and mixed-version proof without a final-base rerun, owning the residual base-drift risk.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Refresh the merge result, rerun the focused mixed-version realtime playback tests on the exact resulting head, and retain the legacy serialization fallback for hosts without the capability.

Technical review

Best possible solution:

Keep the negotiated capability protocol internal, retain legacy serialization for non-advertising hosts, and land only after the rebased merge result passes the focused mixed-version playback suite and existing changed checks.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible with medium confidence: a stalled local output stream or blocked remote push exercises the new waiter/queue paths, and the PR supplies focused regressions for clear, stop, barge-in, and mixed-version behavior. I did not independently execute the repro in this read-only review.

Is this the best way to solve the issue?

Yes, subject to final-base verification: capability negotiation lets updated peers fence stale output while the legacy path serializes commands instead of breaking older node hosts, which is safer than making generation support mandatory.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8dd575f98614.

Labels

Label justifications:

  • P1: A stalled realtime playback path can affect active voice sessions by retaining queued audio or delivering obsolete output.
  • merge-risk: 🚨 compatibility: Updated controllers must remain safe with older node hosts, while older controllers must continue to work with updated hosts.
  • merge-risk: 🚨 message-delivery: The changed commands govern whether queued audio reaches, clears from, or is suppressed before the meeting playback sink.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies exact-head focused regressions, successful Testbox changed checks, live provider audio cycles with zero late audio, and a connected browser WebRTC smoke; no private artifact link was available to inspect further.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies exact-head focused regressions, successful Testbox changed checks, live provider audio cycles with zero late audio, and a connected browser WebRTC smoke; no private artifact link was available to inspect further.

Evidence

What I checked:

  • Exact-head implementation: The submitted head adds generation-aware remote transport dispatch, legacy per-bridge serialization, node-host stale-generation rejection, and output-write waiter release on clear/stop paths. (src/meeting-bot/realtime-node-audio-transport.ts, da243d6fecb5)
  • Compatibility boundary: The extension parses the optional audioBridge.outputGeneration capability from the existing node start response and sets it only on the internal transport object; malformed output generations are denied by the Google Meet node invoke policy. (extensions/google-meet/src/transports/chrome.ts, da243d6fecb5)
  • Focused regression coverage: The PR body records 209 focused passing tests covering local drain behavior, node generation fencing, mixed-version controllers and hosts, stop interruption, and policy validation at the exact head. (src/meeting-bot/realtime-node-audio-transport.test.ts, da243d6fecb5)
  • Real behavior evidence: The PR body reports three successful live gpt-realtime-2.1 audio cycles with lateAudioBytes: 0 and a connected browser WebRTC smoke, in addition to Testbox check:changed proof. (da243d6fecb5)
  • Repository review policy: The root policy treats provider and fallback compatibility as merge-sensitive, requires mixed-version boundary proof, and requires a fresh merge/result check before landing a behind PR. (AGENTS.md:40, 8dd575f98614)

Likely related people:

  • vincentkoc: Opened the related resource-bound issue and authored the ordered realtime-engine, transport, node-host, Google Meet policy, and regression-test series in this PR. (role: current meeting-bot feature contributor; confidence: high; commits: fe81e4f36b51, a0a7b8a5634d, f91c8ecd68d3; files: src/meeting-bot/realtime-engine.ts, src/meeting-bot/realtime-node-audio-transport.ts, src/meeting-bot/node-host.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the merge result against current main and rerun the focused mixed-version playback proof on that exact head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-31T00:31:11.670Z sha 9503328 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-31T00:43:00.310Z sha dabb314 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-31T00:58:20.424Z sha 97cb0a7 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-31T01:59:40.115Z sha ec305e8 :: found issues before merge. :: [P1] Preserve stale-audio safety with older node hosts
  • reviewed 2026-07-31T02:09:17.908Z sha c19c405 :: found issues before merge. :: [P1] Fence stale audio with older node hosts
  • reviewed 2026-07-31T02:25:14.463Z sha 6f84226 :: found issues before merge. :: [P1] Serialize legacy node audio commands across clear
  • reviewed 2026-07-31T02:29:47.568Z sha 6f84226 :: found issues before merge. :: [P1] Serialize legacy node audio commands across clear
  • reviewed 2026-07-31T02:59:38.410Z sha da243d6 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/meeting-realtime-egress-backpressure branch from 40adaa8 to c115a00 Compare July 31, 2026 00:19
@vincentkoc
vincentkoc force-pushed the fix/meeting-realtime-egress-backpressure branch from c115a00 to 9503328 Compare July 31, 2026 00:26
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 31, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 31, 2026 00:33
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jul 31, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 31, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Mixed-version and exact-head proof is now attached to the PR body.

Maintainer rollout decision: the optional generation field uses graceful degradation. Both mixed-version directions preserve the pre-existing push/clear contract; generation-based stale suppression activates once the receiver is updated. The real-module harness verified both pairings, and the final node protocol files are byte-identical to the proofed implementation commit.

Exact head 6f84226ab7c2ad12173f64c1db762917cb8bdc46 also passed 194 focused tests, Testbox check:changed, three live OpenAI audio cycles with zero late audio, browser WebRTC connection, and clean branch autoreview.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jul 31, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Exact-head compatibility fix and proof are now in the PR body.

Current head da243d6fecb5cbc642e2a7a9fe1ce9e8f7e7aa7f adds the requested controller-side legacy serialization, negotiates generation support from the existing node start response, lets stop interrupt blocked legacy output, and keeps the public Plugin SDK manifest unchanged.

Proof: 209 focused tests, Testbox CI=true pnpm check:changed, three live gpt-realtime-2.1 audio cycles with zero late bytes, connected browser WebRTC, and clean full-branch autoreview.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 31, 2026
@vincentkoc
vincentkoc merged commit 16c2337 into main Jul 31, 2026
130 of 136 checks passed
@vincentkoc
vincentkoc deleted the fix/meeting-realtime-egress-backpressure branch July 31, 2026 03:09
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via rebase.

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

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. plugin: google-meet proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant