fix(pi-fff): fall back to transient finder when LMDB env already open (#760) - #763
Closed
gustav-fff wants to merge 1 commit into
Closed
gustav-fff wants to merge 1 commit into
gustav-fff wants to merge 1 commit into
Conversation
…#760) In-process subagents (createAgentSession) load the extension a second time in the same process. heed opens an LMDB env at most once per path per process, so reopening the shared frecency/history DBs fails with EnvAlreadyOpened. Retry the main finder without persistent scoring, matching the aux-finder precedent (#700). Closes #760
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 #760
Root cause
heed 0.22 keeps a process-global
OPENED_ENVregistry (env_open_options.rs:405-422); opening the same canonical LMDB path twice in one process returnsError::EnvAlreadyOpened. pi-fff's main finder always opens the fixed~/.pi/agent/fff/{frecency,history}(packages/pi-fff/src/index.ts:313-321), so an in-process subagent (createAgentSession) that loads the extension a second time hits this onFileFinder.create(). #700 fixed only aux finders, not the main finder.Fix
When
ensureFindergetsEnvAlreadyOpenedfromFileFinder.create(), retry once withoutfrecencyDbPath/historyDbPath— a transient finder without persistent scoring, exactly like aux finders (#700).packages/pi-fff/src/index.ts.Steps to reproduce
Rust layer (proves the engine-level cause), add to
crates/fff-core/src/dbs/frecency.rstests and runcargo test -p fff-search:Pre-fix actual output:
Expected: second open succeeds (or the caller degrades gracefully). In pi-fff this surfaces as
FFF init failed: ...environment already open...on subagent start.How verified
The new test
falls back to a transient finder when the LMDB env is already openforcescreate()to returnEnvAlreadyOpenedonce and asserts the retry drops the DB paths and session_start does not error.Automated triage via Gustav. Honk-Honk 🪿