pi-fff blocks Pi /new and /resume while waiting for FileFinder scan on session_start
Maintainers usually reply within 2 days
@cokekitten is already working on this.
Since May 18, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- tooling
Research direction
Start in packages/pi-fff/src/index.ts by reading the session_start handler, ensureFinder(), and the session_shutdown lifecycle. Run cd packages/pi-fff && npx tsc --noEmit, then verify that /new and /resume return without waiting for the FileFinder scan while fff operations and @-mention autocomplete can still await initialization safely.
Written by the indexing model from the issue text.
Description
Summary
@ff-labs/pi-fff currently blocks Pi session replacement (/new and /resume) because the session_start handler eagerly initializes FileFinder and awaits the initial scan.
In packages/pi-fff/src/index.ts:
pi.on("session_start", async (_event, ctx) => {
try {
activeCwd = ctx.cwd;
if (shouldEnableMentions()) applyEditorMode(ctx);
await ensureFinder(activeCwd);
} catch (e: unknown) {
ctx.ui.notify(...);
}
});
ensureFinder() calls:
const result = FileFinder.create({ basePath: cwd, ... });
...
await finder.waitForScan(15000);
Because Pi recreates/reloads the session runtime when switching sessions, this means /new and selecting a session from /resume can hang until FileFinder.create() / waitForScan(15000) finishes.
Impact
/resume: after selecting a session, Pi appears stuck before the resumed session is usable./new: after pressing Enter, Pi appears stuck before the new session is usable.- This is especially noticeable in larger workspaces where scanning/watching takes non-trivial time.
- Disabling
@ff-labs/pi-fffmakes/newand/resumefast again.
Expected behavior
Pi session startup should not be blocked by a file index warmup. The finder can still be warmed in the background, and actual fff tool calls / @-mention autocomplete can await the same in-flight initialization if needed.
Suggested fix
Make the session_start warmup non-blocking, e.g. schedule it after the session start event returns:
let lifecycleId = 0;
pi.on("session_start", async (_event, ctx) => {
try {
activeCwd = ctx.cwd;
const sessionLifecycleId = ++lifecycleId;
if (shouldEnableMentions()) applyEditorMode(ctx);
setTimeout(() => {
if (sessionLifecycleId !== lifecycleId) return;
ensureFinder(activeCwd).catch((e: unknown) => {
if (sessionLifecycleId !== lifecycleId) return;
ctx.ui.notify(
`FFF init failed: ${e instanceof Error ? e.message : String(e)}`,
"error",
);
});
}, 0);
} catch (e: unknown) {
ctx.ui.notify(
`FFF init failed: ${e instanceof Error ? e.message : String(e)}`,
"error",
);
}
});
pi.on("session_shutdown", async () => {
lifecycleId++;
destroyFinder();
});
I also found it safer for ensureFinder() to return the local createdFinder after waitForScan() rather than the mutable global finder, so a shutdown during warmup cannot accidentally return a destroyed/replaced finder.
Local validation
I tested a local patch with:
cd packages/pi-fff
npx tsc --noEmit
and verified that importing the extension still returns a valid factory. With the patch, /new and /resume are no longer blocked by the scan warmup; the first actual fff operation may still await initialization, which seems like the expected tradeoff.
Related issues I found
I did not find an exact duplicate for pi-fff blocking Pi /new or /resume. Some related pi-fff/watcher issues:
- #403: parallel
ffgrepcalls andensureFindersingleton synchronization - #439:
aiMode: truewatcher file descriptor usage on macOS - #476: macOS segfault while watching directories during clone operations
This issue seems specifically about lifecycle behavior in the Pi extension: doing blocking index warmup inside session_start.
Environment
@ff-labs/pi-fff: 0.8.1- Pi: 0.75.1
- Node.js: v24.13.1
- OS: macOS / Darwin arm64
- Dominant language
- Rust
- Stars
- 11.2k
- Forks
- 467
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 34
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dmtrKovalenko/fff
-
triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dmtrKovalenko/fff#842 · 2 comments ·
Maintainers usually reply within 2 days
-
triaged
Difficulty 4/5 3-5 days Newbie friendliness 45/100
dmtrKovalenko/fff#970 · 5 comments ·
Maintainers usually reply within 2 days
-
[Bug]: nvim: cursor moves left when prompt_vim_mode = true and when the picker is closed with <C-c>Possibly taken @gustav-fff claimed this 2 days ago. Openbug triaged
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dmtrKovalenko/fff#968 · 2 comments ·
Maintainers usually reply within 2 days
-
[Bug]: FFF MCP process diagnosticsPossibly taken @gustav-fff claimed this 4 days ago. Openbug triaged
Difficulty 1/5 Under an hour Newbie friendliness 15/100
dmtrKovalenko/fff#955 · 1 comment ·
Maintainers usually reply within 2 days
-
triaged
Difficulty 4/5 3-5 days Newbie friendliness 22/100
dmtrKovalenko/fff#942 · 4 comments ·
Maintainers usually reply within 2 days
All issues in dmtrKovalenko/fff
Similar issues
-
area:io kernel-paused needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bherbruck/solvecraft#7854 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
transit-audio/transit#159 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
HakanSeven12/OpenCADStudio#2257 · 1 comment ·
Maintainers usually reply within 1 day
-
priority: low ui
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
storytold/photocraft#9884 · 1 comment ·
Maintainers usually reply within 1 day
-
triage: new type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Jagalite/superseedr#376 ·
Maintainers usually reply within 1 day