Skip to content

ci: invoking-home snapshots miss same-size writes within one timestamp tick #4472

Open

Description

@schlessera

Context

claudeHomeSnapshot (scripts/test-home.ts:7) records inode, mode, size, mtimeNs and ctimeNs at :16, then createInvokingTestHome compares that metadata snapshot to detect writes. Same-size writes within the filesystem's timestamp granularity can leave every recorded value unchanged. The guard then accepts modified sentinel bytes.

During #4314's full unit proof, all three existing overwrite tests in tests/test-home.test.ts:8 and :42 failed: the snapshot stayed identical after a same-size overwrite, and assertUnchanged did not throw TEST_WROTE_INVOKING_CLAUDE_HOME. Both test and implementation are byte-identical to origin/main.

At origin/main 7e861bdb3, with main's own preload in a separate Ubuntu 24.04 VM checkout, ten repetitions of those three cases produced 28 failures out of 30 cases. This is separate from the workspace alias walk in #4471, but shares the assumption that unchanged timestamps imply unchanged state.

Out of scope

No #4314 native-execution authority or transport changes, workflow changes, real invoking-home data, or product HOME fallback changes. Filed without a milestone as a pre-existing main failure.

Scope

Make the existing disposable invoking-home guard detect same-size byte changes independently of timestamp changes. Preserve environment-descriptor restoration and the rule that symlinks are not followed outside the guarded tree. Retain only evidence needed for comparison; do not log file contents.

Acceptance criteria

  • Same-size changed bytes are detected even when inode, size, mtimeNs and ctimeNs are equal.
  • Add deterministic proof of equal metadata with different real file bytes; do not add sleeps to hide the blind spot.
  • Original files and environment property descriptors remain restored, and symlink containment remains unchanged.
  • Removing the content-sensitive comparison makes the intended overwrite assertion fail.

Verification

Baseline: bun run test tests/test-home.test.ts -t 'same-size overwrite|snapshots detect' --rerun-each 10 on the main commit above with main's preload. Run the whole test-home file and launcher/host-storage consumers after the fix. Preserve workflow budgets and product timings.

Contract impact

No CLI/MCP/schema change. This repairs the existing test harness integrity check.

Activity

  1. added
    type: fixSomething is broken and must behave the way it is documented.
    area: ciCI workflows, the gates they run, release scripts, packaging.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Nov 22, 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

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ciCI workflows, the gates they run, release scripts, packaging.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: fixSomething is broken and must behave the way it is documented.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions