Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
test(team): fail the SIGINT test when the CLI does not reap its panes
Jack Rudenko1d736b6ea0f9
diff --git a/packages/cli/src/team-cli-signal.test.ts b/packages/cli/src/team-cli-signal.test.tsindex 6ba69f2f..90e6b729 100644--- a/packages/cli/src/team-cli-signal.test.ts+++ b/packages/cli/src/team-cli-signal.test.ts@@ -10,6 +10,7 @@import { afterEach, beforeEach, describe, expect, it } from "bun:test";import { existsSync, mkdirSync, readFileSync } from "node:fs";import { join } from "node:path";+import { orphanReport } from "./pane/test-helpers/hermetic-env.js";import {MAGMUX,NO_MAGMUX_MESSAGE,@@ -34,17 +35,21 @@ afterEach(async () => {expect(report).toEqual({ processes: [], files: [] });});-function slotStates(sessionPath: string): string[] {+function slotRows(sessionPath: string): Array<{ state: string; error?: { reason?: string } }> {try {const status = JSON.parse(readFileSync(join(sessionPath, "status.json"), "utf8")) as {- models: Record<string, { state: string }>;+ models: Record<string, { state: string; error?: { reason?: string } }>;};- return Object.values(status.models).map((m) => m.state);+ return Object.values(status.models);} catch {return [];}}+function slotStates(sessionPath: string): string[] {+ return slotRows(sessionPath).map((m) => m.state);+}+describe.skipIf(!MAGMUX)("claudish team run — signals", () => {it("SIGINT reaps every pane and exits 130", async () => {// validateSessionPath wants the session under the cwd: run the CLI from the temp dir.@@ -88,10 +93,25 @@ describe.skipIf(!MAGMUX)("claudish team run — signals", () => {const sentAt = Date.now();proc.kill("SIGINT");const code = await Promise.race([proc.exited, Bun.sleep(10_000).then(() => "hung")]);+ // Read at once: the pane watchers would clean up after a process that merely died+ // (D15), so only an immediate check proves the CLI's own reap ran.+ const left = orphanReport({ sockRoot: t.sockRoot });expect(code).toBe(130);+ // a HANDLED exit: Bun also reports 130 for a process KILLED by SIGINT, with+ // signalCode "SIGINT" and exitCode null+ expect(proc.signalCode).toBeNull();+ expect(proc.exitCode).toBe(130);// ≤ 3 s reap budget, plus process start-up slack.expect(Date.now() - sentAt).toBeLessThan(6_000);+ expect(left).toEqual({ processes: [], files: [] });+ // the shutdown reap cancelled every slot, and the record says so+ const rows = slotRows(sessionPath);+ expect(rows).toHaveLength(2);+ for (const r of rows) {+ expect(r.state).toBe("CANCELLED");+ expect(r.error?.reason).toBe("cancelled");+ }} finally {if (proc.exitCode === null) proc.kill("SIGKILL");await proc.exited;