Skip to content

support PreToolUse allow and ask permissionDecision#20756

Closed
abhinav-oai wants to merge 2 commits into
codex/centralize-approval-promptsfrom
codex/pretooluse-allow-ask
Closed

support PreToolUse allow and ask permissionDecision#20756
abhinav-oai wants to merge 2 commits into
codex/centralize-approval-promptsfrom
codex/pretooluse-allow-ask

Conversation

@abhinav-oai
Copy link
Copy Markdown
Collaborator

@abhinav-oai abhinav-oai commented May 2, 2026

What

Adds support for PreToolUse hook permissionDecision: "allow" and permissionDecision: "ask" outcomes while preserving the existing deny behavior.

  1. PreToolUse hook output is parsed once in codex-hooks.
  2. The hook runtime returns either a block, no directive, or a typed permission directive.
  3. ToolRegistry attaches that directive to the tool invocation before dispatch.
  4. Shell-like tools carry it into the shared ToolOrchestrator, where it is applied beside the existing approval requirement:
    • allow approves the request without running permission prompts or guardian review
    • ask requests a user prompt directly, suppressing guardian review and PermissionRequest hook evaluation for that forced prompt
  5. MCP calls receive the same directive at their approval boundary and apply equivalent behavior there.

Design decisions

  • Build on the existing ApprovalRequest / centralized approval-routing work instead of adding another parallel decision system. The new directive changes routing policy, while the existing approval machinery still owns prompt construction and decision handling.
  • Keep PreToolUse responsible only for the hook verdict. The directive is attached to the invocation once and consumed at the approval boundary, which avoids re-running hooks or plumbing bespoke flags through unrelated layers.
  • Preserve hard forbids. allow bypasses prompts and guardian review, but it does not override an approval requirement that is already classified as Forbidden.
  • Keep ask explicitly user-facing. It bypasses guardian review and cached/automatic approval shortcuts so the hook can reliably force a human confirmation path.
  • Leave defer out of scope for now because this change only adds the Claude-compatible behaviors we can map cleanly onto the current approval model.

@abhinav-oai abhinav-oai changed the title [codex] support PreToolUse allow and ask decisions support PreToolUse allow and ask permissionDecision May 2, 2026
@abhinav-oai abhinav-oai closed this May 4, 2026
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.

1 participant