Skip to content

[Bug]: Pi extension breaks with in-process subagents #760

Description

@noctuid

Which fff frontend?

Other / multiple

has logs

No response

Description

This will happen for any subagents plugin that uses createAgentSession instead of completely separate pi processes. (My personal subagents extension works this way, and there are many significant benefits to doing things this way, e.g. subagents can still use UI tools like permissions or ask/question like in other harnesses).

fff-node can't open the same db environment twice in one process, so on subagent start you will get an error message because FileFinder.create() runs against the same frecency/history db again.

Potential fixes:

  1. fff-node: allow multiple FileFinder instances in the same process to share one db environment
  2. pi-fff: share a single FileFinder per process (e.g. a globalThis/Symbol.for singleton) and/or fall back to an isolated DB path when the environment is already open; this is how pi-pretty's fff implementation works fine with in-process subagents

This is related to #700, but the fix there does not handle createAgentSession

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriaged

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions