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
@@ -0,0 +1,39 @@
import { describe, it, expect } from "bun:test"
import { writeFileSync, unlinkSync } from "fs"
import { join } from "path"
import { tmpdir } from "os"
import { loadJsonFile } from "./server-config-loader"
describe("loadJsonFile", () => {
it("parses JSONC config files with comments correctly", () => {
// given
const testData = {
lsp: {
typescript: {
command: ["tsserver"],
extensions: [".ts", ".tsx"]
}
}
}
const jsoncContent = `{
// LSP configuration for TypeScript
"lsp": {
"typescript": {
"command": ["tsserver"],
"extensions": [".ts", ".tsx"] // TypeScript extensions
}
}
}`
const tempPath = join(tmpdir(), "test-config.jsonc")
writeFileSync(tempPath, jsoncContent, "utf-8")
// when
const result = loadJsonFile<typeof testData>(tempPath)
// then
expect(result).toEqual(testData)
// cleanup
unlinkSync(tempPath)
})
})
+3 -2
View File
@@ -4,6 +4,7 @@ import { join } from "path"
import { BUILTIN_SERVERS } from "./constants"
import type { ResolvedServer } from "./types"
import { getOpenCodeConfigDir } from "../../shared"
import { parseJsonc } from "../../shared/jsonc-parser"
interface LspEntry {
disabled?: boolean
@@ -24,10 +25,10 @@ interface ServerWithSource extends ResolvedServer {
source: ConfigSource
}
function loadJsonFile<T>(path: string): T | null {
export function loadJsonFile<T>(path: string): T | null {
if (!existsSync(path)) return null
try {
return JSON.parse(readFileSync(path, "utf-8")) as T
return parseJsonc(readFileSync(path, "utf-8")) as T
} catch {
return null
}