-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(shell): search past file completion limit #2551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lihailong00
wants to merge
1
commit into
MoonshotAI:main
Choose a base branch
from
lihailong00:codex/issue-1610-path-completion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Completion suggestions for one search can be reused for a different search in projects where git listing fails
The completion cache is tagged as having no specific search text (
self._cache_query = ... else Noneatsrc/kimi_cli/ui/shell/prompt.py:745) even when the file results were actually narrowed to a single search text, so a later different search reuses the earlier search's suggestions.Impact: In an affected project, typing one
@query and then a different one within a couple of seconds can show stale or empty completion results.Mechanism: query-specific fallback results cached with a null query key
When
_is_gitis truthy butlist_files_gitreturnsNone(git is present butgit ls-filesfails/times out),pathsstaysNoneand the code falls through to the query-aware walk withquery=fragment(src/kimi_cli/ui/shell/prompt.py:735-741). The returnedpathsare therefore filtered tofragment. However,self._cache_queryis written asfragment if self._is_git is False and scope is None else None(src/kimi_cli/ui/shell/prompt.py:745) — since_is_gitisTrue, it is set toNone. On the next call with a different fragment, the invalidation guardif cache_valid and self._is_git is False and scope is None: cache_valid = self._cache_query == fragment(src/kimi_cli/ui/shell/prompt.py:716-717) does not fire (because_is_gitisTrue), and if the.git/indexmtime is unchanged the cache is treated as valid, returning the previous query's filteredpaths. The downstreamFuzzyCompleterthen re-filters that stale subset against the new fragment, typically yielding wrong or empty suggestions until the 2s refresh interval expires. The cache key should track whether the query walk was actually used (i.e. whenever the fallback walk ran with a non-None query), not whether_is_git is False.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.