Michael Bolin
425fff7ad6
feat: add Reject approval policy with granular prompt rejection controls (#12087)
## Why
We need a way to auto-reject specific approval prompt categories without
switching all approvals off.
The goal is to let users independently control:
- sandbox escalation approvals,
- execpolicy `prompt` rule approvals,
- MCP elicitation prompts.
## What changed
- Added a new primary approval mode in `protocol/src/protocol.rs`:
```rust
pub enum AskForApproval {
// ...
Reject(RejectConfig),
// ...
}
pub struct RejectConfig {
pub sandbox_approval: bool,
pub rules: bool,
pub mcp_elicitations: bool,
}
```
- Wired `RejectConfig` semantics through approval paths in `core`:
- `core/src/exec_policy.rs`
- rejects rule-driven prompts when `rules = true`
- rejects sandbox/escalation prompts when `sandbox_approval = true`
- preserves rule priority when both rule and sandbox prompt conditions
are present
- `core/src/tools/sandboxing.rs`
- applies `sandbox_approval` to default exec approval decisions and
sandbox-failure retry gating
- `core/src/safety.rs`
- keeps `Reject { all false }` behavior aligned with `OnRequest` for
patch safety
- rejects out-of-root patch approvals when `sandbox_approval = true`
- `core/src/mcp_connection_manager.rs`
- auto-declines MCP elicitations when `mcp_elicitations = true`
- Ensured approval policy used by MCP elicitation flow stays in sync
with constrained session policy updates.
- Updated app-server v2 conversions and generated schema/TypeScript
artifacts for the new `Reject` shape.
## Verification
Added focused unit coverage for the new behavior in:
- `core/src/exec_policy.rs`
- `core/src/tools/sandboxing.rs`
- `core/src/mcp_connection_manager.rs`
- `core/src/safety.rs`
- `core/src/tools/runtimes/apply_patch.rs`
Key cases covered include rule-vs-sandbox prompt precedence, MCP
auto-decline behavior, and patch/sandbox retry behavior under
`RejectConfig`.
2026-02-19 11:41:49 -08:00
..
2026-02-01 23:38:43 -08:00
2026-02-10 20:09:31 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-17 11:45:04 -08:00
2026-02-09 23:10:26 -08:00
2026-02-17 11:45:04 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-11 18:31:14 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-19 11:41:49 -08:00
2026-02-19 11:41:49 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-11 17:16:27 -08:00
2026-02-05 20:04:01 +00:00
2026-02-05 23:31:04 +00:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-10 20:09:31 -08:00
2026-02-01 23:38:43 -08:00
2026-02-17 20:46:53 -08:00
2026-02-17 20:46:53 -08:00
2026-02-01 23:38:43 -08:00
2026-02-02 17:41:55 -08:00
2026-02-09 20:48:58 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-13 16:26:32 -08:00
2026-02-13 16:26:32 -08:00
2026-02-17 11:02:23 -08:00
2026-02-01 23:38:43 -08:00
2026-02-07 02:39:52 +00:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-17 20:46:53 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-09 13:30:38 -08:00
2026-02-01 23:38:43 -08:00
2026-02-17 14:53:58 -08:00
2026-02-03 14:09:37 -08:00
2026-02-17 11:05:22 -08:00
2026-02-17 14:53:58 -08:00
2026-02-01 23:38:43 -08:00
2026-02-17 14:53:58 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-03 18:15:55 -08:00
2026-02-03 18:15:55 -08:00
2026-02-19 11:41:49 -08:00
2026-02-19 11:41:49 -08:00
2026-02-13 02:05:04 +00:00
2026-02-18 15:20:03 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-18 15:20:03 -08:00
2026-02-19 11:41:49 -08:00
2026-02-19 11:41:49 -08:00
2026-02-01 23:38:43 -08:00
2026-02-18 15:20:03 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-18 15:20:03 -08:00
2026-02-19 11:41:49 -08:00
2026-02-19 11:41:49 -08:00
2026-02-18 15:20:03 -08:00
2026-02-01 23:38:43 -08:00
2026-02-17 14:53:58 -08:00
2026-02-01 23:38:43 -08:00
2026-02-18 15:20:03 -08:00
2026-02-17 20:46:53 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-01 23:38:43 -08:00
2026-02-17 20:46:53 -08:00
2026-02-19 11:41:49 -08:00
2026-02-17 20:46:53 -08:00
2026-02-06 00:35:04 +00:00
2026-02-06 00:35:04 +00:00
2026-02-18 13:03:16 -08:00
2026-02-18 13:03:16 -08:00
2026-02-18 13:03:16 -08:00
2026-02-01 23:38:43 -08:00