Windows: turn-diff checkpoint refs exceed path limit and break Git operations

Open 💬 0 comments Opened Aug 8, 2026 by Luligu

Description

The Codex VS Code extension repeatedly creates loose Git refs under refs/codex/turn-diffs/checkpoints whose filesystem paths exceed the normal Windows path limit. Git for Windows then cannot read those refs and treats them as invalid all-zero refs. This breaks ordinary Git operations, including fetch.

Deleting the checkpoint directory repairs the repository temporarily, but Codex recreates another overlong checkpoint ref on a later turn.

Environment

  • OS: Microsoft Windows NT 10.0.26200.0
  • Codex / ChatGPT VS Code extension: 26.803.41515
  • Git: 2.55.0.windows.3
  • Repository absolute path before .git: approximately 66 characters
  • Repository-local core.longpaths: unset

Actual behavior

Codex constructs checkpoint refs with this shape:

refs/codex/turn-diffs/checkpoints/
<SHA-256 checkpoint key>/
<SHA-256 turn ID>/
<timestamp>/
<UUID>

A reproduced loose-ref filesystem path was 279 characters long.

Git then fails with errors such as:

fatal: git show-ref: bad ref refs/codex/turn-diffs/checkpoints/... (0000000000000000000000000000000000000000)
fatal: bad object refs/codex/turn-diffs/checkpoints/...
error: https://github.com/... did not send all necessary objects
warning: failed to stat '.git/refs/codex/turn-diffs/checkpoints/...': Filename too long
error: refs/codex/turn-diffs/checkpoints/...: invalid sha1 pointer 0000000000000000000000000000000000000000

The file itself contains a valid tree object ID, and that object exists. The failure is caused by Git for Windows being unable to address the overlong loose-ref path.

Steps to reproduce

  1. Open a Git repository at a typical Windows path, for example:

C:\Users\<user>\GitHub\<repository>

  1. Use Codex in the VS Code extension for turns that retain turn-diff checkpoints.
  2. Inspect .git\refs\codex\turn-diffs\checkpoints.
  3. Run git show-ref or fetch the repository.
  4. Observe an overlong checkpoint path and an invalid/bad ref error.
  5. Delete the checkpoint directory externally.
  6. Continue using Codex; the bad checkpoint ref is created again.

Expected behavior

Codex's internal checkpoint implementation must not make the user's repository invalid or interfere with normal Git commands on any supported platform.

Checkpoint refs should use a substantially shorter naming scheme (for example, fixed-length abbreviated IDs), or checkpoint metadata should be stored outside the repository's loose-ref namespace. Cleanup should also be robust when an older malformed ref already exists.

Impact

This is not cosmetic. It repeatedly prevents repository fetches and causes Git integrity commands to report invalid refs. Recovery requires closing Codex and manually deleting internal refs from .git.

Workaround

The only reliable temporary recovery found is:

  1. Close Codex so it cannot immediately recreate the ref.
  2. Delete .git\refs\codex\turn-diffs\checkpoints using a Windows long-path-aware filesystem command.
  3. Re-run git show-ref.

Persistently enabling core.longpaths is not an acceptable product fix: it changes user repository configuration and does not address Codex generating unnecessarily overlong internal ref names.

View original on GitHub ↗