Skip to content

feat(hooks): add PermissionRequest hook#3855

Open
AresNing wants to merge 1 commit into
esengine:main-v2from
AresNing:feat/permission-request-hook
Open

feat(hooks): add PermissionRequest hook#3855
AresNing wants to merge 1 commit into
esengine:main-v2from
AresNing:feat/permission-request-hook

Conversation

@AresNing

@AresNing AresNing commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a dedicated PermissionRequest hook event for real tool approval prompts
  • include tool match support plus subject in the hook payload
  • keep plan approvals, policy allow/session grants, and YOLO/auto approvals from firing the hook

Validation

  • go test ./internal/hook ./internal/control ./internal/cli ./internal/boot ./internal/permission ./internal/agent
  • go test ./...

Closes #3661

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development tui Terminal UI / CLI (internal/cli, internal/control) agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) labels Jun 10, 2026
@AresNing AresNing marked this pull request as ready for review June 11, 2026 09:21

Copy link
Copy Markdown
Collaborator

Thanks, this is directionally right for #3661. I prepared the rebase/fix locally, but this branch has maintainer edits disabled, so I cannot push directly to AresNing:feat/permission-request-hook.

Please either enable maintainer edits or rebase onto the latest main-v2 and apply these fixes:

  • Keep both the current jobs tests/import and the new PermissionRequest tests when resolving internal/control/controller_test.go.
  • Update the session-grant test to use the current SessionGrantRuleForScope(tool, subject) API.
  • Pass nil tool args to the remaining requestApproval(..., "remember"/"forget", "") calls in internal/control/yolo_test.go.
  • Add an explicit auto-approval-mode regression that uses ToolApprovalAuto through c.newInteractiveGate() and verifies PermissionRequest does not fire when the approval prompt is bypassed.

I verified the prepared fix with:

  • go test ./internal/hook ./internal/control ./internal/cli ./internal/boot ./internal/permission ./internal/agent
  • go test ./...

Once this is rebased and CI stays green, I will consider merging it into main-v2.

Copy link
Copy Markdown
Collaborator

Follow-up: I opened #4319 as a maintainer integration PR that brings this PermissionRequest hook work onto the latest main-v2, keeps @AresNing credited as the primary author of the original implementation, adds the explicit auto-approval regression, and also includes the related move_file approval-flow fix for #4310.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(hooks): add PermissionRequest hook event for permission approval notifications

2 participants