-
Notifications
You must be signed in to change notification settings - Fork 14.6k
bug(cli): @ glob fallback parses LLM text and takes only first match #29318
Copy link
Copy link
Open
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityeffort/medium2-3 days: UI state, async flow, cross-component refactors2-3 days: UI state, async flow, cross-component refactorskind/bugpriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.status/bot-triagedstatus/need-information
Description
Activity
Metadata
Metadata
Assignees
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityeffort/medium2-3 days: UI state, async flow, cross-component refactors2-3 days: UI state, async flow, cross-component refactorskind/bugpriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.status/bot-triagedstatus/need-information
Type
Projects
- StatusShow more project fieldsNo status
What happened?
packages/cli/src/ui/hooks/atCommandProcessor.ts:327-332falls back to parsing LLM text and takes only the first hit:Fragile
split('\n')[1]assumes glob output format, ignores all but the first match, no workspace-trust check on the fallback path, and thefor (const dir of ...)search above is serialawait(slow multi-root). Wrong file can be silently injected into LLM context.What did you expect to happen?
Use the structured glob API (not
llmContentstring), rank/surface ambiguity to the user, parallelize multi-root dirs with abort, and enforce workspace-trust on the fallback.Client information
google-gemini/gemini-cli@main9c1b0a610packages/cli/src/ui/hooks/atCommandProcessor.ts:300-335@filecompletionLogin information
N/A — repro: ambiguous
@configwith 2+ matches silently picks first with no prompt.Anything else we need to know?
Fix direction: structured results + disambiguation UI +
Promise.any/parallel + trust check; test with multi-match fixture asserting prompt instead of silent first-pick.