Possible creation of empty ~/.git and ~/.agents directories on host during/around Codex startup

Resolved 💬 3 comments Opened May 20, 2026 by ahwmrklas Closed May 20, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

## Summary

I observed empty ~/.git and ~/.agents directories appear in my home directory around the time I started several Codex sessions.

I cannot prove with certainty that Codex created them, but the timing was suspicious, and the empty ~/.git affected Codex project-name / terminal title behavior.

## What I observed

In my normal shell outside Codex, I found:

  • ~/.git
  • ~/.agents

Both were empty directories.

Their timestamps were close to the time I had started several Codex sessions.

## Why this mattered

Codex terminal title was configured to show project-name.

A Codex session started in a subdirectory like:

  • ~/tmp/example-project

showed the home-directory (my user name) as the project name instead of the current directory name.

After I removed the empty ~/.git, Codex fell back to the current directory name as expected.

This suggests the empty ~/.git may have caused Codex to treat the home directory as the nearest project root.

## What I tested

I removed the empty directories:

```bash
rmdir ~/.git
rmdir ~/.agents

Then I started Codex again manually from a subdirectory.
After that launch, neither directory was recreated:

ls -ld ~/.git ~/.agents
# both missing

I also tried sandbox read-only tests and did not reproduce the issue. Because in this timespan I was working with sandbox defaults in my ~/.codex/config.toml file.

## Important caveat

I cannot prove with certainty that Codex created these directories. (But codex itself suggested this bug report)

However:

  • they were empty
  • their timestamps were close to Codex activity
  • the empty ~/.git affected Codex project-name behavior
  • Codex sandboxing appears to involve .git / .agents paths internally, which is why I am reporting this

## Expected behavior

Codex should not create empty ~/.git or ~/.agents directories in the user’s home directory unless explicitly required and documented.

If internal sandbox/mount setup needs temporary paths, they should not be left behind on the host filesystem.

## Actual behavior

I observed empty host-side ~/.git and ~/.agents directories appear unexpectedly.

## Environment

  • Codex CLI version: 0.132.0
  • Shell: bash
  • Terminal: GNOME Terminal
  • OS: Linux
  • Session type: Wayland

## Notes

This may be intermittent or tied to a specific startup path, wrapper, or earlier launch sequence, because I was not able to reproduce it reliably afterward.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #23684
  • #23503
  • #23191

Powered by Codex Action

ahwmrklas · 3 months ago

It is possible that the first issue "https://github.com/openai/codex/issues/23684" ultimately is describing the same root. But I think my description is vastly better. I think codex is creating the .git and .agents directories and when it does so, that makes the title of the session use the home directory and not the working directory.

The other two issues don't look like duplicates.

etraut-openai contributor · 3 months ago

Yes, I think this is explained by #23684. We have a fix coming for this in 0.133.0.