Ignore reusable command approvals for cyber models (#37516)

## What changed

- Filter saved `allow` prefix rules from the execution policy for cyber-specialized models and models listed in `auto_review.ignore_rules`, while preserving prompt, forbidden, network, and host-executable policy entries.
- Apply the filtered policy consistently to permission instructions, shell commands, unified exec, and the zsh-fork backend.
- Limit cyber-model command approvals to one-time decisions without proposing reusable policy amendments. General models continue to honor saved prefixes, including after switching models within a thread.

## Testing

- Add policy-level coverage for filtering allow-prefix rules while retaining restrictive and network rules.
- Add end-to-end coverage across shell and unified exec paths, zsh-fork execution, user and automatic review, and model switching.

GitOrigin-RevId: f3bd3872424291b12354ec415f33986ec369a368
This commit is contained in:
andrewgu-oai authored and copyberry committed 2026-08-08 00:59:39 +00:00
1 parent c2bcb9a26b
commit e734a1a5c1
16 files changed
+717 -14

No files matched your search

@@ -172,7 +172,12 @@ pub(super) async fn try_run_zsh_fork(
.unwrap_or(crate::exec::DEFAULT_EXEC_COMMAND_TIMEOUT_MS),
);
let exec_policy = Arc::new(RwLock::new(
ctx.session.services.exec_policy.current().as_ref().clone(),
ctx.session
.services
.exec_policy
.current_for_prefix_rules(ctx.turn.allow_prefix_rules())
.as_ref()
.clone(),
));
// TODO(anp): Keep PathUri through the shell escalation boundary.
let sandbox_cwd = sandbox_cwd
@@ -280,7 +285,12 @@ pub(crate) async fn prepare_unified_exec_zsh_fork(
}
let exec_policy = Arc::new(RwLock::new(
ctx.session.services.exec_policy.current().as_ref().clone(),
ctx.session
.services
.exec_policy
.current_for_prefix_rules(ctx.turn.allow_prefix_rules())
.as_ref()
.clone(),
));
// TODO(anp): Keep PathUri through the zsh-fork executor boundary.
let cwd = exec_request