diff --git a/extensions/qa-channel/src/inbound.test.ts b/extensions/qa-channel/src/inbound.test.ts index 200e5edc8da6..429e2c783f08 100644 --- a/extensions/qa-channel/src/inbound.test.ts +++ b/extensions/qa-channel/src/inbound.test.ts @@ -118,6 +118,26 @@ describe("handleQaInbound", () => { ); }); + it("treats deliveries without dispatcher metadata as final replies", async () => { + const runtime = createPluginRuntimeMock(); + setQaChannelRuntime(runtime); + + await handleQaInbound(createQaInboundParams()); + + const assembled = firstRunAssembledParams(runtime); + await assembled.replyOptions?.onPartialReply?.({ text: "preview" }); + const deliverWithoutInfo = assembled.delivery.deliver as (payload: { + text: string; + }) => Promise; + await deliverWithoutInfo({ text: "final answer" }); + + expect(sendQaBusMessage).toHaveBeenCalledOnce(); + expect(editQaBusMessage).toHaveBeenCalledWith( + expect.objectContaining({ messageId: "preview-1", text: "final answer" }), + ); + expect(deleteQaBusMessage).not.toHaveBeenCalled(); + }); + it("keeps block deliveries separate and retains tool calls discovered after a preview", async () => { const runtime = createPluginRuntimeMock(); setQaChannelRuntime(runtime); diff --git a/extensions/qa-channel/src/inbound.ts b/extensions/qa-channel/src/inbound.ts index 2dcb0dcdb680..4d4a0c593e8d 100644 --- a/extensions/qa-channel/src/inbound.ts +++ b/extensions/qa-channel/src/inbound.ts @@ -372,7 +372,7 @@ export async function handleQaInbound(params: { if (!text.trim()) { return; } - await preview.deliver(text, info.kind); + await preview.deliver(text, info?.kind ?? "final"); }, onError: (error) => { void preview.clear().catch((clearError: unknown) => {