fix(telegram): detach adopted turns from reply fence (#103952)

This commit is contained in:
Vincent Koc
2026-07-10 14:36:46 -07:00
committed by GitHub
parent d92d5774f5
commit c5bdd64442
2 changed files with 5 additions and 5 deletions
@@ -6000,6 +6000,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
// a later superseding peer (authorized explicit command) cannot abort it.
await adoptTurn?.();
expect(firstAbortSignal?.aborted).toBe(false);
expect(supersedeTelegramReplyFence("agent:main:telegram:group:-100123")).toBe(false);
await dispatchWithContext({
context: createGroupContext(100, "/export-trajectory bundle"),
@@ -6468,9 +6469,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
onTurnDeferred: vi.fn(),
onTurnAbandoned: onRejectedTurnAbandoned,
});
await expect(captures[2]?.lifecycle?.onAdmitted?.()).rejects.toThrow(
"durable adoption failed",
);
await expect(captures[2]?.lifecycle?.onAdmitted?.()).rejects.toThrow("durable adoption failed");
expect(supersedeTelegramReplyFence(rejectedKey)).toBe(true);
expect(captures[2]?.abortSignal?.aborted).toBe(true);
captures[2]?.lifecycle?.onComplete?.();
@@ -907,8 +907,9 @@ export const dispatchTelegramMessage = async ({
};
const adoptReplyTurn = async () => {
await onTurnAdopted?.();
// Fence abort authority ends only after durable adoption succeeds. Core
// then becomes the sole owner of killing the adopted run.
// Fence abort and supersession authority end after durable adoption.
// Core then owns all interruption of the adopted run.
releaseReplyFence();
releaseTelegramReplyFenceAbortController(activeReplyFenceKey, replyAbortController);
};
// Block mode sizes preview rotation steps from streaming.preview.chunk (same