codex icon indicating copy to clipboard operation
codex copied to clipboard

⚠ Repository snapshot encountered large untracked directories: webroot/attachments (274 files). This can slow Codex; consider adding these paths to .gitignore or disabling undo in your config.

Open KustomKode opened this issue 1 year ago • 10 comments

What version of Codex is running?

codex-cli 0.61.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.1-codex-max

What platform is your computer?

Darwin 21.6.0 x86_64 i386

What issue are you seeing?

This directory is already in my .gitignore, and it is also in .codexignore.

My .codexignore file:

# Exclude large media from Codex snapshots/undo (multiple patterns to cover both rooted and nested) /webroot/attachments/** webroot/attachments/** /webroot/video/** webroot/video/** /uploads/** uploads/**

My .gitignore file:

/config/app_local.php /config/.env /logs/* /tmp/* /vendor/* .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon ehthumbs.db Thumbs.db .directory .phpunit.cache tests.sqlite *~ *.swp *.swo *.sublime-* *.stTheme.cache *.tmlanguage.cache *.tmPreferences.cache .settings/* .idea/* nbproject/* .vscode .nova .sass-cache/ /node_modules/* yarn-debug.log yarn-error.log /resources/git-commands.txt /resources/DEPLOYMENT.md !.cpanel.yml .env /webroot/attachments/* !/webroot/attachments/.gitignore !/webroot/attachments/.gitkeep /webroot/video/* !/webroot/video/.gitignore !/webroot/video/.gitkeep /uploads/* !/uploads/.gitignore !/uploads/.gitkeep

What steps can reproduce the bug?

Just start a new session and I get the warning for every single prompt the entire session.

What is the expected behavior?

Since it is in the .gitignore file, it should be ignored.

Additional information

No response

KustomKode avatar Nov 21 '25 05:11 KustomKode

I have the same message with files that are part of .gitignore and should be ignored.

JurjenRoels avatar Nov 21 '25 08:11 JurjenRoels

I have this message with files that are ignored through a .gitignore in a subdirectory. Is the nesting an issue or perhaps double asterisk patterns?

Example:

# package/foo/.gitignore
/cache/**

Repository snapshot encountered large untracked directories: packages/foo/cache (8624 files), ...

Another possibility is the misinterpretation of /cache as an absolute path, rather than based from the current dir?

robations avatar Nov 21 '25 10:11 robations

Getting similar error: Repository snapshot encountered large untracked directories: foo (123 files). This can slow Codex; consider adding these paths to .gitignore or disabling undo in your config. However I have a .gitignore file inside foo/:

# foo/.gitignore
*

piotr-kubiak avatar Nov 21 '25 12:11 piotr-kubiak

I have the same issue

Yafei-Liu99 avatar Nov 21 '25 15:11 Yafei-Liu99

repro steps from #7133

# Create a new repository
mkdir test-repo/
cd test-repo/
git init

# Create a test/ directory containing .gitignore and a dozens/ directory containing dozens of files
mkdir -p test/dozens/
echo "dozens/*.txt" > test/.gitignore
for i in {1..16384}; do touch test/dozens/file_$i.txt; done

# Confirm that Git ignores the files in dozens
git status --short --untracked-files=all

# now open Codex
codex

it seems to be happening specifically because of the wildcard, not that it starts with a leading path

  • ✅ dozens
  • ✅ dozens/
  • ✅ /dozens
  • ✅ /dozens/
  • ❌ dozens/*.txt

mary-ext avatar Nov 22 '25 02:11 mary-ext

Same issue here for storage/framework/views.

We have a .gitignore file within the folder itself containing only

*
!.gitignore

GalahadXCIX avatar Nov 24 '25 13:11 GalahadXCIX

我也遇到了同样的问题。

lulu-sk avatar Nov 26 '25 03:11 lulu-sk

clearing the git cache solved this issue for me.

git rm -r --cached .
git add .

miraclebakelaser avatar Nov 27 '25 04:11 miraclebakelaser

I can confirm the problem (WSL / current Codex version 0.63.0). Even with a clean index.

git rm -r --cached . && git add . && git commit -m "Reapply .gitignore and clean index"

.gitignore in root:
/test123/generated/*.html
/wp-includes/*

=> Nevertheless, this message:

⚠ Repository snapshot encountered large untracked directories: test123/generated/ (454 files), wp- includes (244 files). This can slow Codex; consider adding these paths to .gitignore or disabling undo in your config.

wbdb avatar Nov 28 '25 22:11 wbdb

@lionel-oai https://github.com/openai/codex/blob/4d4778ec1cbc93ff2b992afc4a4214bbffa26c2a/codex-rs/utils/git/src/ghost_commits.rs#L33 It probably makes sense to also include __pycache__ and vendor in DEFAULT_IGNORED_DIR_NAMES.

Thank you for the solution and have a wonderful pre-Christmas season!

wbdb avatar Dec 02 '25 22:12 wbdb