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:
@@ -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"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user