pub struct NonInteractivePolicy { /* private fields */ }Expand description
Adapts any inner policy to a non-interactive semantics: when the inner policy returns
PolicyDecision::Ask, it is downgraded to PolicyDecision::Deny; Allow /
Deny are passed through unchanged.
Used for nested turns of a subagent (spawn_agent) — the subagent has no human
present to answer permission requests. If Ask were allowed into the main loop, it
would permanently hang on PermissionGate. Wrapping
with this policy ensures the sub-turn never blocks and never escalates privileges:
the subagent’s actual authorization is always ≤ that of the wrapped parent policy
(what the parent would Ask, the child directly Denys).
This is a separate gate from “tool allowlist trimming”: the allowlist determines which tools the subagent sees, while this policy determines how much access is granted at runtime on those tools.