fix: detect interrupted/error/cancelled status in unstable-agent-task polling loop

The polling loop in executeUnstableAgentTask only checked session status
and message stability, never checking if the background task itself had
been interrupted. This caused the tool call to hang until MAX_POLL_TIME_MS
(10 minutes) when a task was interrupted by prompt errors.

Add manager.getTask() check at each poll iteration to break immediately
on terminal statuses (interrupt, error, cancelled), returning a clear
failure message instead of hanging.
This commit is contained in:
YeonGyu-Kim
2026-02-16 15:56:52 +09:00
parent dd11d5df1b
commit 0ef682965f
3 changed files with 294 additions and 35 deletions
+45 -35
View File
@@ -1714,17 +1714,19 @@ describe("sisyphus-task", () => {
const { createDelegateTask } = require("./tools")
let launchCalled = false
const launchedTask = {
id: "task-unstable",
sessionID: "ses_unstable_gemini",
description: "Unstable gemini task",
agent: "sisyphus-junior",
status: "running",
}
const mockManager = {
launch: async () => {
launchCalled = true
return {
id: "task-unstable",
sessionID: "ses_unstable_gemini",
description: "Unstable gemini task",
agent: "sisyphus-junior",
status: "running",
}
return launchedTask
},
getTask: () => launchedTask,
}
const mockClient = {
@@ -1839,17 +1841,19 @@ describe("sisyphus-task", () => {
const { createDelegateTask } = require("./tools")
let launchCalled = false
const launchedTask = {
id: "task-unstable-minimax",
sessionID: "ses_unstable_minimax",
description: "Unstable minimax task",
agent: "sisyphus-junior",
status: "running",
}
const mockManager = {
launch: async () => {
launchCalled = true
return {
id: "task-unstable-minimax",
sessionID: "ses_unstable_minimax",
description: "Unstable minimax task",
agent: "sisyphus-junior",
status: "running",
}
return launchedTask
},
getTask: () => launchedTask,
}
const mockClient = {
@@ -1973,17 +1977,19 @@ describe("sisyphus-task", () => {
const { createDelegateTask } = require("./tools")
let launchCalled = false
const launchedTask = {
id: "task-artistry",
sessionID: "ses_artistry_gemini",
description: "Artistry gemini task",
agent: "sisyphus-junior",
status: "running",
}
const mockManager = {
launch: async () => {
launchCalled = true
return {
id: "task-artistry",
sessionID: "ses_artistry_gemini",
description: "Artistry gemini task",
agent: "sisyphus-junior",
status: "running",
}
return launchedTask
},
getTask: () => launchedTask,
}
const mockClient = {
@@ -2039,17 +2045,19 @@ describe("sisyphus-task", () => {
const { createDelegateTask } = require("./tools")
let launchCalled = false
const launchedTask = {
id: "task-writing",
sessionID: "ses_writing_gemini",
description: "Writing gemini task",
agent: "sisyphus-junior",
status: "running",
}
const mockManager = {
launch: async () => {
launchCalled = true
return {
id: "task-writing",
sessionID: "ses_writing_gemini",
description: "Writing gemini task",
agent: "sisyphus-junior",
status: "running",
}
return launchedTask
},
getTask: () => launchedTask,
}
const mockClient = {
@@ -2105,17 +2113,19 @@ describe("sisyphus-task", () => {
const { createDelegateTask } = require("./tools")
let launchCalled = false
const launchedTask = {
id: "task-custom-unstable",
sessionID: "ses_custom_unstable",
description: "Custom unstable task",
agent: "sisyphus-junior",
status: "running",
}
const mockManager = {
launch: async () => {
launchCalled = true
return {
id: "task-custom-unstable",
sessionID: "ses_custom_unstable",
description: "Custom unstable task",
agent: "sisyphus-junior",
status: "running",
}
return launchedTask
},
getTask: () => launchedTask,
}
const mockClient = {