Reproduction for earendil-works/pi#9073, verified against commit e44d75c20a51142abc056c243b13c1d7bb4be687.
The patch adds one regression test to packages/agent/test/harness/jsonl-session-repo.test.ts. It fixes the clock, creates the same explicit ID in two distinct cwd values whose encoded directory names collide, and requires distinct physical paths and cwd-scoped discovery.
From the repository root, with the patch file in that directory:
git apply jsonl-session-repo-cwd-collision.patch
cd packages/agent
node "$(git rev-parse --show-toplevel)/node_modules/vitest/dist/cli.js" --run test/harness/jsonl-session-repo.test.ts --reporter verboseAgainst the commit above, the seven existing cases pass and the added regression fails during the second create():
Session already exists: same
The error originates in JsonlSessionRepo.assertSessionIdAvailable(). See failure.txt for the failure summary.