fix(qa-channel): handle metadata-free final replies

Fix qa-channel final reply preview delivery when a harness or plugin path calls deliver without dispatcher metadata. Verified with remote Testbox proof plus hosted PR checks.
This commit is contained in:
Vincent Koc
2026-07-04 17:23:52 -07:00
committed by GitHub
parent 4ec7842be0
commit 890f4efc88
2 changed files with 21 additions and 1 deletions

View File

@@ -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<unknown>;
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);

View File

@@ -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) => {