You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(claude-store): the #1645 attach-behind-options test fails on macOS #1971
On macOS this test fails on main. CI has no macOS runner, so nobody noticed.
Reproduction
The test MacBook Air (macOS 27.0.1 arm64, Bun 1.4.3), a fresh clone of origin/main 7ab4bde0b:
bun install --frozen-lockfile
bun test server/claude-store.test.ts -t 'reads .attach. behind options only'
It failed on 3 of 3 runs, and fails the same way with the #1404 branch applied:
445 | expect(await claudeAttachSession(dir, background.pid, behind)).toBeNull();
error: expect(received).toBeNull()
Received: {
session: null,
}
(fail) a claude attach pane's job (#1645) > reads `attach` behind options only from a client whose environment is no background session's
{ session: null } is the answer for an environment that cannot be read. So on macOS, darwinProcess.environment (sysctl KERN_PROCARGS2) seems to read nothing for the test's /bin/sh -c 'echo ready; read line' client. A likely cause is that /bin/sh is a platform binary that the kernel does not let us read. This is unconfirmed. A test-owned client binary (a Bun stand-in), like the one hermes.contract.test.ts uses on macOS, would separate the fixture from the code.
Found while verifying #1404 on eamac. It is not caused by that change.
The CI job "Native macOS session identity" (macos-15 runner) runs this file and passes it, for example on #1980. The failure seen on eamac is on macOS 27.0.1, so it looks specific to the newer macOS.
Still reproduces on current main (checked for the device sweep).
Machine: eamac, macOS 27.0.1 (26A434), Bun 1.4.3. Code: a fresh clone of origin/main 4d5edf38 in /tmp, bun install --frozen-lockfile.
Steps: bun test server/claude-store.test.ts -t 'reads .attach. behind options only'.
Result: 3 of 3 runs fail at claude-store.test.ts:446 with Received: { session: null }.
This supports the platform-binary guess. On the same Mac, ps -E shows no environment for a /bin/sh -c ... child started with FOO_MARK=shmark. For a bun -e ... child started with FOO_MARK=bunmark, it shows FOO_MARK=bunmark. So macOS 27 withholds a platform binary's environment, and the fixture's /bin/sh client reads as "environment unreadable". A test-owned client (a Bun stand-in, as hermes.contract.test.ts uses) should separate the fixture from the code. Left open for that fix.
Activity
devswha commentedon Oct 26, 2026
The CI job "Native macOS session identity" (macos-15 runner) runs this file and passes it, for example on #1980. The failure seen on eamac is on macOS 27.0.1, so it looks specific to the newer macOS.
fix(server): read macOS process starts and terminals from the kernel,…
devswha commentedon Oct 28, 2026
Still reproduces on current main (checked for the device sweep).
4d5edf38in /tmp,bun install --frozen-lockfile.bun test server/claude-store.test.ts -t 'reads .attach. behind options only'.Received: { session: null }.This supports the platform-binary guess. On the same Mac,
ps -Eshows no environment for a/bin/sh -c ...child started withFOO_MARK=shmark. For abun -e ...child started withFOO_MARK=bunmark, it showsFOO_MARK=bunmark. So macOS 27 withholds a platform binary's environment, and the fixture's/bin/shclient reads as "environment unreadable". A test-owned client (a Bun stand-in, as hermes.contract.test.ts uses) should separate the fixture from the code. Left open for that fix.test(claude-store): use a Bun stand-in client in the attach-behind-op…