Use kind instead of optionId when checking ACP tool permissions
#2886
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
Fixes an issue with the codex-acp tool. Codex uses a different value for
optionIdandkind. Existing code checked if theoptionIdwas one of thekindvalues which it would never be and therefore all tool calls would be rejected. This only occurs whenauto_approve_tool_permissionsis set tofalse.Cause
Codex returned the following messages when ACP was used.
The important thing here is that
optionId != kind. In/llm_tools/helpers.luaa check was done whether the option id wasallow,allow_once, etc. in order to determine if the user approved the action or not.This check would always fail when codex was used because
approvedisn't in this list. Resulting in the tool call being rejected no matter the selected option.The fix
Using
kindsolves the issue of arbitrary values for theoptionId. TheoptionIdis still used for the ACP communication, in/llm.lua:1223it looks at a map of the options containing the correct ids to determine what to send.Sidenotes
auto_approve_tool_permissions=false