test(claude): reproduce stopped background child restored as running

This commit is contained in:
paseo-bot[bot]
2026-11-07 07:04:16 +00:00
parent 751dc82e6c
commit 1c9dc8751f
@@ -648,6 +648,23 @@ describe("ClaudeAgentSession persisted subagent replay", () => {
);
}
test("cancels a background child from a task-id-only stopped notification on reopen", async () => {
const text = `<task-notification>\n<task-id>${AGENT_ID}</task-id>\n<status>stopped</status>\n<summary>Background agent didn't finish before the previous session ended</summary>\n</task-notification>`;
writeSession({
parentLines: [
...backgroundLaunch(),
JSON.stringify({ type: "queue-operation", operation: "enqueue", content: text }),
JSON.stringify({ type: "user", message: { role: "user", content: text } }),
],
meta: JSON.stringify({ toolUseId: TOOL_USE_ID }),
sidechainLines: [sidechainEntry({ stopReason: "tool_use" })],
});
expect(upserts(await replayDescriptors()).at(-1)).toMatchObject({
id: TOOL_USE_ID,
status: "canceled",
});
});
test("prefers a stopped notification over the child's end_turn", async () => {
writeSession({
parentLines: [...backgroundLaunch(), taskNotification("stopped")],