Skip to content

fix(agents): alias Pi tool names that collide with its built-ins - #335

Merged
zzet merged 1 commit into
zzet:mainfrom
vitaliyslion:feat/pi-avoid-builtin-collision
Jul 25, 2026
Merged

fix(agents): alias Pi tool names that collide with its built-ins#335
zzet merged 1 commit into
zzet:mainfrom
vitaliyslion:feat/pi-avoid-builtin-collision

Conversation

@vitaliyslion

Copy link
Copy Markdown
Contributor

Summary

Pi has no native MCP support — extensions register tools into a flat, unprefixed registry, and Pi lets a same-named registration silently override a built-in (read, bash, edit, write, grep, find, ls). Gortex's default facade-v1 surface includes edit and read, so the Pi bridge was overriding those two built-ins with a generic relay that doesn't match Pi's expected result shape — breaking the built-in's own rendering (edited filename showed as "...") and any extension hooked to the built-in shape (e.g. a lint-on-edit plugin expecting the native edit tool).

Changes

  • Alias only the tools that actually collide with Pi's reserved built-in names (gortex_edit, gortex_read today) instead of prefixing every Gortex tool, since a blanket prefix has previously confused the model — Gortex's own guidance and tool descriptions reference bare names elsewhere.
  • safeRegister now registers under the alias name and returns the name actually used; registerOneTool dedupes against the aliased name.
  • Session orientation now appends a short Pi-local note listing any renamed tools this session, so the model knows to translate bare names it sees in Gortex's guidance into the aliased ones.
  • This logic lives entirely in the Pi extension (internal/agents/pi/extension/index.ts) — no server-side/shared code changed, since the collision is specific to Pi's flat tool registry.
  • Regenerated the golden extension snapshot (cmd/gortex/testdata/agent-render/pi.txt).

Testing

  • All tests pass (go test -race ./...)
  • New tests added for new functionality — covered by the existing golden-snapshot test (TestAgentsRenderGolden) for the embedded extension source; no separate unit test added
  • Benchmarks run if performance-relevant — not applicable

Checklist

  • Code follows existing patterns in the codebase
  • No unnecessary abstractions added
  • Language extractor includes Meta["methods"] for interfaces (if applicable) — not applicable
  • Methods have EdgeMemberOf edges to their containing type (if applicable) — not applicable

@zzet
zzet merged commit f581d04 into zzet:main Jul 25, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants