Stabilize approval scenario tests (#36146)

## What changed

- Seed approval scenarios with the bundled model catalog so their model metadata is deterministic.
- Make the patch approval helper surface unexpected exec approvals, errors, aborts, and shutdowns immediately instead of waiting for its timeout.

GitOrigin-RevId: b5ec88494ecaf571a480b4142300eb5f3f98def9
This commit is contained in:
jif
2026-07-30 12:18:15 +00:00
committed by copyberry
parent 5ad367fb95
commit 5a1097ed26
+9 -1
View File
@@ -8,6 +8,7 @@ use codex_core::config::Constrained;
use codex_core::config::ThreadStoreConfig;
use codex_core::sandboxing::SandboxPermissions;
use codex_features::Feature;
use codex_models_manager::bundled_models_response;
use codex_protocol::approvals::NetworkApprovalProtocol;
use codex_protocol::approvals::NetworkPolicyAmendment;
use codex_protocol::approvals::NetworkPolicyRuleAction;
@@ -808,7 +809,12 @@ async fn expect_patch_approval(
|event| {
matches!(
event,
EventMsg::ApplyPatchApprovalRequest(_) | EventMsg::TurnComplete(_)
EventMsg::ApplyPatchApprovalRequest(_)
| EventMsg::ExecApprovalRequest(_)
| EventMsg::Error(_)
| EventMsg::TurnAborted(_)
| EventMsg::ShutdownComplete
| EventMsg::TurnComplete(_)
)
},
Duration::from_secs(15),
@@ -1852,8 +1858,10 @@ async fn run_scenario(scenario: &ScenarioSpec) -> Result<()> {
let model = model_override.unwrap_or("gpt-5.4");
let policy_src = scenario.action.policy_src();
let thread_store_id = format!("approval-scenario-{}", scenario.name);
let model_catalog = bundled_models_response()?;
let mut builder = test_codex().with_model(model).with_config(move |config| {
config.model_catalog = Some(model_catalog);
// These scenarios assert tool behavior, not rollout persistence.
config.experimental_thread_store = ThreadStoreConfig::InMemory {
id: thread_store_id,