-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: enable multiple native tool calls per turn with failure guardrails #9273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Review completed. All previously flagged issues have been resolved:
The latest commits successfully address the feedback from previous reviews. No new issues found. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty awesome - do you think it should be its own setting, or just go for it? I don’t have a great sense for how risky it is.
bc41502 to
53aceb0
Compare
Review completed. Found 1 code quality issue:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Summary
This PR enables the native tool protocol to execute multiple tools per assistant message turn, with comprehensive failure guardrails to ensure safe execution.
Key Features
1. Multiple Native Tool Calls Per Turn
didAlreadyUseToolrestriction for native protocol2. Tool Failure Guardrail System
didToolFailInCurrentTurnflag to preventattempt_completionafter tool failuresread_file: failure!→attempt_completion: blocked!read_file: failure!→ user message →attempt_completion: allowed!3. System Prompt Updates
4. Tool Result Handling
Technical Details
Protocol Detection:
Failure Tracking:
task.didToolFailInCurrentTurn = truestartNewApiRequest()attempt_completiontoolTools Updated (19 total):
ReadFileTool, WriteToFileTool, ApplyDiffTool, InsertContentTool, ExecuteCommandTool, BrowserActionTool, GenerateImageTool, UseMcpToolTool, AskFollowupQuestionTool, SwitchModeTool, NewTaskTool, UpdateTodoListTool, CodebaseSearchTool, SearchFilesTool, ListFilesTool, ListCodeDefinitionNamesTool, FetchInstructionsTool, RunSlashCommandTool
Verified Behavior
✅ XML Protocol: Single tool per message with step-by-step confirmation
✅ Native Protocol: Multiple tools per message with intelligent chaining
✅ Failure Blocking: Tool failures block
attempt_completionin same message✅ Cross-Turn Recovery: User can override in subsequent turns
Example Scenarios
Native Protocol - Success:
Native Protocol - Failure (Same Turn):
Cross-Turn Recovery:
Testing
Breaking Changes
None - XML protocol behavior unchanged, native protocol gets new capabilities
Important
Enable multiple native tool calls per turn with failure guardrails, updating
presentAssistantMessage,Task, and i18n error messages.presentAssistantMessage.didToolFailInCurrentTurnflag inTaskto manage tool failure states.attempt_completionif any tool fails in the current turn.attempt_completionguardrail inattemptCompletionTool.spec.ts.This description was created by
for 999c0ca. You can customize this summary. It will automatically update as commits are pushed.