Skip to content

Conversation

@nielsdekker
Copy link

Summary

Fixes an issue with the codex-acp tool. Codex uses a different value for optionId and kind. Existing code checked if the optionId was one of the kind values which it would never be and therefore all tool calls would be rejected. This only occurs when auto_approve_tool_permissions is set to false.

Cause

Codex returned the following messages when ACP was used.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "session/request_permission",
  "params": {
    "options": [
      { "optionId": "approved", "name": "Yes", "kind": "allow_once" },
      { "optionId": "abort", "name": "No, provide feedback", "kind": "reject_once" }
    ],
    // Other params
  }
}

The important thing here is that optionId != kind. In /llm_tools/helpers.lua a check was done whether the option id was allow, 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 approved isn't in this list. Resulting in the tool call being rejected no matter the selected option.

The fix

Using kind solves the issue of arbitrary values for the optionId. The optionId is still used for the ACP communication, in /llm.lua:1223 it looks at a map of the options containing the correct ids to determine what to send.

Looking at the docs the optionId is just a text value that could be anything. https://agentclientprotocol.com/protocol/tool-calls#param-option-id

Sidenotes

  • First PR on this repo so if anything is wrong or missing let me know
  • Tested only with codex (don't have a claude code subscription so I can only assume that would still work)
  • Probably fixes bug: Avante zen mode with codex doesn't do anything #2836
    • Looking at this issue the used config also has auto_approve_tool_permissions=false

llm_tools/helpers.lua Checks for `allow`, `allow_once`, and other "kind"
values. The Codex ACP uses option ids like `approved` which isn't
considered as an approval. This change makes it so the `kind` is send
instead and not the arbitrary optionId value
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.

bug: Avante zen mode with codex doesn't do anything

1 participant