Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

test(mcp): accept a lost close_pane reply when magmux exits at once

Jack Rudenko46354580a3f4
diff --git a/packages/cli/src/pane/magmux-client.test.ts b/packages/cli/src/pane/magmux-client.test.ts
index 0e587b65..999f1311 100644
--- a/packages/cli/src/pane/magmux-client.test.ts
+++ b/packages/cli/src/pane/magmux-client.test.ts
@@ -99,7 +99,11 @@ describe.skipIf(!MAGMUX)(
const m = startMagmux("sleep 30");
const c = await MagmuxClient.connect(m.sock);
const disc = new Promise<{ sawShutdown: boolean }>((r) => c.on("disconnected", r));
- expect((await c.request({ type: "close_pane", pane: 0, force: true })).ok).toBe(true);
+ // magmux exits once its last pane is closed, and under load its EOF can beat the
+ // reply (seen once in a full bun 1.4.0 run): a lost reply is client_lost, never an
+ // error reply. The shutdown, exit and socket checks below prove the close.
+ const r = await c.request({ type: "close_pane", pane: 0, force: true });
+ expect(r.ok || r.code === "client_lost").toBe(true);
expect((await disc).sawShutdown).toBe(true);
expect(await waitForExit(m.proc, 5000)).toBe(true);
expect(existsSync(m.sock)).toBe(false);