Let permission hooks resolve strict auto-review requests (#32232)

## What changed

- Run permission-request hooks before routing approvals to the automated reviewer or user, including when `strict_auto_review` is enabled.
- Centralize approval resolution so hook, automated-reviewer, and user decisions share rejection handling and report the correct telemetry source.

## Testing

- Add an integration test showing that an allow hook can approve a shell command during strict auto-review without invoking the automated reviewer.

GitOrigin-RevId: 18e9d76baee6cbae9d35ae517250f2f82270a9d2
This commit is contained in:
Dylan Hurd authored and copyberry committed 2026-07-10 18:12:27 +00:00
1 parent 4472698728
commit 2da1b12822
6 files changed
+385 -154

No files matched your search

+1 -8
View File
@@ -122,18 +122,11 @@ pub(crate) struct ApprovalCtx<'a> {
pub session: &'a Arc<Session>,
pub turn: &'a Arc<TurnContext>,
pub call_id: &'a str,
/// Guardian review lifecycle ID for this approval, when guardian is reviewing it.
///
/// This is separate from `call_id`: `call_id` identifies the tool item under
/// review, while this ID identifies the review itself. Keeping both lets
/// denial handling, overrides, and app-server notifications refer to the
/// review without overloading the tool call ID as a review ID.
pub guardian_review_id: Option<String>,
pub retry_reason: Option<String>,
pub network_approval_context: Option<NetworkApprovalContext>,
}
pub(crate) type ApprovalAction = crate::guardian::GuardianApprovalRequest;
pub(crate) type ApprovalAction = super::approvals::ApprovalAction;
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct PermissionRequestPayload {