fix(pi-fff): allow out-of-workspace path constraints#446
Conversation
The adapter currently throws when find.path or grep.path resolves outside the workspace via path.relative. This breaks legitimate usage where the tool is called from one workspace but needs to search an unrelated directory. Instead of throwing, let the ../relative path continue through the normal glob-collapsing pipeline. FFF will return empty results, which is the correct silent-fail behavior for unindexed paths.
dmtrKovalenko
left a comment
There was a problem hiding this comment.
I'm not sure I undrestand your intention. File picker will not be able to find the files outside of working directory unless you will create a new one
|
@dmtrKovalenko the throw was preventing any result at all. Without it, the path resolves to a relative |
|
wah do you mean to throw? I think in this case we should simply print out to LLM that this tool doesn't support file seach outside of |
|
@dmtrKovalenko I was referring to this throw. I think you're right that returning empty is not ideal either but printing an unsupported-path message also feels like a fallback imho. Maybe the ideal fix is to route absolute paths to the correct cached finder, creating one for that base path if needed, so valid paths can be searched instead of just reported as unsupported? In the meanwhile I close this PR. |
|
I think it's a good finding and we should support it e.g. to spawn a new picker in the dedicated folder and search there but it indeed need to be reconsidered a bit more thoroughly |
Problem
pi-fffcurrently throws whenfind.pathorgrep.pathresolves outside the workspace viapath.relative.Repro shape:
When the tool is called from a CWD of
/tmp,path.relative('/tmp', '/home/devkit/.config/nvim/**')produces../home/devkit/.config/nvim/**. The adapter throws:This breaks legitimate usage where the tool needs to search an unrelated directory from its current workspace.
Fix
Replace the throw with a passthrough. The
../relative path continues through the normal glob-collapsing pipeline, so**globs still collapse to directory-prefix constraints. FFF will return empty results, which is the correct silent-fail behavior for unindexed paths.This keeps the change at the
pi-fffadapter boundary. It does not change FFF core indexing, ranking, parser behavior, or matching semantics.Tests
Updated the existing test from expecting a throw to expecting a silent passthrough:
/**→ relative path with collapsed glob