Gemini CLI fix: substring matching inlined unrequested binary files into model context

priyanshu1976 · ghdev · 2026-10-16

A PR to google-gemini/gemini-cli fixes how readmanyfiles decides whether an asset was "explicitly requested". The old logic used substring checks between raw include-pattern strings and file stems/extensions, so any textual overlap counted — inlining unrequested binaries as base64 into model context. E.g. include: ["/report/"] pulled in reports/report.png, and include: ["assets/", "src/logo.txt"] inlined assets/logo.png via the logo substring.

The fix requires both: the pattern actually matches the file via picomatch (nocase + dot, mirroring discovery glob options), and the pattern's last segment names the file's extension or name — broad wildcards like no longer opt binaries in. Case handling is now uniformly insensitive. Three new tests cover the regression scenarios; text-file handling and exclusions are unchanged.

Original post →

More from coding & agent

coding & agent channel →