Repository navigation
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Add a permission.reply plugin hook, the counterpart of permission.evaluate, that runs when a client replies to a pending permission request and lets a plugin adjust the decline message.
Motivation
In v2, Permission.reply decides how a rejection reaches the session:
- A rejection with a message fails the request with
Permission.CorrectedError. Tools convert it into aToolFailure,toSessionErrormaps it topermission.rejectedwith the feedback text, and the model continues in the same step. - A rejection without a message fails the request with
Permission.DeclinedError. It travels as a defect and ends the step.
The outcome therefore depends on whether the user typed text. Users and organizations that want every decline to be reported back to the model, with a standard explanation, have no supported way to configure that:
- V1's
experimental.continue_loop_on_denyis not supported in v2 (seemigrate-v1.mdx). permission.evaluateruns before the request is created, so it cannot see the user's reply.- Subscribing to
Permission.Event.Repliedand sending a follow-up message starts a new turn after the step has ended. The declined tool call stays recorded as aborted, and the model does not receive the explanation as that call's result.
Proposal
Trigger a permission.reply hook in Permission.reply before the reject branch decides between CorrectedError and DeclinedError:
interface PermissionReplyEvent {
readonly sessionID: Session.ID
readonly requestID: Permission.ID
readonly action: string
readonly resources: ReadonlyArray<string>
readonly metadata?: Record<string, unknown>
readonly source?: Permission.Source
readonly reply: "once" | "always" | "reject"
message?: string
}- The hook runs once per client reply, for the request the client answered.
- When the final
replyisrejectandmessageis non-empty, the existing code createsCorrectedError. The same message applies to the whole batch of pending requests in the session, as it does today. - The
replyfield is read-only, so a plugin can adjust the message and cannot turn a rejection into an approval. PluginHooks.Serviceis already available in thePermissionlayer, and the plugin side only needs a new entry inPermissionHooksnext toevaluate.
With this hook, a plugin can fill in a default message for plain rejections:
hook.reply((event) => {
if (event.reply === "reject" && !event.message) {
event.message = "The user declined this tool call. Choose a different approach or ask what they prefer."
}
})The model then receives the text as the tool failure in the same step, which is the behavior users already get when they type a reason.
Activity
opencodejr commentedon Nov 8, 2026
Thanks for the detailed proposal! To restate it: you'd like a
permission.replyplugin hook, the counterpart ofpermission.evaluate. It would run inPermission.replybefore a rejection settles the request, so a plugin can fill in a decline message. A plain rejection would then reach the model as a tool failure in the same step, instead of ending the step.I checked the code and agree that a plugin can't do this today.
PermissionHooksonly exposesevaluate, which runs before the request exists. Reacting toPermission.Event.Repliedonly works after the step has already ended. Adding areplyhook next toevaluate, withreplyread-only andmessagewritable, would cover it. I've noted this for the maintainers, who will consider it.Related issues:
mwielgosz-esky commentedon Nov 9, 2026
One more consumer constraint worth weighing for this proposal: under the ACP protocol a client can only answer a permission request with an option id. RequestPermissionResponse carries just the outcome (selected with an optionId, or cancelled) and has no field for feedback text, so an agent driven through an ACP host has no way to pass a typed decline reason through the permission response channel itself.
That makes the current behavior structural for that client class: human rejections routed through this response channel arrive as reject without a message; Permission.reply settles them as DeclinedError and the step ends for that request, while adapters may map user intent to different response flows. The engine itself already supports the model-visible path via CorrectedError. The proposed reply hook would give such agents a supported way to attach a default decline message at reply time, closing a gap that is not reachable through the protocol's response channel on those hosts.
zevisert commentedon Nov 20, 2026