mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
Stabilize app-server and login integration tests (#62102)
## What changed - Run guardian action-budget permission hooks locally with a host-accessible working directory, and apply the test timeout to thread startup. - Use an empty probe file for the process-spawn handshake, removing the content assertion after file creation is detected. - Remove the explicit graceful shutdown from the config-server login/logout test. - Wait for fallback login cancellation to finish and assert that it returns an error, replacing the two-second timeout. GitOrigin-RevId: a696834162bf910bf114c35648366a4f94bb56f2
This commit is contained in:
@@ -64,9 +64,7 @@ async fn config_server_settings_survive_openai_login_and_logout() -> Result<()>
|
||||
let started = app.start_thread(ThreadStartParams::default()).await?;
|
||||
setup
|
||||
.assert_turn_uses_managed_instructions(&mut app, &started.thread.id)
|
||||
.await?;
|
||||
app.shutdown_gracefully().await?;
|
||||
Ok(())
|
||||
.await
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
|
||||
@@ -129,18 +129,26 @@ with urllib.request.urlopen(request, timeout=30) as response:
|
||||
))
|
||||
.enable_feature(Feature::GuardianApproval)
|
||||
.write(codex_home.path())?;
|
||||
// The permission hooks run on the host and call back to its loopback server.
|
||||
// Their working directory must exist on that host even in remote-executor CI.
|
||||
let mut app_server = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.without_auto_env()
|
||||
.with_env_overrides(&[(codex_exec_server::CODEX_EXEC_SERVER_URL_ENV_VAR, None)])
|
||||
.build_initialized_with_timeout(TIMEOUT)
|
||||
.await?;
|
||||
let thread = app_server
|
||||
.start_thread(ThreadStartParams::default())
|
||||
.await?
|
||||
.thread;
|
||||
let start = app_server
|
||||
.send_thread_start_request(ThreadStartParams {
|
||||
cwd: Some(codex_home.path().display().to_string()),
|
||||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
let thread: codex_app_server_protocol::ThreadStartResponse =
|
||||
timeout(TIMEOUT, app_server.read_response(start)).await??;
|
||||
state.allow_guardian_review.notify_one();
|
||||
let id = app_server
|
||||
.send_turn_start_request(TurnStartParams {
|
||||
thread_id: thread.id,
|
||||
thread_id: thread.thread.id,
|
||||
input: vec![UserInput::Text {
|
||||
text: USER_CONTEXT.to_owned(),
|
||||
text_elements: Vec::new(),
|
||||
|
||||
@@ -38,7 +38,7 @@ async fn process_spawn_returns_before_exit_and_emits_exit_notification() -> Resu
|
||||
"-NonInteractive".to_string(),
|
||||
"-Command".to_string(),
|
||||
concat!(
|
||||
"[IO.File]::WriteAllText($env:CODEX_PROCESS_EXEC_PROBE_FILE, 'process'); ",
|
||||
"[IO.File]::WriteAllText($env:CODEX_PROCESS_EXEC_PROBE_FILE, ''); ",
|
||||
"while (!(Test-Path -LiteralPath $env:CODEX_PROCESS_EXEC_RELEASE_FILE)) { ",
|
||||
"Start-Sleep -Milliseconds 20 ",
|
||||
"}; ",
|
||||
@@ -52,7 +52,7 @@ async fn process_spawn_returns_before_exit_and_emits_exit_notification() -> Resu
|
||||
"sh".to_string(),
|
||||
"-c".to_string(),
|
||||
concat!(
|
||||
"printf process > \"$CODEX_PROCESS_EXEC_PROBE_FILE\"; ",
|
||||
": > \"$CODEX_PROCESS_EXEC_PROBE_FILE\"; ",
|
||||
"while [ ! -e \"$CODEX_PROCESS_EXEC_RELEASE_FILE\" ]; do sleep 0.05; done; ",
|
||||
"printf 'process-out|%s|%s' \"$OpenAI_Federation_Rule_Id\" \"$OPENAI_IDENTITY_TOKEN_FILE\"; ",
|
||||
"printf process-err >&2",
|
||||
@@ -93,7 +93,6 @@ async fn process_spawn_returns_before_exit_and_emits_exit_notification() -> Resu
|
||||
assert_eq!(response.result, serde_json::json!({}));
|
||||
|
||||
wait_for_file(&probe_file).await?;
|
||||
assert_eq!(std::fs::read_to_string(&probe_file)?, "process");
|
||||
std::fs::write(&release_file, "release")?;
|
||||
|
||||
let exited = read_process_exited(&mut mcp).await?;
|
||||
|
||||
Reference in New Issue
Block a user