Skip to content

fix(pi-fff): allow out-of-workspace path constraints#446

Closed
edxeth wants to merge 1 commit into
dmtrKovalenko:mainfrom
edxeth:fix/pi-fff-path-throw
Closed

fix(pi-fff): allow out-of-workspace path constraints#446
edxeth wants to merge 1 commit into
dmtrKovalenko:mainfrom
edxeth:fix/pi-fff-path-throw

Conversation

@edxeth
Copy link
Copy Markdown
Contributor

@edxeth edxeth commented May 4, 2026

Problem

pi-fff currently throws when find.path or grep.path resolves outside the workspace via path.relative.

Repro shape:

find({
  pattern: "init.lua",
  path: "/home/devkit/.config/nvim/**",
})

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:

Path constraint must be relative to the workspace: /home/devkit/.config/nvim/**

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-fff adapter 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:

  • out-of-workspace path with /** → relative path with collapsed glob
  • out-of-workspace nested path → relative path with collapsed glob

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.
Copy link
Copy Markdown
Owner

@dmtrKovalenko dmtrKovalenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@edxeth
Copy link
Copy Markdown
Contributor Author

edxeth commented May 5, 2026

@dmtrKovalenko the throw was preventing any result at all. Without it, the path resolves to a relative ../ form and FFF returns empty silently instead of erroring.
The files still aren't found since they're outside the indexed directory, but at least the caller isn't blocked by an unrecoverable error and can fall back to other approaches.

@dmtrKovalenko
Copy link
Copy Markdown
Owner

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 base_path

@edxeth
Copy link
Copy Markdown
Contributor Author

edxeth commented May 5, 2026

@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.

@edxeth edxeth closed this May 5, 2026
@dmtrKovalenko
Copy link
Copy Markdown
Owner

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

@edxeth edxeth deleted the fix/pi-fff-path-throw branch May 10, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants