fix: Extension frozen on debug mode

This commit is contained in:
Johnny Amancio
2026-04-16 20:06:51 +02:00
parent c78f492025
commit f0ceacaa1d
2 changed files with 8 additions and 6 deletions
@@ -173,16 +173,13 @@ export class SdkSSEAdapter {
this.resetHeartbeat(attempt)
// The SDK yields GlobalEvent = { directory, payload: Event | SyncEvent* }.
// We only forward the non-sync Event union; sync replay events are handled elsewhere.
// The SDK yields GlobalEvent = { directory, payload: Event }.
const globalEvent = event as GlobalEvent
const payload = globalEvent.payload
const type = (payload as { type: string }).type
const type = (globalEvent.payload as { type: string }).type
if (type !== "server.heartbeat") {
console.log("[Kilo New] SSE: 📨 Event:", type)
}
if (type === "sync") continue
this.notifyEvent(payload as Event)
this.notifyEvent(globalEvent.payload as Event)
}
console.log("[Kilo New] SSE: 📭 Stream ended normally")
@@ -67,7 +67,12 @@ export class ServerManager {
return new Promise((resolve, reject) => {
console.log("[Kilo New] ServerManager: 🎬 Spawning CLI process:", cliPath, ["serve", "--port", "0"])
const claudeCompat = vscode.workspace.getConfiguration("kilo-code.new").get<boolean>("claudeCodeCompat", false)
// kilocode_change - pin cwd to a workspace folder (or $HOME) so the CLI doesn't inherit
// the extension host's cwd, which is "/" under F5 debug and stalls cwd-dependent init.
const spawnCwd =
vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? process.env.HOME ?? require("os").homedir()
const serverProcess = spawn(cliPath, ["serve", "--port", "0"], {
cwd: spawnCwd, // kilocode_change
env: {
...process.env,
KILO_SERVER_PASSWORD: password,