Windows: overlong Codex checkpoint ref paths break git fetch
Summary
Codex Desktop on Windows creates loose internal checkpoint refs whose paths can exceed the Windows path limit. Once that happens, ordinary Git operations such as git fetch origin develop --prune fail because Git reads the ref as an invalid zero SHA.
Environment
- Codex Desktop for Windows
- Windows NT 10.0.26200.0
- Git 2.54.0.windows.1
- PowerShell 7.6.4
Ref layout
The failing refs use this shape:
.git/refs/codex/turn-diffs/checkpoints/<64-hex>/<64-hex>/<timestamp>/<uuid>
Two such refs were present. Their leaf files each contained a valid 40-character SHA.
Actual behavior
fatal: bad object refs/codex/turn-diffs/checkpoints/<redacted>
error: <remote> did not send all necessary objects
git fsck --full --no-dangling explained the underlying failure:
warning: failed to stat '.git/refs/codex/turn-diffs/checkpoints/<redacted>': Filename too long
error: refs/codex/turn-diffs/checkpoints/<redacted>: invalid sha1 pointer 0000000000000000000000000000000000000000
The refs were not logically corrupt:
- reading each loose ref file through the Windows filesystem returned a valid SHA;
git cat-file -e <sha>^{object}succeeded;git rev-list --objects --missing=print <sha>reported no missing objects.
Limiting fetch negotiation with --negotiation-tip=origin/develop or fetch.negotiationAlgorithm=noop did not help, because Git still validates the overlong local ref path.
Workaround that confirmed the cause
Moving only the .git/refs/codex/turn-diffs/checkpoints directory to a short, recoverable path outside .git/refs immediately allowed the same git fetch origin develop --prune command to succeed. No normal branches, tags, or Git objects were changed.
Expected behavior
Codex internal checkpoint storage should not create Git ref paths that exceed Windows path limits. Possible approaches include a flatter hashed layout, packed refs, shorter identifiers, or long-path-aware filesystem handling.
Reproduction outline
- Use Codex Desktop on Windows in a repository until internal turn-diff checkpoint refs are created.
- Observe nested loose refs under
.git/refs/codex/turn-diffs/checkpoints/. - Once the complete path exceeds the Windows limit, run
git fetch origin develop --prune. - Fetch fails with
bad object refs/codex/turn-diffs/checkpoints/...;git fsckreportsFilename too long.