Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .repository-projection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"projection": "deixic-code",
"projectionSchemaVersion": 1,
"sourceRepository": "dx-corp/mono",
"sourceSha": "373dd517beb6babba8f831ede8501edef7cd0520",
"sourceSha": "f85ea3e433c29ca965a8940cefa8efbb7f46c2d8",
"destinationRepository": "dx-corp/code",
"priorProjectedBase": "d30b1b01dee74cc2a51d546423e51e80ed66f31f",
"priorProjectedBase": "f273f9064fc052632b76f0a74be6fbdd1ad11f57",
"definitionDigest": "82936441c776e3e8edb5d215a75007ec9714a233f489d460075d79d5ef5ba32f",
"toolDigest": "c244d99199a7ae3eb8ff644a99462163c23b0bb6a83ef50af01efbdca0b81d04",
"contentDigest": "67278d7f71d18a40a13eb757faff25c35ae2c1e05c6f963b74ac7d6da00953b9",
"contentDigest": "489cfe5065a3880db2d45cf3cf981f2a55c119abf49fefedc69410f30176ce7b",
"publicationEligible": true
}
45 changes: 43 additions & 2 deletions packages/local-host-rs/src/agent/native_codex_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ fn fixture_event_kind(event: &FromAgent) -> &'static str {
}
}

fn codex_fixture_startup_failure(
boundary: &str,
elapsed: tokio::time::error::Elapsed,
events: &mut tokio::sync::mpsc::UnboundedReceiver<FromAgent>,
) -> ! {
let mut startup_errors = Vec::new();
while let Ok(event) = events.try_recv() {
if let FromAgent::Error { message, .. } | FromAgent::ProviderError { message, .. } = event {
startup_errors.push(message);
}
}
panic!("{boundary}: {elapsed}; startup errors: {startup_errors:?}");
}

fn configure_codex_fixture_identity() {
crate::credential_mode::install_test_identity_env();
}
Expand Down Expand Up @@ -906,7 +920,13 @@ async fn codex_cancel_lifecycle_fixture() {
}
})
.await
.expect("fixture peer should accept the turn during startup");
.unwrap_or_else(|elapsed| {
codex_fixture_startup_failure(
"fixture peer should accept the turn during startup",
elapsed,
&mut events,
)
});
tokio::time::timeout(std::time::Duration::from_secs(3), async {
loop {
match events.recv().await {
Expand Down Expand Up @@ -1607,6 +1627,9 @@ send({{method:'turn/completed',params:{{turnId:'turn-usage'}}}});}},10)}}

#[test]
fn codex_cancel_after_turn_acceptance_emits_one_terminal_lifecycle_event() {
if crate::config::test_reexec_for_process_isolation() {
return;
}
let root = tempfile::tempdir().expect("fixture root");
let current = std::env::current_exe().expect("current test binary");
let script = root.path().join("app-server.js");
Expand Down Expand Up @@ -1646,6 +1669,15 @@ else if(x.method==='turn/interrupt'){
.env("MAESTRO_CODEX_CANCEL_SCENARIO", scenario)
.env("MAESTRO_CODEX_CANCEL_LOG", &log)
.env("MAESTRO_HOME", dir.join("maestro-home"))
// This standalone child owns its policy fixture. Module-local
// managed-policy writers do not share the process snapshot lock.
.env_remove("MAESTRO_MANAGED_POLICY_PATH")
.env_remove("MAESTRO_MANAGED_POLICY_STATE_PATH")
.env_remove("MAESTRO_MANAGED_POLICY_PUBLIC_KEY")
.env_remove("MAESTRO_MANAGED_POLICY_KEY_ID")
.env_remove("MAESTRO_MANAGED_POLICY_AUDIT_PATH")
.env_remove("MAESTRO_ENTERPRISE_POLICY_PATH")
.env_remove("MAESTRO_POLICY_PATH")
.env("MAESTRO_CODEX_APP_SERVER_COMMAND", "node")
.env("OPENAI_CODEX_TOKEN", "fixture-token")
.env("RUST_BACKTRACE", "1")
Expand Down Expand Up @@ -1789,7 +1821,13 @@ async fn codex_pre_turn_failure_fixture() {
}
})
.await
.expect("turn/start observation barrier");
.unwrap_or_else(|elapsed| {
codex_fixture_startup_failure(
"turn/start observation barrier",
elapsed,
&mut events,
)
});
agent.cancel();
}
let (snapshot, errors, statuses) = receive_codex_fixture_snapshot(&mut events).await;
Expand Down Expand Up @@ -1843,6 +1881,9 @@ async fn codex_pre_turn_failure_fixture() {

#[test]
fn codex_pre_turn_failures_preserve_retry_prompt_and_discard_terminal_give_up() {
if crate::config::test_reexec_for_process_isolation() {
return;
}
let root = tempfile::tempdir().expect("fixture root");
let maestro_home = root.path().join("maestro-home");
let codex_home = root.path().join("codex-home");
Expand Down
Loading