WhatsApp: send commentary live#57484
Conversation
Greptile SummaryThis PR adds live commentary delivery for WhatsApp: when Key implementation pieces:
Confidence Score: 5/5This PR is safe to merge; all observable findings are style/quality suggestions with no impact on correctness. The implementation is thorough: generation counters guard compaction retries, abort propagation is cleanly threaded through every async boundary, delivered-segment tracking is consistent, and finally blocks prevent resource leaks. Test coverage is comprehensive. No P0 or P1 issues found. No files require special attention, but reviewers may wish to re-read the queueCommentaryDelivery closure in pi-embedded-subscribe.ts to confirm generation-vs-abort ordering satisfies their mental model. Reviews (1): Last reviewed commit: "WhatsApp: send commentary live" | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9631183600
ℹ️ 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".
| if (filteredAssistantOutputs.length > 0) { | ||
| return filteredAssistantOutputs; | ||
| } | ||
| } | ||
| if (params.assistantTexts.length > 0) { | ||
| return params.assistantTexts; |
There was a problem hiding this comment.
Skip assistantTexts fallback after full live-commentary delivery
When assistantOutputs exists but all commentary segments are filtered out as already delivered live, this branch falls back to assistantTexts. In timeout/abort runs where the only finalized text is that same commentary, the final payload re-sends content that users already received live, so commentary is duplicated despite deliveredCommentarySegmentIds. This is triggered specifically when filteredAssistantOutputs becomes empty because of live-delivery filtering, so fallback should distinguish “no finalized outputs” from “outputs intentionally filtered.”
Useful? React with 👍 / 👎.
Summary
onCommentaryReplyseam in the embedded runner/subscribe path, wired it only for WhatsApp behindchannels.whatsapp.commentaryDelivery: "off" | "live", filtered already-delivered commentary out of the final payload assembly, and restored thelastAssistantfallback so timeout/abort paths keep partial visible text.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
N/A
git blame, prior PR, issue, or refactor if known): previous attempts lived in WhatsApp: send commentary updates live #43731, WhatsApp: send commentary live #57279, and WhatsApp: send commentary live #57289.Regression Test Plan (if applicable)
src/agents/pi-embedded-subscribe.commentary.test.tssrc/agents/pi-embedded-runner/run/payloads.test.tssrc/agents/pi-embedded-runner.e2e.test.tsextensions/whatsapp/src/auto-reply/deliver-reply.test.tslastAssistanttext, and WhatsApp delivery honors timeout/abort semantics.User-visible / Behavior Changes
channels.whatsapp.commentaryDelivery: "off" | "live""live", commentary is sent to the WhatsApp chat in real time and the final answer is still delivered separately.Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation: N/ARepro + Verification
Environment
channels.whatsapp.commentaryDelivery: "live"Steps
channels.whatsapp.commentaryDelivery: "live"for the WhatsApp account/channel.Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
src/agents/pi-embedded-runner/run/payloads.test.tssrc/agents/pi-embedded-runner.e2e.test.tssrc/agents/pi-embedded-subscribe.commentary.test.tsextensions/whatsapp/src/auto-reply/deliver-reply.test.tspnpm buildcompleted successfully on this reset branchlastAssistantfallback now survives the timeout/empty-finalized-output pathlastAssistantsnapshot text when finalized outputs are emptypnpm checkcurrently fails on untouched current-mainfiles outside this PR (src/commands/doctor-memory-search.ts,src/commands/doctor-memory-search.test.ts,extensions/memory-core/src/memory/search-manager.test.ts). This reset branch does not modify those files.extensions/whatsapp/src/auto-reply/monitor/process-message.inbound-context.test.tsremains the known wrapper-hang lane in this workspace, so I am not claiming a clean wrapper completion for that file.Review Conversations
Compatibility / Migration
channels.whatsapp.commentaryDeliveryto"live"Risks and Mitigations
lastAssistantsnapshot text.