Merge pull request #5115 from DanielThomas/dannyt/sendUserMessage-agent-end

fix(coding-agent): drain follow-ups queued during agent_end
This commit is contained in:
Mario Zechner
2026-05-28 10:47:31 +02:00
committed by GitHub
5 changed files with 352 additions and 1 deletions

View File

@@ -419,4 +419,27 @@ describe("AgentSession queue characterization", () => {
'Extension command "/testcmd" cannot be queued. Use prompt() or execute the command when not streaming.',
);
});
it("delivers follow-ups queued during agent_end", async () => {
let sent = false;
const harness = await createHarness({
extensionFactories: [
(pi: ExtensionAPI) => {
pi.on("agent_end", async () => {
if (sent) return;
sent = true;
pi.sendUserMessage("conflict report", { deliverAs: "followUp" });
});
},
],
});
harnesses.push(harness);
harness.setResponses([fauxAssistantMessage("reply"), fauxAssistantMessage("follow-up reply")]);
await harness.session.prompt("hello");
await harness.session.agent.waitForIdle();
expect(getUserTexts(harness)).toEqual(["hello", "conflict report"]);
});
});