fix(server): update fff to stop runaway watcher rescans #14543
main fromrefs/pull/14543/head·merged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHubFixes #10628
Problem#
Fixes #14536
When a project is a big non-git folder that keeps changing, the backend stays at 60–190% CPU even when T3 Code is idle. The file-search library, fff 0.9.4, starts a full rescan of the whole folder after almost any burst of file changes, and nothing limits how often that happens. A burst can be more than 1024 changed paths, an FSEvents rescan flag, or any .gitignore edit. Full details, stack samples and a repro harness are in #14536.
This fixes watcher rescan throttling only. A separate upstream cost remains: binary detection reads changed files to the end (dmtrKovalenko/fff#895).
Change#
fff fixed the rescan loop upstream in dmtrKovalenko/fff#751. That change adds a throttle: watcher rescans wait at least 30 seconds, and 5 minutes for non-git roots with 1M or more files. The first release with it is 0.10.3. This PR moves T3 to the current release, 0.11.0.
| File | Why |
|---|---|
apps/server/package.json, pnpm-lock.yaml | @ff-labs/fff-node 0.9.4 → 0.11.0. The lockfile diff only touches fff packages. |
patches/@ff-labs__fff-node@0.11.0.patch, pnpm-workspace.yaml | Moves T3's existing patch to the new version. 0.11.0 ships separate index.cjs and index.js builds. As before, the patch sends require to the ESM build, so the server and its tests share one module instance. It also keeps the app.asar.unpacked native-binary lookup, now in dist/index.js. |
scripts/build-desktop-artifact.ts and its test | The Windows native-load probe pointed at dist/src/index.js, which no longer exists. It now points at dist/index.js. |
The fff API that T3 calls is unchanged between these versions; 0.11.0 only adds watch(). So there are no server code changes.
Scope and approval#
This fixes one problem: runaway rescans in the pinned native dependency. Bug report and evidence: #14536. The PR doesn't touch product behavior, and it's complementary to #11500, which keeps a partial index on scan timeout.
Verification#
Problem and fix, measured. I ran a standalone harness with the exact FileFinder.create options from WorkspaceSearchIndex.ts on a real 1.65M-file ~/code folder with live agent activity. It also writes and deletes 1500 files under node_modules every 20 s. Each version ran for about 4 minutes on an Apple M4. The harness is in #14536.
| fff-node | full scans | CPU used | average load |
|---|---|---|---|
| 0.9.4 | 7 in 240 s | 191 s | 80% of a core |
| 0.11.0 | 4 in 291 s | 137 s | 47% of a core (−41%) |
Readiness refresh (2026-10-02): merged current main 54084ae1e into the existing PR branch, preserving the current Expo patches when resolving the lockfile/workspace conflicts. The PR still changes only the seven files above. The update is a normal fast-forward from the existing head; no history rewrite is needed.
Checks on refreshed head dcff125e3, run on a separate Apple M4 test host with Node 24.13.1 / pnpm 11.10.0:
- Frozen-lockfile installation: passed.
- Workspace and desktop-artifact tests: 137 passed across 5 files (62 workspace + 75 artifact tests).
- Server and scripts
tsc --noEmit: passed; existing Effect suggestions only. - Targeted lint for the artifact script and test: 0 warnings, 0 errors.
- One scoped Codex CLI review (GPT-6.1-Sol, high reasoning): no actionable regressions. The reviewer also checked native loading, shared require/import identity, index warmup and search. After main advanced, the same scoped change was retained and the focused checks were re-run.
Packaged Electron native-load evidence: an isolated minimal macOS arm64 fixture used Electron 44.4.2 and the exact patched fff-node package/dependency closure from this lockfile. It ran from an actual app.asar with native .node / .dylib files unpacked. The fixture asserted packaged-app mode, shared require/import identity, an .asar.unpacked native-library path, successful index creation and the expected file-search result.
{"electron":"44.4.2","node":"24.21.0","isPackaged":true,"binary":"<fixture>.app/Contents/Resources/app.asar.unpacked/node_modules/@ff-labs/fff-bin-darwin-arm64/libfff_c.dylib","indexedFiles":1,"result":"needle.ts"}
Limits: this was a minimal packaged Electron native-load smoke test, not a complete T3 installer build. Packaged Windows/Linux execution and full desktop workflows were not tested. The existing Windows probe unit tests passed. The benchmark above consists of sequential runs on a changing live workspace, not a controlled claim about all projects or total app memory.
Readiness refresh performed with Codex (GPT-6); scoped CLI review used GPT-6.1-Sol at high reasoning.
Built with Claude Opus 5.5 (1M context) in T3 Code through the Claude Code harness, at medium reasoning effort.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
Approvability#
Verdict: Approved at
7dda9e1Macroscope's review found this PR approvable — This is a focused production dependency bug fix that throttles runaway workspace watcher rescans while preserving the existing fff API and packaged native-loading behavior. The remaining changes are lockfile, patch-layout, artifact-validation, and regression-test updates with no product-default or static-analysis suppression changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
-
-
⚙️ Run configuration
-
-
-
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
ae89284a-d8d7-4e69-9134-e14a4f7c32ef
-
-
📥 Commits
-
-
-
Reviewing files that changed from the base of the PR and between c09c710402c4ca2f3ffa9e50677af168bb9a3ce5 and dcff125e3615831207d24ed779307529dd1ec00a.
-
-
⛔ Files ignored due to path filters (1)
-
-
-
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
-
-
📒 Files selected for processing (1)
-
-
-
pnpm-workspace.yaml
-
-
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
-
-
📝 Walkthrough
-
📝 Walkthrough
-
📝 Walkthrough
-
-
Walkthrough#
The server dependency and workspace patch move to fff-node 0.11.0. The patch updates its require export target and ASAR binary-path resolution. The Windows native-load probe and its test use the package’s updated entry point.
Changes#
fff-node dependency and packaging
Layer / File(s) Summary Upgrade fff-node and update its patch
apps/server/package.json,pnpm-workspace.yaml,patches/@ff-labs__fff-node@0.9.4.patch,patches/@ff-labs__fff-node@0.11.0.patchThe dependency and patch mapping move to version 0.11.0, and the previous version’s patch is removed. The new patch points the require export to dist/index.jsand uses an existing.asar.unpackedpath when available, otherwise retaining the original binary path.Update the Windows native-load probe
scripts/build-desktop-artifact.ts,scripts/build-desktop-artifact.test.tsThe Windows probe and its test now use dist/index.jsinstead ofdist/src/index.js.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
-
-
-
Merge Risk: ⚪ Minimal · up to
dcff1The dependency mapping and Windows probe follow the updated entry path. Although the 0.11.0 archive was unavailable for independent inspection, no actionable mismatch or merge blocker is established.
Architecture Summary#
Architecture risk: 🔵 Low · up to
dcff1The change affects 4 systems.
Changed systems:
patches,scripts,apps/server,pnpm-workspace.yamlArchitecture concerns No architecture-level concerns identified.
Review details
-
-
-
Systems and components
- observed — patches (service) was modified; 2 changed files map to changed impact.
- observed — scripts (service) was modified; 2 changed files map to changed impact.
- observed — apps/server (service) was modified; 1 changed file maps to changed impact.
- observed — pnpm-workspace.yaml (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
- observed — Modified behavior in apps/server/package.json: The
@ff-labs/fff-nodedependency version changes from0.9.4to0.11.0. - observed — Modified behavior in patches/@ff-labs__fff-node@0.11.0.patch: The package’s
requireexport changes fromdist/index.cjstodist/index.js. - observed — Modified behavior in patches/@ff-labs__fff-node@0.11.0.patch:
dist/index.jsadds theseppath import needed to split and rejoin paths using the platform separator. - observed — Modified behavior in patches/@ff-labs__fff-node@0.11.0.patch: Adds
resolveUnpackedAsarPath: it finds the last path segment ending in.asar, returns the original path if none exists, and otherwise uses the corresponding.asar.unpackedpath only when that path exists.
-
-
Pre-merge checks |
5-
✅ Passed checks (5 passed)
-
Check name Status Explanation Docstring Coverage No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly identifies the server dependency update and its purpose: stopping runaway watcher rescans. Description check The description includes all required sections. It explains the problem, the dependency and patch changes, scope, approval context, verification results, and test limitations. It also provides detaile…
-
✨ Finishing Touches
-
-
-
🧪 Generate unit tests (beta)
-
-
-
- Create a new PR
-
-
-
-
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Autopilot is currently an internal CodeRabbit preview.
Comment `@coderabbitai help` to get the list of available commands.-
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Yash-Singh1(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. To continue using code reviews, add credits to your account and enable them for code reviews in your settings.