fix(background-agent): use correct OpenCode session status for stale guard
OpenCode uses 'busy'/'retry'/'idle' session statuses, not 'running'. The stale timeout guard checked for type === 'running' which never matched, leaving all background tasks vulnerable to stale-kill even when their sessions were actively processing. Change sessionIsRunning to check type !== 'idle' instead, protecting busy and retrying sessions from premature termination.
This commit is contained in:
@@ -80,7 +80,8 @@ export async function checkAndInterruptStaleTasks(args: {
|
||||
const sessionID = task.sessionID
|
||||
if (!startedAt || !sessionID) continue
|
||||
|
||||
const sessionIsRunning = sessionStatuses?.[sessionID]?.type === "running"
|
||||
const sessionStatus = sessionStatuses?.[sessionID]?.type
|
||||
const sessionIsRunning = sessionStatus !== undefined && sessionStatus !== "idle"
|
||||
const runtime = now - startedAt.getTime()
|
||||
|
||||
if (!task.progress?.lastUpdate) {
|
||||
|
||||
Reference in New Issue
Block a user