WhatsApp: add preflight audio transcription for DM voice notes#64120
Conversation
Greptile SummaryThis PR adds a preflight audio transcription step to WhatsApp DM voice note processing, mirroring the existing fix applied to Telegram in #61008. The implementation correctly follows the lazy-loading boundary pattern ( Confidence Score: 5/5This PR is safe to merge; the change is narrowly scoped, non-fatal on failure, and all remaining observations are P2 style notes. Implementation mirrors a proven Telegram pattern exactly, follows the lazy-loading boundary convention, is guarded by three independent conditions, and is covered by 7 targeted unit tests. No P0 or P1 findings. The only minor observation (redundant ternary inside the mediaType guard) is cosmetic and correct. No files require special attention. Reviews (1): Last reviewed commit: "WhatsApp: add preflight audio transcript..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2cfa68e8b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
2cfa68e to
c316ae0
Compare
|
Re: Aisle Security Analysis — Unauthorized audio transcription preflight executed before access-control gating The preflight transcription does not execute before access-control gating. By the time
Additionally, the audio transcription is strictly subordinate to the existing LLM call: every message that reaches No trust boundary is being crossed here. The preflight mirrors the existing behavior for Telegram (in production since #61008) and Discord, which apply the same pattern in the same post-gating position. |
c316ae0 to
d801b65
Compare
|
Re: Aisle Security Analysis — Round 2 Issue 2 (Medium — loose MIME check): Fixed. Changed Issue 1 (High — no timeout/size limits): Out of scope for this PR. The concern is valid in the abstract, but this PR is a parity fix that mirrors the existing Telegram preflight (shipped in #61008) and Discord, both of which use the same inline Additionally, resource limits at the media download layer ( If maintainers agree that timeout/concurrency controls belong at the SDK primitive level, I'm happy to file a follow-up issue. Adding them only to the WhatsApp path in this PR would be scope creep relative to the fix goal. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d801b6514b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d801b65 to
1a57372
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a57372932
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1a57372 to
c8ebbe5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8ebbe5e3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8ebbe5e3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c8ebbe5 to
6daf3d2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6daf3d2cc0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5252071 to
c2359d5
Compare
|
Re: CI failures — all pre-existing on `main`, unrelated to this PR The three failing checks (
This PR only touches five files under I've also rebased onto the latest |
|
Re: Aisle Security Analysis — Issue 1 (transcript in logs) The two log lines flagged by Aisle ( What this PR does change is the value of A few additional mitigations already present:
If the project wants to treat transcripts as sensitive and avoid logging them by default, that is a valid improvement — but the correct fix is to audit |
|
Re: The failure occurred at the The Requesting a re-run of the failed job. |
a28b4ad to
c2359d5
Compare
|
Thanks — I addressed the Codex review items in follow-up amendments. Current state:
The PR remains scoped to WhatsApp DM voice-note preflight only, with no routing or group-behavior changes. Happy to revise further if you'd like this shaped differently. |
c2359d5 to
5376cd8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5376cd87ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1471203 to
08dac74
Compare
08dac74 to
7480b33
Compare
|
Merged via squash.
Thanks @rogerdigital! |
…law#64120) Merged via squash. Prepared head SHA: 7480b33 Co-authored-by: rogerdigital <[email protected]> Co-authored-by: mcaxtr <[email protected]> Reviewed-by: @mcaxtr
…law#64120) Merged via squash. Prepared head SHA: 7480b33 Co-authored-by: rogerdigital <[email protected]> Co-authored-by: mcaxtr <[email protected]> Reviewed-by: @mcaxtr
…law#64120) Merged via squash. Prepared head SHA: 7480b33 Co-authored-by: rogerdigital <[email protected]> Co-authored-by: mcaxtr <[email protected]> Reviewed-by: @mcaxtr
…law#64120) Merged via squash. Prepared head SHA: 7480b33 Co-authored-by: rogerdigital <[email protected]> Co-authored-by: mcaxtr <[email protected]> Reviewed-by: @mcaxtr
…law#64120) Merged via squash. Prepared head SHA: 7480b33 Co-authored-by: rogerdigital <[email protected]> Co-authored-by: mcaxtr <[email protected]> Reviewed-by: @mcaxtr
…law#64120) Merged via squash. Prepared head SHA: 7480b33 Co-authored-by: rogerdigital <[email protected]> Co-authored-by: mcaxtr <[email protected]> Reviewed-by: @mcaxtr
…law#64120) Merged via squash. Prepared head SHA: 7480b33 Co-authored-by: rogerdigital <[email protected]> Co-authored-by: mcaxtr <[email protected]> Reviewed-by: @mcaxtr
Summary
Fixes a WhatsApp regression where DM voice notes reached the agent as raw
<media:audio>placeholders with no preflight STT attempt, even when audio transcription was configured.This PR restores the missing preflight transcription step so the inbound context carries spoken text instead of the placeholder when transcription succeeds. Failures remain non-fatal and fall back to the original placeholder.
What Changed
preflightAudioTranscriptstring | null | undefinedpreflight states so failed preflight does not retry per agentmainchanges, including the newergroupSystemPromptcontext fieldRoot Cause
WhatsApp inbound processing built the agent-facing inbound line/context directly from
msg.body, which for voice notes is always<media:audio>. Unlike the existing Telegram and Discord paths, there was no WhatsApp preflight call totranscribeFirstAudio(...)before dispatch.Scope
Touched files are limited to the WhatsApp inbound/monitor path:
extensions/whatsapp/src/auto-reply/monitor/audio-preflight.runtime.tsextensions/whatsapp/src/auto-reply/monitor/broadcast.tsextensions/whatsapp/src/auto-reply/monitor/on-message.tsextensions/whatsapp/src/auto-reply/monitor/on-message.audio-preflight.test.tsextensions/whatsapp/src/auto-reply/monitor/process-message.tsextensions/whatsapp/src/auto-reply/monitor/process-message.audio-preflight.test.tsextensions/whatsapp/src/inbound/monitor.tsextensions/whatsapp/src/inbound/types.tsextensions/whatsapp/src/monitor-inbox.blocks-messages-from-unauthorized-senders-not-allowfrom.test-support.tsNo new SDK surface was added.
Verification
Focused local verification after the latest review fixes:
Latest result:
2test files passed14tests passedoxlintpassed with0warnings /0errorsReview Status
All functional Codex review items raised on this PR have been addressed and their threads resolved.
Out of Scope / Follow-up
Two broader concerns were intentionally kept out of this PR’s scope:
Both are better handled in shared media-understanding / SDK follow-up work rather than by expanding this WhatsApp regression fix.
Linked Issue