Skip to content

Do not send reason as content on permission request#171

Open
SteffenDE wants to merge 1 commit into
agentclientprotocol:mainfrom
SteffenDE:sd-permission-content
Open

Do not send reason as content on permission request#171
SteffenDE wants to merge 1 commit into
agentclientprotocol:mainfrom
SteffenDE:sd-permission-content

Conversation

@SteffenDE
Copy link
Copy Markdown
Contributor

According to the specification, the permissionRequest contains a ToolCallUpdate, which - again according to the spec - "Replace[s] the content collection."

https://agentclientprotocol.com/protocol/v1/schema#param-content-13

This means that if the agent sends a tool call with a diff for file edits and then the permission request, a typical client would replace the the diff with just the reason text.

I'd say that either ACP should add a new field reason to RequestPermissionRequest, or we use the existing _meta field to include the reason for clients that want to handle it specially.

(cc @benbrandt)

This PR moves the reason into _meta.

This also solves the problem I had initially in #126, where I didn't see any file content and Codex wrongly assumed that it needs to handle more events.

According to the specification, the permissionRequest contains a `ToolCallUpdate`,
which - again according to the spec - "Replace[s] the content collection."

https://agentclientprotocol.com/protocol/v1/schema#param-content-13

This means that if the agent sends a tool call with a diff for file edits and then
the permission request, a typical client would replace the the diff with just
the reason text.

I'd say that either ACP should add a new field `reason` to
`RequestPermissionRequest`, or we use the existing `_meta` field to include
the reason for clients that want to handle it specially.

This PR moves the reason into _meta.
rawInput: params.command ? { command: stripShellPrefix(params.command), cwd: params.cwd } : null,
},
options: APPROVAL_OPTIONS,
_meta: { codex: { params } }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, we could also cherry-pick specific fields only.

@benbrandt
Copy link
Copy Markdown
Member

Maybe silly question... but content is an array, can we not have both?

Copy link
Copy Markdown
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, I think not overwriting the diff is the right choice here

@SteffenDE
Copy link
Copy Markdown
Contributor Author

I'm not sure what you're trying to say? If the permissionRequest contains content in the tool call update, the value from the permission request should replace the existing content (e.g. diffs). What codex-acp could do is send the previous content and append the reason as text as another item in the content, but then the question is if this should remain in the content forever or a future update (e.g. completed) should remove it again, but tracking that seems unnecessarily complex.

I'd argue that the reason for a tool call request is something different than the tool call's content, so it shouldn't be mixed.

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.

2 participants