fix(server): checkpoint reuse handles filenames starting with a colon #42472
main fromrefs/pull/42472/head·merged by juliusmarminge View on GitHubProblem#
Checkpoint capture reuses blobs of unchanged untracked files (apps/server/src/vcs/checkpointUntrackedBlobs.ts) and re-checks remembered paths with git check-ignore -z --stdin, which reads a leading : as pathspec magic. A remembered :ignored file added to .gitignore later is missed (exit 1) and re-inserted into the next checkpoint, so that checkpoint holds an ignored file a fresh capture would not. A remembered :(magic) file makes git check-ignore fail (fatal: Invalid pathspec magic; on the real path its stderr exceeds the output cap, so reuse fails), dropping reuse for every file in that workspace on every capture.
Change#
In apps/server/src/vcs/checkpointUntrackedBlobs.ts, I prefixed each git check-ignore stdin path with ./ and stripped one leading ./ from each echoed path—the same fix #42333 merged in WorkspaceEntries.ts. --literal-pathspecs, GIT_LITERAL_PATHSPECS, and :(literal) are rejected by git check-ignore (exit 128). git check-attr (the attribute read beside it) reads stdin paths literally, so I left it unchanged. In apps/server/src/vcs/GitVcsDriver.test.ts, I added two cases to the untracked-blob reuse table (:large.txt becoming ignored and :(magic) staying reused), skipped on Windows where : is not a legal filename.
Scope#
Bug fix for wrong checkpoint contents and dropped untracked-blob reuse on colon-prefixed names. No issue: small fix for an obvious bug, matching #42333.
Verification#
Steps (Linux): In three temp repos with 64 MiB untracked files (so staging crosses the reuse threshold after settling), run GitVcsDriver.checkpoints.captureCheckpoint three times—writing .gitignore (:ignored) before capture 3 in A and C—and compare the reusing driver's tree against a fresh driver's tree on both commits.
Setup: Linux, Git 2.53.0, Node 26.13.1; server-only (+5/-2 prod, +18/-2 test), no UI change, text evidence only.
| Scenario (capture 3) | 68d6ef6 | 62cff82 |
|---|---|---|
A: :ignored, plain.bin + .gitignore | exit 1 ([]), reuses both, :ignored in tree (trees equal: false) | exit 0 (["./:ignored"]), reuses ["plain.bin"] (trees equal: true) |
B: :(magic), plain.bin (unchanged) | stderr cap error (52 > 19 B), reuses nothing (trees equal: true) | exit 1 ([]), reuses [":(magic)","plain.bin"] (trees equal: true) |
C: :ignored, :(magic), plain.bin + .gitignore | stderr cap error (52 > 28 B), reuses nothing (trees equal: true) | exit 0 (["./:ignored"]), reuses [":(magic)","plain.bin"] (trees equal: true) |
Tests (Node 26.13.1): On 68d6ef6, both new cases fail. On 62cff82, all 13 reuse cases pass three times. Removing the ./ strip on 62cff82 fails the new ignored case and the existing "it became ignored" case. vp run check:changed passes (format, lint, knip, graphql, typecheck, tests).
Test and script output
# 68d6ef6 — script (capture 3)
A: check-ignore stdin=[":ignored","plain.bin"] exit=1 stdout=[] | reused=[":ignored","plain.bin"] | trees equal: false
B: check-ignore stdin=[":(magic)","plain.bin"] FAILED VcsProcessOutputLimitError stream=stderr maxBytes=19 observedBytes=52
C: check-ignore stdin=[":(magic)",":ignored","plain.bin"] FAILED VcsProcessOutputLimitError stream=stderr maxBytes=28 observedBytes=52
# 62cff82 — script (capture 3)
A: check-ignore stdin=["./:ignored","./plain.bin"] exit=0 stdout=["./:ignored"] | reused=["plain.bin"] | trees equal: true
B: check-ignore stdin=["./:(magic)","./plain.bin"] exit=1 stdout=[] | reused=[":(magic)","plain.bin"] | trees equal: true
C: check-ignore stdin=["./:(magic)","./:ignored","./plain.bin"] exit=0 stdout=["./:ignored"] | reused=[":(magic)","plain.bin"] | trees equal: true
# 68d6ef6 — new tests
Tests 2 failed | 11 passed | 114 skipped (127)
# 62cff82 — mutant (no ./ strip)
Tests 2 failed | 11 passed | 114 skipped (127)
# 62cff82 — 3x runs
Tests 13 passed | 114 skipped (127) (x3)
Not checked: Windows (new cases skipped there), macOS, a full app turn (the script calls the same driver method a turn's capture calls).
Who tested: An AI agent ran every check.
Generated with Gemini 4 Neon in T3 Code Nightly
Evidence#
Evidence captured from real T3 servers on Linux, Git 2.43.0, using fresh databases and identical synthetic repositories. Run three unchanged replay turns with settled 64 MiB
:ignoredandplain.binfiles; ignore:ignoredbefore turn 4; also ignoreplain.binand create:(magic)before turn 5; continue through turn 9. Wait for every checkpoint to finish.:ignored; turns 7 and 9 failcheck-ignorewith exit 128, and turns 7–9 perform no reuse update.:ignored; turns 6–9 successfully reuse unchanged blobs with:(magic)present.Reproduction driver · Capture formatter and fresh-index control · Sanitized runtime logs
Proof produced by gpt-6.1-sol through the Codex harness.