Codex Desktop keeps running Git turn-diff snapshot tasks on stale repos/worktrees and repeatedly fails, likely contributing to window instability

Open 💬 0 comments Opened Jul 4, 2026 by henrydontbbai

# Codex Desktop keeps running Git turn-diff snapshot tasks on stale repos/worktrees and repeatedly fails, likely contributing to window instability

Summary

On my Windows machine, Codex Desktop continues to run background Git turn-diff / checkpoint tasks against stale repositories, old worktrees, and historical directories that are not the current active workspace.

These tasks repeatedly fail with errors like:

  • Failed to retain a turn diff tree snapshot
  • Failed to complete turn diff analytics capture

This appears to be a Codex Desktop background workspace/repo-watcher issue rather than a problem in the active project itself. The repeated failures may be contributing to window instability / apparent "flash crash" behavior after the app stays open for a few minutes.

Environment

  • Platform: Windows
  • Date observed: July 4, 2026
  • Active workspace at time of testing: C:\Users\<user>\Documents\<active-workspace>

Important context

I already identified and fixed a separate local root cause earlier the same day:

  • there was an accidental C:\.git
  • which caused C:/ to be treated as a repository root
  • that issue has been removed

After fixing that, Codex no longer treats C:/ as the active repo root, but the turn-diff snapshot failures still continue.

So this report is not about the earlier C:/-as-repo problem.
This is about Codex Desktop continuing to watch and process stale historical repos/worktrees in the background.

Actual behavior

Codex Desktop continues to run background Git analytics / checkpoint operations against directories that are not the current active workspace.

Observed failure pattern includes background commands like:

  • git update-ref refs/codex/turn-diffs/checkpoints/...
  • returning exitCode=128

Observed error messages include:

  • Failed to retain a turn diff tree snapshot
  • Failed to complete turn diff analytics capture

The failures appear on historical directories such as:

  • C:/Users/<user>/Documents/<historical-projects>/...
  • C:/Users/<user>/Documents/<historical-projects>/<old-worktree>
  • C:/Users/<user>/.codex/skills/...

At the same time, logs show repeated background watcher/origin scans like:

  • Starting git repo watcher
  • worker-complete dirCount=15
  • worker-complete dirCount=14
  • worker-complete dirCount=29

This makes it look like Codex is still holding onto a broad set of historical repo contexts and trying to process them even though they are not the active workspace.

Expected behavior

Codex Desktop should:

  • scope Git turn-diff / snapshot work to the currently relevant active workspace(s)
  • avoid repeatedly processing stale historical repos or old worktrees unless explicitly reopened
  • gracefully skip incompatible or non-standard repos/worktrees
  • avoid repeated noisy failures when internal checkpoint refs cannot be updated
  • ensure these background failures do not affect renderer/window stability

Why this seems like a Codex Desktop issue

This does not appear to be a normal user Git workflow failure.

Reasons:

  1. The failing operations are Codex internal background tasks, not user-invoked Git commands.
  2. The failures occur mostly on stale repos / old worktrees / historical directories, not the active workspace.
  3. Even if a historical repo is in an unusual state, Codex should degrade gracefully instead of repeatedly failing in the background.

So the stale repo state may be a trigger, but the robustness issue appears to be in Codex Desktop's background repo-watching / turn-diff handling.

Possible areas to investigate

  • source of repo watcher directory enumeration
  • why stale historical repos/worktrees remain eligible for turn-diff analytics
  • whether old worktrees and non-active repos should be automatically excluded
  • retry / backoff / cleanup behavior after update-ref checkpoint failures
  • whether failed turn-diff tasks can accumulate and impact renderer stability over time

Impact

  • persistent background log noise
  • unnecessary Git activity on non-active directories
  • possible memory / task buildup over time
  • possible contribution to the app window disappearing / becoming unstable after several minutes

Notes

There is also a separate remote SSH auto-reconnect issue on this machine, but that is a different problem and should be tracked separately.
This issue is specifically about background Git turn-diff snapshot failures on stale repos/worktrees.

View original on GitHub ↗