Files
multica/server/internal/integrations
Bohan Jiang d8fa885d26 MUL-7068 fix(telegram): stop a chat:done from duplicating an in-flight placeholder (#8117)
A streamed Telegram reply posts a placeholder on the first agent text frame and edits it as the transcript grows, so the final chat:done edits that same message. The placeholder's id is only recorded once sendMessage returns, and terminal delivery read it without knowing a send was in flight: a chat:done landing inside that round trip read 0, skipped the edit path and posted the whole reply again, while the placeholder — carrying the same text — stayed in the chat.

o.streams becomes the single owner registry for a task's reply. A partial confirms it still owns the stream in the same critical section that publishes its send; terminal delivery defers with a short retry while that send is in flight instead of reading a not-yet-recorded id; and the id is read under the mutex that guards it. The delivery target is resolved once for the settle retry only — the unbounded chat-capacity wait still re-resolves, so an installation revoked or re-keyed while a reply queues is not delivered to.

Three deterministic regression tests cover the in-flight wait, the mirror case where terminal delivery consumed the stream first, and revocation during a capacity wait.

Reported in #8049.
2026-09-07 18:54:07 +08:00
..