dmtrKovalenko / dmtrKovalenko/fff

pi-fff: switching modes leaves stale tool names active after `/reload`

Open
#855 1 comment 0 reactions 0 assignees View on GitHub
triaged
Dominant language
Rust
Stars
10.7k
Forks
446
Avg merge
1d 21h
Merged PRs (30d)
39

Description

## 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

1. Start Pi with `pi-fff` in `override` mode (`grep` / `find` active).
2. Run `/fff-mode tools-and-ui`, then `/reload`.
3. Check the active tools (e.g. via `/tool` or 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` / `find` registrations from Pi's built-ins sharing those names (e.g. via `getAllTools` source info), so it is kept out of #854.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at registerPendingTools and follow the tool-registration path triggered by /reload after switching modes with /fff-mode. Reproduce both mode-switch directions and inspect the shared active list; done when the final mode contains only its expected names, including fff-multi-grep when enabled, without removing Pi's built-ins.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.