fix(tools): recover provider-truncated tool names - #29
Merged
ImPedro29 merged 4 commits intoAug 9, 2026
Merged
Conversation
7523ea3 swapped the tool lookup import to findToolByNameOrUniquePrefix but getToolInterruptBehavior still calls findToolByName, which would throw a ReferenceError on the cancel/interrupt path. Re-add the import.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some providers emit tool calls with truncated tool names (e.g.
Read→Rea,EnterPlanMode→EnterPlanMo). The executor failed those withNo such tool available: <name>, forcing the model to retry or give up on tools likeRead/EnterPlanMode.findToolByNameOrUniquePrefix(Tool.ts): when an exact name lookup fails, recover via prefix matching — only when the prefix is unambiguous, never for MCP tool names, and only for names ≥ 3 chars.Rearecovers asReadeven when the deferredReadMcpResourceToolis also registered (a longer prefix match).StreamingToolExecutor): recover truncated names against base tools when the definition was filtered out of the model's available set.runToolUse(toolExecution.ts) for the direct-execution path.Also includes
fix(tools): restore findToolByName import for interrupt handling— 7523ea3 swapped the import butgetToolInterruptBehaviorstill callsfindToolByName, which would throw aReferenceErroron the cancel/interrupt path.Test plan
bun test ./src/Tool.test.ts— 3 pass (new recovery cases)bun test ./src/services/tools/— 12 pass across 4 files (Tool, StreamingToolExecutor tool pairing, toolExecution, tool result pairing)Notes