fix: outbound recovery can replay already sent replies#99600
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 4:02 AM ET / 08:02 UTC. Summary PR surface: Source +926, Tests +1359. Total +2285 across 56 files. Reproducibility: yes. Current main records successful platform sends only after the adapter returns, and the PR's focused tests exercise later chunk/commit failures that would otherwise leave replayable queue state. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the shared queue-state and per-send progress approach after exact-head checks finish, keeping the callback additive/internal and preserving the bundled-channel regression coverage. Do we have a high-confidence way to reproduce the issue? Yes. Current main records successful platform sends only after the adapter returns, and the PR's focused tests exercise later chunk/commit failures that would otherwise leave replayable queue state. Is this the best way to solve the issue? Yes. The shared write-ahead queue transition plus per-send progress callback is the maintainable fix because it avoids per-channel inference and carries concrete results through the core recovery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1e20f15581f9. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +926, Tests +1359. Total +2285 across 56 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
e9b4df6 to
6780532
Compare
|
Maintainer proof for exact head
Additional standalone Testbox/Azure rerun attempts were blocked before command execution by runner shutdown/rate-limit errors and an Azure lease timeout; the successful broad Testbox run, real-Gateway scenario, and exact-head hosted gates above cover the landed behavior. No screenshot applies because this has no UI surface. |
529ce2e to
e659f40
Compare
Co-authored-by: zhang-guiping <[email protected]>
e659f40 to
5b764f0
Compare
|
Merged via squash.
|
* fix(outbound): avoid replaying sent recovery deliveries * fix(outbound): persist recovery send state before ack Co-authored-by: zhang-guiping <[email protected]> * fix(outbound): preserve partial send evidence across adapters * test(line): cover multi-send delivery progress * fix(outbound): preserve repeated receipt result multiplicity * test(heartbeat): expect delivery progress callback --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Outbound recovery could successfully send one or more platform messages, then fail during later persistence, acknowledgement, or adapter work while leaving the canonical queue row eligible for replay. After a restart, users could receive duplicate replies or attachments that had already reached the channel.
Why This Change Was Made
Recovery now owns one canonical queue row through the full send lifecycle:
send_attempt_startedbefore crossing the platform boundary;unknown_after_sendbefore acknowledgement;The maintainer rewrite removes the original parallel failed-diagnostic path. The same typed result callback is carried through core message delivery and every bundled multi-send adapter, so recovery no longer has to infer whether a rejected adapter sent nothing or sent part of a batch.
User Impact
Recovered outbound replies no longer replay after the platform accepted them. Partial multi-message deliveries retain exact progress across failure or restart, while genuine pre-send failures remain retryable. The behavior applies consistently across bundled channels, including Discord, Feishu, LINE, Matrix, Microsoft Teams, Signal, Slack, Telegram, Twitch, WhatsApp, Zalo, and Zalouser.
Evidence
tbx_01kwny7am5ze6ef3m5v1gy5mwm, 10m04, passed.tbx_01kwnxyzfmqjg0pe8d5xpm31pf, passed with the interrupted marker emitted at most once and the recovery marker emitted exactly once.scripts/pr prepare-run 99600accepted the exact head inhosted_exact_headmode.No before/after screenshot applies: this is internal queue/recovery behavior with no UI surface.