fix(coding-agent): interrupt cell on timeout instead of killing kernel

A per-cell timeout used to kill the persistent Python kernel, losing
all session state. The kernel.ts timeout path now sends SIGINT first
(letting the cell raise KeyboardInterrupt) and only escalates to
shutdown after a 5s grace window if the interrupt is ignored.

KernelExecuteResult gains an optional kernelKilled flag (defaulting to
false, propagated by the escalation timer and the unexpected-exit
handler). executor.ts formats two distinct timeout annotations: one
that says the kernel is still alive and reset:true would clear state,
one that says the kernel was killed and will be recreated.
This commit is contained in:
can1357
2026-05-21 14:51:21 +09:00
committed by Can Bölük
parent fd42c8da26
commit 027dbb4900
8 changed files with 42 additions and 15 deletions
@@ -144,7 +144,7 @@ describe("executePython (per-call)", () => {
expect(result.cancelled).toBe(true);
expect(result.exitCode).toBeUndefined();
expect(result.output).toContain("Command timed out after 2 seconds");
expect(result.output).toContain("eval cell timed out after 2s");
expect(shutdownCalls).toBe(1);
});
});