fix(background): Wave 2 - fix interrupt status checks, display text, error recovery grace, LSP JSONC

- fix(background): include "interrupt" status in all terminal status checks (3 files)
- fix(background): display "INTERRUPTED" instead of "CANCELLED" for interrupted tasks
- fix(cli): add error recovery grace period in poll-for-completion
- fix(lsp): use JSONC parser for config loading to support comments

All changes verified with tests and typecheck.
This commit is contained in:
YeonGyu-Kim
2026-02-10 19:20:59 +09:00
parent 47595f21a6
commit 73898b88b4
11 changed files with 268 additions and 13 deletions
+17 -7
View File
@@ -5,6 +5,7 @@ import { checkCompletionConditions } from "./completion"
const DEFAULT_POLL_INTERVAL_MS = 500
const DEFAULT_REQUIRED_CONSECUTIVE = 3
const ERROR_GRACE_CYCLES = 3
export interface PollOptions {
pollIntervalMs?: number
@@ -21,19 +22,28 @@ export async function pollForCompletion(
const requiredConsecutive =
options.requiredConsecutive ?? DEFAULT_REQUIRED_CONSECUTIVE
let consecutiveCompleteChecks = 0
let errorCycleCount = 0
while (!abortController.signal.aborted) {
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs))
// ERROR CHECK FIRST — errors must not be masked by other gates
if (eventState.mainSessionError) {
console.error(
pc.red(`\n\nSession ended with error: ${eventState.lastError}`)
)
console.error(
pc.yellow("Check if todos were completed before the error.")
)
return 1
errorCycleCount++
if (errorCycleCount >= ERROR_GRACE_CYCLES) {
console.error(
pc.red(`\n\nSession ended with error: ${eventState.lastError}`)
)
console.error(
pc.yellow("Check if todos were completed before the error.")
)
return 1
}
// Continue polling during grace period to allow recovery
continue
} else {
// Reset error counter when error clears (recovery succeeded)
errorCycleCount = 0
}
if (!eventState.mainSessionIdle) {