core-agent-ide/codex-rs/protocol/src
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
..
prompts chore(core) rm Feature::RequestRule (#11866) 2026-02-16 22:30:23 +00:00
account.rs add error messages for the go plan type (#10181) 2026-01-30 01:17:25 +00:00
approvals.rs feat(core): plumb distinct approval ids for command approvals (#12051) 2026-02-18 01:55:57 +00:00
config_types.rs Sync collaboration mode naming across Default prompt, tools, and TUI (#10666) 2026-02-04 23:03:28 -08:00
custom_prompts.rs [app-server] remove serde(skip_serializing_if = "Option::is_none") annotations (#5939) 2025-10-30 18:18:53 +00:00
dynamic_tools.rs feat(app-server, core): allow text + image content items for dynamic tool outputs (#10567) 2026-02-04 16:12:47 -08:00
items.rs Restore phase when loading from history (#12244) 2026-02-19 09:56:56 -08:00
lib.rs feat: add MCP protocol types and rmcp adapters (#10356) 2026-02-02 08:41:02 -08:00
mcp.rs feat: replace custom mcp-types crate with equivalents from rmcp (#10349) 2026-02-02 17:41:55 -08:00
message_history.rs Generate JSON schema for app-server protocol (#5063) 2025-10-20 11:45:11 -07:00
models.rs feat: add Reject approval policy with granular prompt rejection controls (#12087) 2026-02-19 11:41:49 -08:00
num_format.rs Fix execpolicy parsing for multiline quoted args (#9565) 2026-01-22 22:16:53 -08:00
openai_models.rs fix: show user warning when using default fallback metadata (#11690) 2026-02-15 18:46:05 -08:00
parse_command.rs [app-server] remove serde(skip_serializing_if = "Option::is_none") annotations (#5939) 2025-10-30 18:18:53 +00:00
plan_tool.rs Plan mode: stream proposed plans, emit plan items, and render in TUI (#9786) 2026-01-30 18:59:30 +00:00
protocol.rs feat: add Reject approval policy with granular prompt rejection controls (#12087) 2026-02-19 11:41:49 -08:00
request_user_input.rs Better handling skill depdenencies on ENV VAR. (#9017) 2026-01-29 14:13:30 -05:00
thread_id.rs feat: sqlite 1 (#10004) 2026-01-28 15:29:14 +01:00
user_input.rs [connectors] Support connectors part 2 - slash command and tui (#9728) 2026-01-28 19:51:58 -08:00