Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 3f497c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f497c5099
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| for (const file of filePaths) { | ||
| if (signal.aborted) { | ||
| const outOfTime = signal.aborted || Date.now() >= deadline; | ||
| if (outOfTime && (filesScanned > 0 || filePaths.length === 0)) { |
There was a problem hiding this comment.
Handle zero-file inventory timeouts before the scan loop
When ripgrep is unavailable and the batched walk reaches the 30-second deadline before yielding any file (for example, when files exist only beyond the partial inventory), filePaths is empty, so this loop and its only FS_GREP_TIMEOUT check never run. When the array is nonempty, this condition can only be entered after filesScanned > 0, making the nested zero-progress throw unreachable there as well; the Node fallback therefore returns a successful empty/truncated response instead of the timeout error for a zero-progress scan. Check the zero-progress timeout before entering the loop.
Useful? React with 👍 / 👎.
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Speed up file completion in remote environments without ripgrep. |
There was a problem hiding this comment.
Disclose the new fallback walk limits
The new WorkspaceFsService.walk applies 10,000-directory, 100,000-entry, 8 MiB, and per-directory 50,000-entry limits to local/ACP searches and Node-fallback suggest/grep, while the previous local recursive path had only the depth boundary. Large local workspaces can therefore now omit hits or fail with a too-many-results error, but this release note mentions only faster remote completion and does not name the behavior users lose; update it to disclose the truncation/error behavior (and any retained escape hatch).
AGENTS.md reference: AGENTS.md:L117-L117
Useful? React with 👍 / 👎.
Requirement or Bug
在 #4062 的远程执行环境上,文件搜索、补全和无 ripgrep 时的 grep 不应按目录数量放大 RPC 往返时间。本 PR 新增独立
fs/walk原语,将同一 workspace root 的目录枚举合并为一次 RPC,不改动大文件 read/write 或已有 ripgrep 快路径。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路是把“递归枚举目录”下沉为文件系统能力,而不是让 Workspace 在 RPC 客户端上逐目录递归。Workspace 对批量返回的条目按 parent 分组后恢复 DFS 访问,因此原有匹配、去重和展示逻辑继续复用;旧 executor 不支持新方法时自动回退到逐目录读取。
flowchart LR A[Workspace search / suggest / grep] --> B[HostFileSystem.walk] B --> C[Local / ACP bounded walker] B --> D[RemoteFileSystem] D -->|fs/walk| E[Executor-side bounded walker] D -->|MethodNotFound or oversized ignore| F[Bounded per-directory fallback]本地与远程共用同一个 walker 的限制和错误语义;远程只替换目录读取传输,所以不需要为忽略规则、symlink 和 DFS 语义维护第二套实现。
fs/walk,只替代目录枚举timeoutMsPromise.race模拟取消{ entries, truncated: true }MethodNotFound后缓存 unsupported,使用同一有界 walker 回退.gitignore、始终排除.git、隐藏文件、glob、symlink 和去重语义;目录 symlink 不递归,远程默认使用 POSIX 路径规则。FS_TOO_MANY_RESULTS。fs/walk与兼容回退;没有新的用户配置或文档操作流程。阅读顺序:
hostFsWalk.ts看统一遍历与预算语义,remoteFileSystem.ts和fsHandler.ts看 RPC 契约与兼容回退,workspaceFs/fsService.ts看 partial inventory、DFS 恢复和整体 deadline;其余是接口接线、测试与协议文档。Behavior Changes and Affected Users
fs/readDirectoryfs/walkkimi exec-server的远程会话.gitignore的远程 workspacetruncated=true并保留部分结果旧路径功能对应:根
.gitignore读取与缓存保留在ignoreFor,.git/在无 gitignore 模式也作为默认剪枝规则;隐藏文件 / glob 继续在 Workspace visitor 筛选;symlink 仍只作为条目访问、不递归;real-root 去重及多 root 展示路径不变;DFS 访问顺序由 parent 分组恢复;普通readdir失败继续跳过,超大目录错误仍抛出。测试覆盖远程单 RPC、ignore 剪枝、能力缓存、大规则回退、partial inventory、共享 deadline、DFS 顺序、symlink、深度与响应预算;ACP 文件能力也完成回归。没有验证真实 SSH / Docker 高 RTT 环境,性能结论来自 RPC 调用数从目录数降为 root 数。
验证结果
agent-core-v2、kap-server、acp-servertypecheck 通过。loop.ts、loopService.ts、origin.ts3 条;本 diff 无新增违规。Checklist
gen-changesetsskill:patch,已写入。gen-docsskill:性能优化没有新的用户操作或配置,无需更新用户文档;远程协议 README 已更新。