Skip to content

Codex turn-diff tree refs break libgit2-based Git clients #7297

Closed

Description

@elachlan

After using Codex in a Git repository, libgit2-based clients can fail when browsing refs.

In my case, TortoiseGit's "Browse References" failed with:

Get refs failed: libgit2 returned: the requested type does not match the type in the ODB

The repo contained many local Codex refs under:

.git/refs/codex/turn-diffs/

Running:

git for-each-ref --format="%(refname) %(objectname) %(objecttype)" refs/codex/turn-diffs

showed that these refs point directly to Git tree objects, for example:

refs/codex/turn-diffs/checkpoints/... d1385fb55aef5f5e121dda8f44de1f9c6b9720b3 tree
refs/codex/turn-diffs/captures/.../base 2033976581293cb7624fbd566bed1154125af248 tree

Normal branch and remote refs pointed to commits.
git fsck --full --no-reflogs did not report repository corruption. Deleting the local Codex turn-diff refs fixed the issue:

git for-each-ref --format="%(refname)" refs/codex/turn-diffs |
  ForEach-Object { git update-ref -d $_ }

Related:

Activity

  1. carlosmn commented on Jun 16, 2026

    @carlosmn
    Member

    Are you sure this breaks libgit2 and it's not tortoise assuming that a reference points to a commit and asking for that?

    Have you tried it with any other implementation, or have a reproduction just using libgit2?

  2. elachlan commented on Jun 16, 2026

    @elachlan
    Author

    @carlosmn I am not sure of anything. I've raised issues in all three projects.

  3. elachlan commented on Jun 17, 2026

    @elachlan
    Author

    @carlosmn tortoisegit in-fact does have the problem:

    "Reference Browser" we load all references and try to load metadata for the columns. Here, we check whether the reference is a symbolic link or a tag and the fallback is to treat it as a commit.

    But anther codex user ran into the same problem using vscode: openai/codex#28241 (comment)

  4. carlosmn commented on Jun 17, 2026

    @carlosmn
    Member

    That looks like a completely different issue where the server did not send all the objects it should have, or the local repository was corrupted in some other way. Neither of that seems like a libgit2 issue.

  5. elachlan commented on Jun 18, 2026

    @elachlan
    Author

    Closing this as a fix has been submitted to TortoiseGit and the other issue seems to be directly a git issue.

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