Codex Desktop on Windows exits after background git add -A runs against home directory

Open 💬 2 comments Opened Jun 9, 2026 by bilbillm

Summary

Codex Desktop on Windows repeatedly exits without a visible error while working in project-level workspaces under Documents\GitHub. The Windows AppX container is destroyed, and there is no Crashpad/WER crash dump.

The desktop logs show that, even while the active workspace is a normal project folder, background git snapshot/review jobs repeatedly run heavyweight git commands directly with cwd=C:/Users/<user>, including git add -A. If the user's home directory contains a .git folder, Codex attempts to index the whole home directory, including AppData/cache/runtime/node_modules paths. This produces long-path and permission errors and appears correlated with the desktop app disappearing.

This looks related to #19588 and #20933, but in this case the visible symptom is the entire Windows desktop app/container disappearing after some time.

Environment

  • OS: Windows 11
  • Codex Desktop package: OpenAI.Codex_26.602.4764.0_x64__2p2nqsd0c76g0
  • Git: git version 2.51.0.windows.1
  • Active workspaces when this happens: project folders under C:\Users\<user>\Documents\GitHub\...
  • Home directory also has a .git directory: C:\Users\<user>\.git

Observed Behavior

After some time (often tens of minutes to a couple of hours), Codex Desktop disappears without warning. Window and background processes exit together.

Windows AppModel-Runtime/Admin logs show the whole AppX container being destroyed:

2026-06-09 10:59:24 Launch process 7576 for package OpenAI.Codex_26.602.4764.0_x64__2p2nqsd0c76g0
2026-06-09 11:30:07 Destroyed desktop AppX container {1C2C6150-63AC-11F1-A44A-C0353219DD02}
2026-06-09 11:30:13 Launch process 32104 for package OpenAI.Codex_26.602.4764.0_x64__2p2nqsd0c76g0

There are no Codex Crashpad reports and no matching Windows Error Reporting crash dumps.

Relevant Codex Logs

Even after opening/resuming a project-level workspace, the desktop logs repeatedly show background git work using the home directory as the cwd:

warning [git] git.command.complete ... command="'C:\\Program Files\\Git\\cmd\\git.exe' -c core.hooksPath=NUL -c core.fsmonitor= add -A" cwd=C:/Users/<user> durationMs=98272 exitCode=128 failureReason=command_failed requestKind=review-summary source=review_model stderrBytes=11205 subcommand=add success=false

Another repeated command:

warning [git] git.command.complete ... command="'C:\\Program Files\\Git\\cmd\\git.exe' -c core.hooksPath=NUL -c core.fsmonitor= config --get remote.upstream.url" cwd=C:/Users/<user> exitCode=1 requestKind=gh-pr-status source=local_conversation_git_summary

When git add -A runs against the home directory, it tries to index runtime/cache paths and fails:

warning: could not open directory 'AppData/Local/Application Data/': Permission denied
warning: could not open directory 'AppData/Local/ElevatedDiagnostics/': Permission denied
...
error: open(".cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/.pnpm/@oai+artifact-tool@file+.../node_modules/@oai/walnut/wasm/DocumentFormat.OpenXml.Framework.aaveu4049y.wasm"): Filename too long
error: unable to index file '.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/.pnpm/@oai+artifact-tool@file+.../node_modules/@oai/walnut/wasm/DocumentFormat.OpenXml.Framework.aaveu4049y.wasm'
fatal: adding files failed

The logs also contain many repeated unhandled rejections:

error [electron-message-handler] [desktop-notifications][unhandled-rejection] Error: CancelledError

Workarounds Tried

Setting:

GIT_CEILING_DIRECTORIES=C:\Users\<user>

does not fully prevent this, because some Codex background git jobs use cwd=C:/Users/<user> directly. Git ceiling only prevents discovery from child directories upward; it does not disable a repository when the cwd is the repository root itself.

A stronger local workaround was to edit:

C:\Users\<user>\.git\info\exclude

and add:

/*

After that:

git -C C:\Users\<user> status --porcelain=v1 --untracked-files=normal
git -C C:\Users\<user> add -A --dry-run

both complete without enumerating the entire home directory or hitting long-path errors. Project-level repos under Documents\GitHub\... still work normally.

Expected Behavior

Codex Desktop should not run heavyweight snapshot/review git commands such as git add -A against the user's home directory merely because the home directory has a .git folder or appears in historical/sidebar/thread metadata.

At minimum:

  • Avoid git add -A / branch diff snapshot work for the home directory.
  • Respect a denylist for home/AppData/cache/runtime directories.
  • Do not let failed background git snapshot jobs terminate or destabilize the entire desktop app.
  • Surface a clear warning if a trusted workspace is the user home directory or an unusually large/sensitive directory.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗