Skip to content

provenance.test.ts intermittently fails with EEXIST after renaming its fixture root #172

Closed

Description

@ericlitman

Outcome

provenance.test.ts passes every time on an unchanged tree.

Why

On 2026-10-12, "filesystem rechecks reject a candidate workspace redirected to an untouched pinned copy" failed 3 times in about 14 gate runs on the operator Mac, once with no other gate running. Each failure was the same:

EEXIST: file already exists, symlink '<tmp>/pstack-provenance-XXXXXX-untouched' -> '<tmp>/pstack-provenance-XXXXXX'
  at .claude/skills/verify-open-pstack/scripts/provenance.test.ts:132

After rename(root, untouched) at line 131, root exists again by line 132, so something recreated it in between. Each failure cost a rerun of the whole static invariants step. core.fsmonitor is not set on this host.

Hypothesis to check first (unverified)

fixture() (lines 13-29) runs git init, git add and git commit in root. A detached git gc --auto or git maintenance started by the commit could still be writing under root/.git after the test renames root, which recreates the path. Disabling those in the fixture (for example -c gc.auto=0 -c maintenance.auto=false on the commit) would rule that in or out.

Acceptance criteria

  • The cause is named with evidence, such as a reproduction loop.
  • The fix removes it at the cause, with no retry and no sleep.
  • The test passes 200 consecutive runs on the operator Mac (bun test scripts/provenance.test.ts in a loop).

Files: .claude/skills/verify-open-pstack/scripts/provenance.test.ts

Source: batch 153 infrastructure ledger, 2026-10-12.

Current scope (2026-10-15)

Cause, confirmed: the git-ai daemon, not git gc or git maintenance. The global git config on studio2 and pro14 sets trace2.eventtarget to the git-ai daemon's socket. The daemon writes .git/ai/... and refs/notes/ai into each fixture repository after the git command exits.

  • The 2026-10-12 failures ran on pro14.
  • On pro14, unmodified main (f1c88d8) failed in 2 of 100 sequential runs.
  • A diagnostic copy of the test caught root/.git/ai/working_logs/initial/blobs/* and checkpoints.jsonl reappearing 19 to 31 ms after the rename.
  • A fixture whose git calls run with GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_NOSYSTEM=1 gets no git-ai writes.
  • The read-only git rev-parse, diff --quiet and ls-tree that production sourceHash() runs get none either.

Fix scope: test files only. Every git call the fixtures run themselves gets { PATH, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' }, in these three files:

  • provenance.test.ts
  • harness.test.ts, lines 128-131
  • verify.test.ts, its publisher diff fixture

pro14's temp folder shows git-ai recreating removed pstack-provenance-* and pstack-publish-test-* directories. pro14's daemon log also shows it working on the harness fixture.

Acceptance loop: 200 consecutive full-file runs on pro14, where the failure reproduces, and on studio2. With the fix applied, the pro14 diagnostic loop shows no recreation.

Activity

  1. added a commit that references this issue on Oct 16, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions