Skip to content

fix: delegate unknown tool calls to Pi - #12

Open
any-victor wants to merge 1 commit into
mainfrom
fix/unknown-tool-continuation
Open

fix: delegate unknown tool calls to Pi#12
any-victor wants to merge 1 commit into
mainfrom
fix/unknown-tool-continuation

Conversation

@any-victor

Copy link
Copy Markdown
Contributor

Problem

A live isolated Pi turn asked Composer 2.5 for the exact available tool names. The model attempted unavailable Grep, and pi-cursor terminated the provider response with Cursor called unadvertised tool 'Grep' instead of letting Pi return its normal tool error and continue.

Root cause

The first standalone stream mapper added advertised-name validation as an inferred fail-closed assertion. That check was not supported by the pinned formatted Cursor source and crossed the provider/host ownership boundary.

Formatted IDE 3.18.9 module 675.js:

  • maps active model-visible tools into RunInference at lines 54866–54876;
  • preserves returned tool names and arguments without validating them against that list at lines 54881–55160;
  • converts an unavailable implementation into a Tool not found result in its executor at lines 54520–54585.

Pi 0.84.4 owns the same behavior in agent-loop.js: it emits Tool <name> not found, appends the error toolResult, and starts the next provider turn.

Fix

  • continue advertising exactly Context.tools to RunInference;
  • preserve every structurally valid streamed or final-only model tool call;
  • leave ID, name presence, argument JSON, stream completion, duplicate-ID, and stream/final reconciliation checks intact;
  • delegate lookup, authorization, execution, unavailable-tool errors, and continuation to Pi.

Verification

  • mapper tests cover streamed and final-only unavailable tool calls;
  • a real Pi 0.84.4 agentLoop integration proves Grep becomes Tool Grep not found, is sent back to Cursor, and a second provider turn completes;
  • mise run verify: 115 passed, 1 host-only skip;
  • pre-push lockfile, verify, and version guards passed.

Release

Patch Changeset included.

This PR is intentionally left open for operator review and must not be merged before approval.

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.

1 participant