Skip to content

The agent that grows with you

fix(google_meet): stop the PCM tail thread from swallowing every exception

teknium178cee6bcbdb8
diff --git a/plugins/google_meet/meet_bot.py b/plugins/google_meet/meet_bot.py
index 0c55ed210b1..35124408d95 100644
--- a/plugins/google_meet/meet_bot.py
+++ b/plugins/google_meet/meet_bot.py
@@ -211,8 +211,8 @@ def _pcm_tail_loop(proc, pcm_path: Path, stop_flag: dict, poll_interval: float =
continue
proc.stdin.write(chunk)
proc.stdin.flush()
- except Exception:
- pass # pump exited / pipe closed: nothing left to stream to
+ except (OSError, ValueError):
+ pass # pump exited / pipe closed (BrokenPipeError, write on closed stdin): nothing left to stream to
finally:
_quiet(proc.stdin.close)
diff --git a/tests/plugins/test_google_meet_plugin.py b/tests/plugins/test_google_meet_plugin.py
index 519313d5f64..cdcd90db1b5 100644
--- a/tests/plugins/test_google_meet_plugin.py
+++ b/tests/plugins/test_google_meet_plugin.py
@@ -371,6 +371,25 @@ def test_pcm_pump_receives_audio_appended_after_start(tmp_path, monkeypatch):
assert state.mic_state is None and "micState" in state.status_path.read_text(encoding="utf-8")
+def test_pcm_tail_loop_swallows_only_pipe_errors(tmp_path):
+ """A closed pump pipe is expected and quiet; any other tail-thread bug must not be silenced."""
+ from types import SimpleNamespace
+
+ from plugins.google_meet.meet_bot import _pcm_tail_loop
+
+ pcm = tmp_path / "speaker.pcm"
+ pcm.write_bytes(b"\x00" * 16)
+
+ def proc(exc):
+ def write(_chunk): raise exc
+ return SimpleNamespace(poll=lambda: None, stdin=SimpleNamespace(write=write, flush=lambda: None,
+ close=lambda: None))
+
+ _pcm_tail_loop(proc(BrokenPipeError()), pcm, {"stop": False}) # quiet
+ with pytest.raises(RuntimeError):
+ _pcm_tail_loop(proc(RuntimeError("bug")), pcm, {"stop": False})
+
+
# ---------------------------------------------------------------------------
# Realtime session counters + cancel_response (barge-in)
# ---------------------------------------------------------------------------