bug(core): read_many_files skips explicitly requested binary assets in added workspace directories (regression from #30211)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
Research direction
Start with packages/core/src/tools/read-many-files.ts, especially ReadManyFilesToolInvocation.execute and isAssetExplicitlyRequested, then review the existing cases in packages/core/src/tools/read-many-files.test.ts. Add coverage for explicitly requested binary assets in a secondary workspace directory and by absolute path, while confirming generic wildcard patterns still skip assets. Done when the focused tests pass and the requested assets are read.
Written by the indexing model from the issue text.
Description
What happened?
After #30211 (1930f2539), read_many_files skips explicitly requested non-text assets (images, PDFs, audio) whenever they live in a secondary workspace directory (added via --include-directories or /directory add), or when an absolute path is passed in include.
ReadManyFilesToolInvocation.execute (packages/core/src/tools/read-many-files.ts:246-281) globs include patterns against every directory in workspaceContext.getDirectories(). Then, at lines 344-360, it computes:
const relativePathForDisplay = path
.relative(this.config.getTargetDir(), filePath)
.replace(/\\/g, '/');
and passes relativePathForDisplay into isAssetExplicitlyRequested(include, relativePathForDisplay, filePath, matcherCache).
For a secondary workspace directory ws2 when targetDir is ws1, relativePathForDisplay is ../ws2/assets/logo.png:
- Path-qualified patterns like
assets/logo.pngordocs/*.pdffailisMatchPath('../ws2/assets/logo.png'), and the basename fallback (!normalizedPattern.includes('/')at line156) is skipped because the pattern contains/. - Even passing the exact absolute path (
/path/to/ws2/assets/logo.png) fails becauseisAssetExplicitlyRequestedonly matches againstrelativePath(never againstnormalizedFilePath), andnormalizedPatterncontains/.
Local Reproduction
Tested on main (e5d88fb2c / 0.70.0-nightly.20261110.g1603e9bab) with WorkspaceContext(ws1, [ws2]), ws1/assets/root-logo.png, ws2/assets/logo.png, and ws2/docs/manual.pdf:
include: ['assets/root-logo.png'](primary workspacews1):- Result: Read and returned
inlineData(image/png).
- Result: Read and returned
include: ['assets/logo.png'](secondary workspacews2):- Result:
isAssetExplicitlyRequested(['assets/logo.png'], '../ws2/assets/logo.png', logoPath)returnsfalse. - Skipped:
../ws2/assets/logo.png (Reason: asset file (image/pdf/audio) was not explicitly requested by name or extension) llmContent:["No files matching the criteria were found or all were skipped."]
- Result:
include: ['docs/*.pdf'](secondary workspacews2):- Skipped:
../ws2/docs/manual.pdf (Reason: asset file (image/pdf/audio) was not explicitly requested by name or extension)
- Skipped:
include: ['<abs>/ws2/assets/logo.png'](exact absolute path):- Skipped:
../ws2/assets/logo.png (Reason: asset file (image/pdf/audio) was not explicitly requested by name or extension)
- Skipped:
What did you expect to happen?
Explicitly requested images, PDFs, and audio files in any configured workspace directory (or specified by absolute path) should be matched against each workspace directory's relative path (and the normalized absolute filePath), not solely against path.relative(targetDir, filePath)—while still rejecting generic wildcard globs like **/* or reports/**.
Client information
Client Information
- Repository:
google-gemini/gemini-cli(mainat commite5d88fb2c,package.jsonversion0.70.0-nightly.20261110.g1603e9bab) - Platform: macOS (
darwin) - Node.js:
v26.10.0 - Reproduced locally via
ReadManyFilesToolfrom@google/gemini-cli-core
Login information
N/A (reproduced directly against ReadManyFilesTool in @google/gemini-cli-core)
Anything else we need to know?
Regression introduced in #30211 (1930f2539), which fixed #29045. packages/core/src/tools/read-many-files.test.ts currently only tests isAssetExplicitlyRequested with primary-root relative paths (assets/logo.png) and tests multi-workspace reading with text files, so this case isn't covered yet.
- Dominant language
- TypeScript
- Stars
- 109k
- Forks
- 14.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 111
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google-gemini/gemini-cli
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30328 · 1 comment ·
Maintainers usually reply within 1 day
-
Padded function-call name is answered under the trimmed name, so the next request fails with 400 INVALID_ARGUMENTPossibly taken @arifrhm claimed this 3 days ago. Openarea/agent status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
google-gemini/gemini-cli#30256 · 1 comment ·
Maintainers usually reply within 1 day
-
Auto-update runs npm install -g when a Gemini CLI source checkout is run from outside the clonePossibly taken @tanveerhkit claimed this 4 days ago. Openarea/core effort/small status/bot-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google-gemini/gemini-cli#30209 · 6 comments ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google-gemini/gemini-cli#30127 ·
Maintainers usually reply within 1 day
-
web_fetch keeps a trailing comma on URLs in a comma-separated listMay be free again @tneemo claimed this 25 days ago, and no pull request is open. Openarea/agent status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#29896 · 2 comments ·
Maintainers usually reply within 1 day
All issues in google-gemini/gemini-cli
Similar issues
-
area: batch
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
inabagumi/shinju-date#7294 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
streaming-video-technology-alliance/common-media-library#700 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
vercel-labs/ui#809 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
KrisCris/village-in-the-shade-guide#75 ·
Maintainers usually reply within 1 day
-
bot:ai-assisted component:platform-js status:untriaged
Difficulty 1/5 Under an hour Newbie friendliness 74/100
midnightntwrk/platform-js#38 ·