@@ -453,6 +453,7 @@ enum Outcome {
453453 ExecApproval {
454454 decision : ReviewDecision ,
455455 expected_reason : Option < & ' static str > ,
456+ expect_proposed_execpolicy_amendment : bool ,
456457 } ,
457458 PatchApproval {
458459 decision : ReviewDecision ,
@@ -773,6 +774,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
773774 outcome: Outcome :: ExecApproval {
774775 decision: ReviewDecision :: Approved ,
775776 expected_reason: None ,
777+ expect_proposed_execpolicy_amendment: false ,
776778 } ,
777779 expectation: Expectation :: FileCreated {
778780 target: TargetPath :: OutsideWorkspace ( "dfa_unless_trusted.txt" ) ,
@@ -793,6 +795,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
793795 outcome: Outcome :: ExecApproval {
794796 decision: ReviewDecision :: Approved ,
795797 expected_reason: None ,
798+ expect_proposed_execpolicy_amendment: false ,
796799 } ,
797800 expectation: Expectation :: FileCreatedNoExitCode {
798801 target: TargetPath :: OutsideWorkspace ( "dfa_unless_trusted_5_1.txt" ) ,
@@ -847,6 +850,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
847850 outcome: Outcome :: ExecApproval {
848851 decision: ReviewDecision :: Approved ,
849852 expected_reason: None ,
853+ expect_proposed_execpolicy_amendment: false ,
850854 } ,
851855 expectation: Expectation :: FileCreated {
852856 target: TargetPath :: Workspace ( "ro_on_request.txt" ) ,
@@ -867,6 +871,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
867871 outcome: Outcome :: ExecApproval {
868872 decision: ReviewDecision :: Approved ,
869873 expected_reason: None ,
874+ expect_proposed_execpolicy_amendment: false ,
870875 } ,
871876 expectation: Expectation :: FileCreatedNoExitCode {
872877 target: TargetPath :: Workspace ( "ro_on_request_5_1.txt" ) ,
@@ -931,6 +936,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
931936 outcome: Outcome :: ExecApproval {
932937 decision: ReviewDecision :: Denied ,
933938 expected_reason: None ,
939+ expect_proposed_execpolicy_amendment: false ,
934940 } ,
935941 expectation: Expectation :: FileNotCreated {
936942 target: TargetPath :: Workspace ( "ro_on_request_denied.txt" ) ,
@@ -952,6 +958,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
952958 outcome: Outcome :: ExecApproval {
953959 decision: ReviewDecision :: Approved ,
954960 expected_reason: Some ( "command failed; retry without sandbox?" ) ,
961+ expect_proposed_execpolicy_amendment: true ,
955962 } ,
956963 expectation: Expectation :: FileCreated {
957964 target: TargetPath :: Workspace ( "ro_on_failure.txt" ) ,
@@ -973,6 +980,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
973980 outcome: Outcome :: ExecApproval {
974981 decision: ReviewDecision :: Approved ,
975982 expected_reason: Some ( "command failed; retry without sandbox?" ) ,
983+ expect_proposed_execpolicy_amendment: true ,
976984 } ,
977985 expectation: Expectation :: FileCreatedNoExitCode {
978986 target: TargetPath :: Workspace ( "ro_on_failure_5_1.txt" ) ,
@@ -993,6 +1001,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
9931001 outcome: Outcome :: ExecApproval {
9941002 decision: ReviewDecision :: Approved ,
9951003 expected_reason: None ,
1004+ expect_proposed_execpolicy_amendment: false ,
9961005 } ,
9971006 expectation: Expectation :: NetworkSuccess {
9981007 body_contains: "read-only-network-ok" ,
@@ -1012,6 +1021,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
10121021 outcome: Outcome :: ExecApproval {
10131022 decision: ReviewDecision :: Approved ,
10141023 expected_reason: None ,
1024+ expect_proposed_execpolicy_amendment: false ,
10151025 } ,
10161026 expectation: Expectation :: NetworkSuccessNoExitCode {
10171027 body_contains: "read-only-network-ok" ,
@@ -1184,6 +1194,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
11841194 outcome: Outcome :: ExecApproval {
11851195 decision: ReviewDecision :: Approved ,
11861196 expected_reason: None ,
1197+ expect_proposed_execpolicy_amendment: false ,
11871198 } ,
11881199 expectation: Expectation :: FileCreated {
11891200 target: TargetPath :: Workspace ( "ro_unless_trusted.txt" ) ,
@@ -1204,6 +1215,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
12041215 outcome: Outcome :: ExecApproval {
12051216 decision: ReviewDecision :: Approved ,
12061217 expected_reason: None ,
1218+ expect_proposed_execpolicy_amendment: false ,
12071219 } ,
12081220 expectation: Expectation :: FileCreatedNoExitCode {
12091221 target: TargetPath :: Workspace ( "ro_unless_trusted_5_1.txt" ) ,
@@ -1294,6 +1306,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
12941306 outcome: Outcome :: ExecApproval {
12951307 decision: ReviewDecision :: Approved ,
12961308 expected_reason: None ,
1309+ expect_proposed_execpolicy_amendment: false ,
12971310 } ,
12981311 expectation: Expectation :: FileCreated {
12991312 target: TargetPath :: OutsideWorkspace ( "ww_on_request_outside.txt" ) ,
@@ -1331,6 +1344,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
13311344 outcome: Outcome :: ExecApproval {
13321345 decision: ReviewDecision :: Approved ,
13331346 expected_reason: Some ( "command failed; retry without sandbox?" ) ,
1347+ expect_proposed_execpolicy_amendment: false ,
13341348 } ,
13351349 expectation: Expectation :: FileCreated {
13361350 target: TargetPath :: OutsideWorkspace ( "ww_on_failure.txt" ) ,
@@ -1351,6 +1365,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
13511365 outcome: Outcome :: ExecApproval {
13521366 decision: ReviewDecision :: Approved ,
13531367 expected_reason: None ,
1368+ expect_proposed_execpolicy_amendment: false ,
13541369 } ,
13551370 expectation: Expectation :: FileCreated {
13561371 target: TargetPath :: OutsideWorkspace ( "ww_unless_trusted.txt" ) ,
@@ -1413,6 +1428,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
14131428 outcome: Outcome :: ExecApproval {
14141429 decision: ReviewDecision :: Approved ,
14151430 expected_reason: Some ( DEFAULT_UNIFIED_EXEC_JUSTIFICATION ) ,
1431+ expect_proposed_execpolicy_amendment: false ,
14161432 } ,
14171433 expectation: Expectation :: CommandSuccess {
14181434 stdout_contains: "escalated unified exec" ,
@@ -1432,6 +1448,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
14321448 outcome: Outcome :: ExecApproval {
14331449 decision: ReviewDecision :: Denied ,
14341450 expected_reason: None ,
1451+ expect_proposed_execpolicy_amendment: false ,
14351452 } ,
14361453 expectation: Expectation :: CommandFailure {
14371454 output_contains: "rejected by user" ,
@@ -1508,6 +1525,7 @@ async fn run_scenario(scenario: &ScenarioSpec) -> Result<()> {
15081525 Outcome :: ExecApproval {
15091526 decision,
15101527 expected_reason,
1528+ expect_proposed_execpolicy_amendment,
15111529 } => {
15121530 let command = expected_command
15131531 . as_deref ( )
@@ -1521,6 +1539,17 @@ async fn run_scenario(scenario: &ScenarioSpec) -> Result<()> {
15211539 scenario. name
15221540 ) ;
15231541 }
1542+ if * expect_proposed_execpolicy_amendment {
1543+ let amendment = approval
1544+ . proposed_execpolicy_amendment
1545+ . as_ref ( )
1546+ . expect ( "expected proposed execpolicy amendment in approval request" ) ;
1547+ assert_eq ! (
1548+ amendment. command( ) . last( ) ,
1549+ approval. command. last( ) ,
1550+ "expected proposed amendment to match the first heuristics command"
1551+ ) ;
1552+ }
15241553 test. codex
15251554 . submit ( Op :: ExecApproval {
15261555 id : "0" . into ( ) ,
0 commit comments