codex - 💡(How to fix) Fix Possible creation of empty ~/.git and ~/.agents directories on host during/around Codex startup

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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:

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.

Root Cause

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.

RAW_BUFFERClick to expand / collapse

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:

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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Possible creation of empty ~/.git and ~/.agents directories on host during/around Codex startup