fix(pi-fff): aux finder pool for out-of-workspace path constraints (#463)#622
Open
gustav-fff wants to merge 1 commit into
Open
fix(pi-fff): aux finder pool for out-of-workspace path constraints (#463)#622gustav-fff wants to merge 1 commit into
gustav-fff wants to merge 1 commit into
Conversation
…x finder pool Hotfix prototype for #463. When the agent passes an absolute `path` outside the workspace cwd to ffgrep/fffind, spin up (or reuse) a FileFinder rooted at that path instead of throwing "Path constraint must be relative to the workspace". Pool keeps at most 3 aux finders, LRU-evicted, dropped after 5 minutes of inactivity. Find pagination cursors carry the aux root so resumes hit the same finder.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #463
Hotfix prototype per maintainer request: when the agent passes an absolute
pathoutside the workspace cwd toffgrep/fffind, instead of throwingPath constraint must be relative to the workspace, route the call to a small rotating pool of additionalFileFinderinstances rooted at the requested path.Root cause
packages/pi-fff/src/query.ts:13-17rejects any absolute path that resolves outsidecwd. The single workspaceFileFinderonly knows about files under itsbasePath, so historically there was nowhere to send those queries.Fix
New
packages/pi-fff/src/aux-finders.ts(~125 LOC) adds anAuxFinderPool:MAX_AUX = 3), LRU-evicted on overflow.IDLE_TTL_MS = 5 * 60 * 1000); swept on every acquire.routePathConstraint(path, cwd)returns{ root, suffix }whenpathis absolute and resolves outsidecwd, elsenull.resolveAuxRootwalks back to the longest non-glob existing directory prefix; the remainder becomes a relative constraint inside the aux finder.packages/pi-fff/src/index.ts:resolveFinderForPath()decides per-call whether to use the workspace finder or acquire an aux finder. Used by bothffgrepandfffind.auxRootso a resumed page reuses the same aux finder.destroyFinder()tears the pool down onsession_shutdown.No changes to top-level Rust/Lua/C/bun APIs. Workspace finder behavior is unchanged for in-workspace paths. Aux finders are created with the same
frecencyDbPath/historyDbPath/enableFsRootScanningas the main finder andaiMode: true,enableHomeDirScanning: true.Diff size: 215 insertions, 5 deletions across 3 files (within the requested 200-300 LOC budget).
Steps to reproduce
End-to-end (manual, requires pi runtime):
How verified
bun testinpackages/pi-fffpasses 23/23 (17 prior + 6 new inaux-finders.test.ts).@dmtrKovalenko marking this as a prototype — open questions for review:
getMentionItems) is not routed through the aux pool — only theffgrep/fffindtools are. Easy to extend if you want@/abs/path/...mentions to work too.resolveAuxRootdoes astatSyncto find the longest existing prefix. Sync is fine for hotfix prototype (one call per tool invocation, ms-scale) but could go async if it ever shows up in profiles.Automated triage via Gustav. Honk-Honk 🪿