fix(hopper): stop Linux demo children when the REA owner exits (#2499)
Bind the owned demo helper to REA's private stdin stream and unwind child cleanup on EOF during startup or analysis. Verify graceful and SIGKILL owner exit through real CLI/MCP workflows and preserve unrelated processes. Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
This commit is contained in:
@@ -31,6 +31,9 @@ const dialogDetectionFixturePath = fileURLToPath(
|
||||
const cleanupTimeoutFixturePath = fileURLToPath(
|
||||
new URL("../../../fixtures/hopperCleanupTimeout.py", import.meta.url),
|
||||
);
|
||||
const ownerLifetimeFixturePath = fileURLToPath(
|
||||
new URL("../../../fixtures/hopperOwnerLifetime.py", import.meta.url),
|
||||
);
|
||||
|
||||
type DiagnosticOverrides = Partial<
|
||||
Omit<HopperStartupDiagnostic, "failure_code" | "status">
|
||||
@@ -107,6 +110,23 @@ describe("Hopper demo dialog detection", () => {
|
||||
});
|
||||
|
||||
describe("Hopper process cleanup", () => {
|
||||
it.skipIf(process.platform !== "linux").each(["startup", "ready"])(
|
||||
"reaps only its own children when the owner pipe closes during %s",
|
||||
(phase) => {
|
||||
const result = spawnSync(
|
||||
"/usr/bin/python3",
|
||||
[ownerLifetimeFixturePath, helperPath, phase],
|
||||
{ encoding: "utf8", timeout: 10_000 },
|
||||
);
|
||||
expect(result.status, result.stderr).toBe(0);
|
||||
expect(JSON.parse(result.stdout)).toEqual({
|
||||
phase,
|
||||
children_cleaned: true,
|
||||
sentinel_alive: true,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform !== "linux")(
|
||||
"kills a child that ignores SIGTERM after the bounded timeout",
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user