fix(whatsapp): propagate steered inbound audio metadata for TTS dispatch#94049
fix(whatsapp): propagate steered inbound audio metadata for TTS dispatch#94049xialonglee wants to merge 3 commits into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same active-steer inbound-audio TTS bug is now owned by the open maintainer PR that keeps the audio fact operation-local instead of adding a transient marker to persisted session state. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this branch as superseded and continue review on #95596 as the canonical operation-local fix for the linked WhatsApp/TTS bug. So I’m closing this here and keeping the remaining discussion on #95596. Review detailsBest possible solution: Close this branch as superseded and continue review on #95596 as the canonical operation-local fix for the linked WhatsApp/TTS bug. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows the audio fact exists before active steering, is not carried across the active-run queue boundary on current main, and final TTS gates from the original text context. Is this the best way to solve the issue? No. This branch is plausible, but the operation-local sibling is a cleaner state-lifetime match because the audio fact belongs to the accepted reply operation rather than durable session data. Security review: Security review cleared: No security or supply-chain-sensitive files are touched; the diff changes TypeScript runtime metadata and tests only. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against d1b917120a47. |
aadad84 to
cf951e5
Compare
…tore and clear after dispatch
|
@clawsweeper re-review Addressed the Codex review findings:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
9133dc6 to
4792b6c
Compare
4792b6c to
2b02c06
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
Closing this PR as superseded by #95596. The maintainer PR (#95596) fixes the same root cause (active-steer inbound-audio TTS dispatch) with a cleaner approach — keeping the audio fact operation-local in the reply runner rather than adding a transient marker to persisted session state. That's a better state-lifetime match and avoids a new reserved slot key on SessionEntry. Thanks for the thorough review and the re-review rounds. Let's continue on #95596 for the canonical fix. |
|
Superseded by #95596 — the maintainer PR fixes the same root cause with a cleaner operation-local approach. |
Root Cause
When steer mode injects an audio inbound into an active streaming session,
agent-runner.tscallsqueueEmbeddedAgentMessageWithOutcomeAsyncwith only the prompt text and returns early. The steered inbound's audio metadata (currentInboundAudio) is lost. When the original session's stream blocks are later dispatched viadispatch-from-config.ts,inboundAudiois computed from the original text-onlyctx, so the TTS gate attts.ts:2003skips synthesis — the voice reply is delivered as plain text.Summary
tts.auto: "inbound"are delivered as plain text when an audio inbound arrives during an active streaming session that usessteermode.steeredInboundAudioboolean field onSessionEntry. When steer mode injects an audio inbound into an active session, persiststeeredInboundAudio = truethrough the session store so downstream dispatch sees it. After the dispatch consumes the flag, clear it from the store so subsequent text-only turns do not inherit voice behavior.Verification
pnpm test src/auto-reply/reply/agent-runner.media-paths.test.ts— 11 passed (9 existing + 1 original steered + 1 new persistence/clear regression test)pnpm test src/auto-reply/reply/dispatch-from-config.test.ts— 209 passedpnpm test src/auto-reply/reply/followup-runner.test.ts— 77 passedpnpm tsgo:prod— typecheck cleanpnpm check:test-types— all passpnpm format:check(changed files) — all cleanpnpm build— binary builds and version matches HEADReal behavior proof
Behavior addressed: WhatsApp voice reply is now correctly synthesized as audio via TTS when
tts.auto: "inbound"is configured and the incoming audio arrives during an active steer-mode streaming session.Real environment tested: Linux x86_64, Node v24.13.1, branch
fix/issue-76831-tts-steer-audioat9133dc6233Exact steps or command run after this patch:
Evidence after fix:
New regression test
persists steered inbound audio through session store and clears after dispatch:steeredInboundAudiois persisted through the store after steeringObserved result after fix: All 297 tests pass. Binary builds and version matches HEAD. The new regression test exercises the persisted store lookup rather than only the local object, and confirms the flag is consumed after dispatch.
What was not tested: Live WhatsApp E2E test with actual WhatsApp audio inbound and TTS output. The fix's logic is covered by unit tests at the propagation site (agent-runner), persistence path (updateSessionEntry), and consumption site (dispatch-from-config), but a full WhatsApp roundtrip with real audio was not performed in this change.