fix(coding-agent): scoped python kernel cleanup to sessions

scoped retained-kernel ownership to agent sessions and cleaned it up on session disposal

cleaned up warmed python owners on session startup failure and rejected new direct and tool-based python starts during disposal, including async hook, preflight, and warmup races
This commit is contained in:
Carl
2026-04-12 13:29:17 +02:00
parent f96422d911
commit 379064a0c9
18 changed files with 3593 additions and 1156 deletions
@@ -34,9 +34,10 @@ class FakeKernel {
return this.#result;
}
async shutdown(): Promise<void> {
async shutdown(): Promise<{ confirmed: boolean }> {
this.shutdownCalls += 1;
this.#alive = false;
return { confirmed: true };
}
async ping(): Promise<boolean> {
@@ -174,9 +175,11 @@ describe("executePython session lifecycle", () => {
kernelA.shutdown = async () => {
shutdownCount += 1;
return { confirmed: true };
};
kernelB.shutdown = async () => {
shutdownCount += 1;
return { confirmed: true };
};
await executePython("print('one')", { kernelMode: "per-call" });