WhatsApp: send commentary updates live#43731
Conversation
Greptile SummaryThis PR introduces WhatsApp live-commentary delivery by wiring Key changes and observations:
Confidence Score: 4/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e32ebf15e
ℹ️ 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".
|
Addressed the two summary-only review notes in 94f3e9505ddec09135ba5d6021a094f18a7545d8:
The same commit also replaces the old module-global fallback-id cache with per-run reconciliation state and adds a regression for repeated identical unsigned assistant messages. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94f3e9505d
ℹ️ 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: fbff0b8064
ℹ️ 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: 553c0248e2
ℹ️ 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: 69085551fa
ℹ️ 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: c769105a9a
ℹ️ 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: 89867ce38d
ℹ️ 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: 5bc1a90593
ℹ️ 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: cd971099a0
ℹ️ 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".
| throwIfAborted(); | ||
| const caption = index === 0 ? remainingText.shift() || undefined : undefined; | ||
| try { | ||
| const media = await loadWebMedia(mediaUrl, { |
There was a problem hiding this comment.
Apply commentary abort timeout to media fetches
The new commentary abort/timeout wiring does not cover media loading: loadWebMedia(...) is awaited directly after a one-time throwIfAborted() check, so if the media source stalls (for example, a hanging HTTP response or slow local read), timeoutMs/abortSignal cannot interrupt this await. In live-commentary runs with media payloads, this leaves a callback running past its deadline and can let stale commentary work outlive the run instead of being promptly canceled.
Useful? React with 👍 / 👎.
This replaces the earlier dirty-base attempt from #42489 with the final WhatsApp-only version of the feature.
Summary
This PR makes WhatsApp optionally deliver assistant
commentaryupdates live during a run, while keeping every other channel unchanged.The implementation was tightened to keep the product boundary clear:
channels.whatsapp.commentaryDelivery = "off" | "live"commentaryvsfinal_answerrun/attempt.tsWhat changed
phaseand stable text-signature metadata on OpenAI WebSocket partial assistant text blocks so live commentary can be identified beforeresponse.completed.src/agents/assistant-output.tsdown to extraction and per-message fallback-id helpers only.subscribeEmbeddedPiSession():assistantOutputsdeliveredCommentarySegmentIdsmessage_endsrc/agents/pi-embedded-runner/run/attempt.ts.deliverNormalizedReplyPayload()abstraction and kept the WhatsApp send path local insrc/web/auto-reply/monitor/process-message.ts.channels.whatsapp.commentaryDeliveryin the WhatsApp channel docs and configuration reference.Scope boundary
Included:
Explicitly not included:
commentaryDeliveryconfigUser-visible behavior
channels.whatsapp.commentaryDeliveryis unset oroff.channels.whatsapp.commentaryDelivery: "live", interim assistantcommentaryupdates are sent as separate WhatsApp messages during the run.Verification
Manual / behavior checks:
Tests run:
pnpm exec vitest run src/agents/openai-ws-stream.test.tspnpm exec vitest run src/agents/pi-embedded-subscribe*.test.tspnpm exec vitest run src/agents/assistant-output.test.ts src/auto-reply/reply/reply-delivery.test.ts src/agents/pi-embedded-runner/run/payloads.test.ts src/web/auto-reply/monitor/process-message.inbound-contract.test.ts src/telegram/bot-message-dispatch.test.tspnpm formatpnpm tsgoRisk / rollback
channels.whatsapp.commentaryDelivery=off