pi-fff: switching modes leaves stale tool names active after `/reload`
Summary
registerPendingTools only ever adds names to the active tool set, never removes old ones. After switching from override back to a FFF-named mode and running /reload, the restored active list still contains the previous mode's tool names, so the model sees duplicate search tools.
Per the README, override replaces the built-in find / grep, and switching modes takes effect after /reload when the tools are registered again. The stale names contradict both statements.
Reproduction
- Start Pi with
pi-fffinoverridemode (grep/findactive). - Run
/fff-mode tools-and-ui, then/reload. - Check the active tools (e.g. via
/toolor the model's tool list).
Actual
Stale search tools stay active alongside the final mode's names: grep, find, ffgrep, fffind (functionally duplicated in pairs).
Expected
The active set matches the final mode: only ffgrep / fffind (plus fff-multi-grep when enabled).
Verification (two-session mock on #854's branch)
Fresh extension instance per reload, one shared persisted active list:
| direction | active set after reload | status |
|---|---|---|
| default -> override | read, grep, find |
fixed by #854's prune |
| override -> default | read, grep, find, ffgrep, fffind |
still open (this issue) |
Notes
- The default-to-override direction was fixed as a side effect of #854's prune: pre-registered FFF names are instance-tracked, so they are removed from the active set.
- Fresh sessions are unaffected in either direction.
- A fix needs to distinguish the extension's
grep/findregistrations from Pi's built-ins sharing those names (e.g. viagetAllToolssource info), so it is kept out of #854.
Source: dmtrKovalenko/fff