fix(coding-agent): addressed python cleanup review findings

fixed retained-kernel restart and owner cleanup edge cases during recovery and disposal

tracked async user_python hooks during disposal-sensitive execution paths and hardened startup warmup tracking

strengthened cleanup and kernel lifecycle regressions to remove deadlocks, false positives, and timing flakes
This commit is contained in:
Carl
2026-04-12 14:45:19 +02:00
parent 379064a0c9
commit 2b480f7da1
11 changed files with 278 additions and 122 deletions
@@ -3,6 +3,7 @@ import { disposeAllKernelSessions, executePython } from "@oh-my-pi/pi-coding-age
import {
type KernelExecuteOptions,
type KernelExecuteResult,
type KernelShutdownResult,
PythonKernel,
} from "@oh-my-pi/pi-coding-agent/ipy/kernel";
@@ -34,7 +35,7 @@ class FakeKernel {
return this.#result;
}
async shutdown(): Promise<{ confirmed: boolean }> {
async shutdown(): Promise<KernelShutdownResult> {
this.shutdownCalls += 1;
this.#alive = false;
return { confirmed: true };
@@ -173,11 +174,11 @@ describe("executePython session lifecycle", () => {
return kernels.shift() as unknown as PythonKernel;
};
kernelA.shutdown = async () => {
kernelA.shutdown = async (): Promise<KernelShutdownResult> => {
shutdownCount += 1;
return { confirmed: true };
};
kernelB.shutdown = async () => {
kernelB.shutdown = async (): Promise<KernelShutdownResult> => {
shutdownCount += 1;
return { confirmed: true };
};