
Michael BolinandGitHub
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-19 18:40:41 +00:00
2026-02-16 22:01:49 +00:00
2026-02-09 20:48:58 -08:00
2026-01-13 10:22:51 -08:00
2026-02-19 18:40:41 +00:00
2026-02-17 18:17:19 +00:00
2026-02-19 09:56:20 -08:00
2026-02-16 15:28:31 +00:00
2026-02-03 02:52:26 +00:00
2026-02-19 11:41:49 -08:00
2026-02-18 19:15:07 +00:00
2026-02-19 10:38:57 -08:00
2026-02-19 09:56:56 -08:00
2026-02-17 20:19:53 -08:00
2026-02-17 11:05:22 -08:00
2026-02-19 09:56:20 -08:00
2026-02-18 17:02:49 +00:00
2026-02-19 11:41:49 -08:00
2026-02-19 19:02:29 +00:00
2026-02-17 20:19:53 -08:00
2026-02-13 12:00:16 -08:00
2026-02-12 14:10:30 -08:00
2026-01-27 11:04:23 -08:00
2026-02-18 09:27:04 -08:00
2026-02-10 16:12:31 +00:00
2026-02-17 18:32:16 -08:00
2026-02-18 01:55:57 +00:00
2026-02-19 11:32:10 +00:00
2026-02-19 11:41:49 -08:00
2026-02-10 11:46:40 -08:00
2026-02-17 20:15:54 +00:00
2026-02-13 19:02:53 -08:00
2026-02-19 09:56:20 -08:00
2026-02-19 11:41:49 -08:00
2025-11-04 17:44:02 -08:00
2026-02-18 23:21:32 -08:00
2026-01-08 21:48:30 -08:00
2026-02-19 09:56:20 -08:00
2026-02-14 04:18:12 +00:00
2026-02-07 02:39:52 +00:00
2026-02-03 11:31:12 -08:00
2026-02-19 11:41:49 -08:00
2026-02-17 20:19:53 -08:00
2026-02-19 00:00:44 -08:00
2026-02-18 18:28:34 +00:00
2025-09-24 14:29:51 -07:00
2026-01-08 15:07:30 +00:00
2026-02-13 12:48:29 -08:00
2026-02-11 18:31:14 -08:00
2026-02-17 20:19:53 -08:00
2026-02-19 11:41:49 -08:00
2026-02-19 12:52:42 -05:00
2026-02-10 10:10:24 +00:00
2026-02-10 11:45:23 -08:00
2026-01-07 17:04:53 +00:00
2026-02-10 09:38:00 -08:00
2026-02-14 04:18:12 +00:00
2026-02-09 19:26:39 -08:00
2026-01-30 22:20:02 -08:00
2026-01-18 19:22:28 -08:00
2026-01-31 19:38:06 -08:00
2026-02-12 15:41:05 -08:00
2026-01-30 18:59:30 +00:00
2025-11-28 11:34:57 +00:00
2025-12-02 11:26:27 +00:00
2026-02-19 11:41:49 -08:00
2026-02-14 19:00:01 +00:00
2026-02-12 23:30:22 +00:00
2026-02-10 07:44:21 +00:00
2026-02-14 01:43:44 +00:00
2026-02-17 23:56:35 -08:00
2026-02-17 23:56:35 -08:00
2026-02-19 11:32:10 +00:00
2026-02-10 17:03:46 -08:00
2026-02-19 13:49:12 +00:00
2026-02-10 17:03:46 -08:00
2026-02-10 07:44:21 +00:00
2026-02-12 12:49:31 +00:00
2026-02-04 16:12:47 -08:00
2026-01-30 18:59:30 +00:00
2026-01-20 16:17:38 -08:00
2026-02-10 22:44:02 -08:00
2025-11-20 11:04:11 -08:00
2026-02-19 10:38:57 -08:00
2026-02-09 20:48:58 -08:00
2026-02-09 12:42:20 -08:00
2025-09-22 17:16:02 +00:00
2026-02-14 19:00:01 +00:00
2026-02-03 02:52:26 +00:00
2026-02-05 01:52:12 +00:00
2026-01-30 16:37:56 -08:00
2026-02-12 12:48:36 -08:00
2026-02-18 13:03:16 -08:00