Workspace search index: post-turn rescans still walk large non-git project roots for 15 minutes after a search

未关闭
#39,541 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
backend, desktop

调研方向

Start with RunFinalizationService.refresh, WorkspaceEntries.refresh, and WorkspaceSearchIndex.refresh in apps/server, then trace how finder.scanFilesAsync() and watchAsync interact with WORKSPACE_INDEX_IDLE_TTL and WORKSPACE_INDEX_SCAN_TIMEOUT. Reproduce with a large non-git project and observe scans after searches and completed turns. Done means post-turn refreshes avoid repeated overlapping full scans while keeping the index updated.

由索引模型根据 Issue 内容生成。

描述

[!NOTE]
Written by Claude Opus 5.5 (Claude Code) on behalf of the account owner. Numbers are from one Windows install; the code references are from the bundled server of 0.1.11-nightly.20261119.4941.

Before submitting
  • I searched existing issues and did not find a duplicate of the remaining disk activity.
  • I included enough detail to investigate the problem.
Area

apps/server (workspace search index)

Steps to reproduce
  1. Open a large non-git folder as a project on Windows.
  2. Search for a file from the composer, then run multiple agent threads in that project.
  3. Observe filesystem activity after turns finish, during the 15 minutes following the search.
What happens

After a file search in a project, every finished turn in that project triggers a full rescan of the whole project folder for the next 15 minutes:

  • RunFinalizationService.refresh calls workspaceEntries.refresh(cwd) after each run.
  • WorkspaceEntries.refresh calls WorkspaceSearchIndex.refresh(), which calls finder.scanFilesAsync(), whenever an index exists for that cwd and was searched within WORKSPACE_INDEX_IDLE_TTL (15 minutes).

For a project whose root is a large folder that is not a git repository (so no .gitignore applies), each scan walks hundreds of thousands of files. The scan hits WORKSPACE_INDEX_SCAN_TIMEOUT (15 s), so the index stays incomplete, and the next turn starts another full scan. With many agent threads in one project, the rescans overlap.

What we measured on Windows 11 (32 cores, NVMe), with about 50 agent sessions:

  • A file search from the composer at 00:07 (about 30 projects.searchEntries requests in 30 s, several at 15.5 s).
  • At 00:10 the server process was doing 25,642 file-system operations a second, by our walker probe.
  • From 00:10 to 00:25, every new process on the machine took 1.4-3.4 s to start, against 0.03-0.1 s normally. Short-lived hook processes (Claude Code hooks with a 10 s limit) timed out, and agents' tool calls were refused.
  • Back to normal by 00:30, about 15 minutes after the last search.
Expected behavior

One of these, any of which would avoid repeated full walks:

  • Update an existing index from the file watcher (watchAsync is already set up) instead of scanFilesAsync() after each turn.
  • Or, after a turn, rescan at most once per interval per index, and never while a scan is running.
  • Or skip post-turn refreshes for an index whose last scan did not complete (timed out).

A setting to turn post-turn index refresh off would also help.

Impact

Major degradation or frequent failure.

Related reports

Issue #22586 reported the same rescan trigger and server event-loop blocking. PR #35460 moved the calls off the event loop; PR #38585 stops refreshes after the index has been unused for 15 minutes. This report concerns the remaining filesystem load during that 15-minute window on the newer release.

Version or commit

0.1.11-nightly.20261119.4941.

Environment
  • T3 Code (Nightly) 0.1.11-nightly.20261119.4941, desktop app with the bundled server, Windows 11 Pro.
  • Project root: a non-git folder with several hundred thousand files, most of them in nested folders with their own data.
主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
4 小时 29 分钟
30 天内合并 PR
488

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。