fix(background-agent): fail abort on SDK errors

Treat resolved abort responses with a non-null error payload the same as rejected aborts. This prevents stale-timeout cancellation bookkeeping from reporting success when the child session was not actually aborted.

Plan: .omo/plans/subagent-timeout-active-output.md
This commit is contained in:
YeonGyu-Kim
2026-05-21 15:23:52 +09:00
parent b68af25e41
commit 0bf8a9df25
2 changed files with 44 additions and 2 deletions
@@ -37,6 +37,22 @@ describe("abortWithTimeout", () => {
expect(logMock).not.toHaveBeenCalled()
})
test("#given abort resolves with an SDK error response #when abortWithTimeout runs #then it reports cancellation failure", async () => {
// given
const error = { message: "session not found" }
const abort = mock(async () => ({ error }))
// when
const result = await abortWithTimeout(createClient(abort), "session-error-response", 10)
// then
expect(result).toBe(false)
expect(logMock).toHaveBeenCalledWith(
"[background-agent] Session abort returned an error response:",
{ sessionID: "session-error-response", error },
)
})
test("#given abort hangs indefinitely #when abortWithTimeout runs #then it logs warning and continues", async () => {
// given
const abort = mock(() => new Promise<never>(() => {}))