Skip to content

test(claude-store): the #1645 attach-behind-options test fails on macOS #1971

Closed

Description

@devswha

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.

Activity

  1. devswha commented on Oct 26, 2026

    @devswha
    OwnerAuthor

    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.

  2. devswha commented on Oct 28, 2026

    @devswha
    OwnerAuthor

    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.

  3. added a commit that references this issue on Oct 28, 2026
    29c152c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions