[BUG] Desktop Code tab: @-mention autocomplete drops all files outside nested git repos when session root is not a git repo
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
In the Claude Desktop Code tab, @-mention file autocomplete only shows files from nested git repositories when the session's root folder is not a git repository but has one or more direct child folders that are git repositories. Every file/folder outside those nested repos is silently missing from the index.
Example layout (session cwd = project/):
project/ <- NOT a git repo (session cwd)
├── annotation-toolkit/ <- git repo
├── paper/ <- plain folder (contains paper/latex/, a git repo two levels down)
├── proposal/ <- plain folder
└── research/ <- plain folder, ~2,300 files
- Typing
@shows onlyannotation-toolkit(plus sessions and open app windows). - Typing
@research,@proposal,@paperreturns no file/folder results at all — only unrelated matches (e.g. a Slack channel named "research"). rg --filesin the same folder lists ~2,300 files in ~20 ms, so this is not a size/permission/scan-time problem.~/Projectsis not a TCC-protected location.
Root cause (from reading the bundled file-index worker in app.asar):
- The index is built by running
git ls-files --recurse-submodulesin the session root and in each direct child directory that contains a.git. - For the root,
git ls-filesfails withfatal: not a git repository. That specific error is intentionally not logged, and the root result is simplynull. - Results are combined: if any listing succeeded, only the successful listings are committed; a failed listing with an empty prefix (the root) is dropped.
- The directory-walk fallback (depth ≤ 4, ≤ 2,000 entries) runs only when every listing failed.
So a single nested repo is enough to suppress the fallback, and the whole non-git root is excluded from @-mention autocomplete with no warning in the UI or in main.log.
(Separately, nested-repo discovery only checks direct children, so paper/latex/ above is not found either — but that matters less than the root being dropped.)
What Should Happen?
When the session root is not a git repository, its files should still be indexed: e.g. run the directory-walk fallback for the root (excluding the nested-repo subtrees, which are covered by their own git ls-files) and merge it with the nested-repo listings. @research, @proposal, etc. should then autocomplete as they do in a folder without nested repos.
Error Messages/Logs
# No error is logged for this case. The root failure ("not a git repository") is deliberately
# suppressed, and ~/Library/Logs/Claude/main.log only shows:
[info] [file-index] worker forked
# with no subsequent file-index warnings for this session's cwd.
Steps to Reproduce
(The behaviour was observed on the real layout above; this minimal repro follows the same code path.)
- Create a folder layout like this:
``bash`
mkdir -p /tmp/repro/{subrepo,plain/docs}
echo a > /tmp/repro/subrepo/a.txt
echo b > /tmp/repro/plain/docs/b.txt
echo c > /tmp/repro/root-file.txt
git -C /tmp/repro/subrepo init -q && git -C /tmp/repro/subrepo add -A
/tmp/repro` itself is not a git repo.)
(
- In Claude Desktop → Code tab, start a new local session with
/tmp/reproas the folder. - In the prompt box type
@root-file,@plain, and@b.txt: no file results. - Type
@a.txt:subrepo/a.txtis found. - Control:
rm -rf /tmp/repro/subrepo/.git, start a new session in/tmp/repro: now@root-file,@plain,@b.txtare found (the directory-walk fallback runs because every listing failed).
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Desktop 2.16120.0 (bundled Claude Code 2.1.284); CLI claude --version: 2.1.285 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
- Surface: Claude Desktop (macOS) → Code tab, local session. Not tested in the CLI's own
@autocomplete. - macOS 26.7 (25G229), git 2.54.0 (Apple Git-157).
- Related but different: #81310 (file-index-worker
git ls-filesfails with EPERM for sessions under TCC-protected dirs and falls back to the depth-limited scan). In this report there is no EPERM and the fallback never runs at all.