Repository navigation
refactor(agent): remove the dead executeTool approval route - #1160
Merged
Merged
Conversation
The state machine's EvaluatingToolsState is the only approval gate: it routes batches with approval-requiring tools to ApprovingTools or BlockingTools, so executeToolCallsParallel only ever received batches that need none. Its re-check of the approval policy, createRejectionEntry and the hasRejection turn-stop in handleToolResults were unreachable and had drifted from the live path. Delete them, leaving buildRejectionEntry as the single rejection builder and finishApprovals/AnyToolRejected as the single stop-the-turn rule. Document on ToolExecutionResult.Rejected that it marks a human rejection which ends the turn, while a judge rejection is a plain failure. Closes #1153
edenreich
commented
Sep 2, 2026
Contributor
|
🎉 This PR is included in version 0.188.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
Resolves #1153.
The older
executeToolapproval route was dead:EvaluatingToolsStatesends any batch containing an approval-requiring tool toApprovingTools/BlockingTools, soexecuteToolCallsParallelonly ever received batches needing no approval. Its re-check of the policy,createRejectionEntry, and thehasRejectionturn-stop inhandleToolResultswere unreachable and had drifted from the live path.executeToolCallsParallel, the approval branch ofexecuteTool,createRejectionEntry, and the rejection branch ofhandleToolResults.checkToolResultsStatusbecomescheckPlanApproval.buildRejectionEntry(states) is now the single rejection-entry builder;finishApprovalsviaAnyToolRejectedis the single stop-the-turn rule.ToolExecutionResult.Rejected: human rejection ends the turn, judge rejection is a plain failure so the driver continues.TestExecuteToolCallsParallel_NeverRequestsApprovalpins that the route never consults the policy or prompts.Test plan
go test ./internal/agent/... -racetask precommit:run