fix(pi-fff): feature-detect ctx.ui.addAutocompleteProvider (#651)#653
Merged
Conversation
pi forks (e.g. omp) do not expose addAutocompleteProvider, causing session_start to throw "FFF init failed: ... is not a function" and skipping tool registration entirely. Skip UI wiring when the host lacks the method; tools still register. Refs #651
dmtrKovalenko
approved these changes
Jul 6, 2026
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 #651
Root cause
packages/pi-fff/src/index.ts:411callsctx.ui.addAutocompleteProviderunconditionally insidesession_start. The type at:406also declares it as required. On pi forks that do not expose this method (omp, reported in #651), the call throws and thecatchinsession_start(:496-501) surfacesFFF init failed: ctx.ui.addAutocompleteProvider is not a function— and, more importantly, tool registration for the session never completes.Fix
Mark
addAutocompleteProvideras optional in the acceptedctxshape and feature-detect it before calling. When absent, skip the UI wiring and return — tools (find/grep/multi_grep) still register normally.Steps to reproduce
Pre-fix, on
origin/main:git checkout origin/main cd packages/pi-fff bun installAdd a repro test that mimics an omp-style host lacking
addAutocompleteProvider:Run:
bun test test/repro.test.tsExpected: pass.
Actual on
origin/main: fails —ctx.ui.notifyis called withFFF init failed: ctx.ui.addAutocompleteProvider is not a function, matching the traceback in the issue.How verified
Output:
8 pass, 0 fail— includes the newsession_start survives hosts without addAutocompleteProviderregression test plus the existing 7 tests unchanged.Automated triage via Gustav. Honk-Honk 🪿