From a1156f04753ef51bf63690e34a030a010c4c39dc Mon Sep 17 00:00:00 2001 From: starr-openai Date: Thu, 28 May 2026 23:30:54 -0700 Subject: [PATCH] Fix remote hook CI regressions --- codex-rs/core/src/unified_exec/process.rs | 5 ++++- codex-rs/exec-server/src/local_process.rs | 4 +++- codex-rs/hooks/src/registry.rs | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/codex-rs/core/src/unified_exec/process.rs b/codex-rs/core/src/unified_exec/process.rs index d670a55c62..c1b1d1657f 100644 --- a/codex-rs/core/src/unified_exec/process.rs +++ b/codex-rs/core/src/unified_exec/process.rs @@ -137,7 +137,10 @@ impl UnifiedExecProcess { .await .map_err(|_| UnifiedExecError::WriteToStdin), ProcessHandle::ExecServer(process_handle) => { - match process_handle.write(Some(data.to_vec()), false).await { + match process_handle + .write(Some(data.to_vec()), /*close_stdin*/ false) + .await + { Ok(response) => match response.status { WriteStatus::Accepted => Ok(()), WriteStatus::UnknownProcess | WriteStatus::StdinClosed => { diff --git a/codex-rs/exec-server/src/local_process.rs b/codex-rs/exec-server/src/local_process.rs index 31efbe16cd..85af1412cc 100644 --- a/codex-rs/exec-server/src/local_process.rs +++ b/codex-rs/exec-server/src/local_process.rs @@ -102,7 +102,9 @@ impl Default for LocalProcess { fn default() -> Self { let (outgoing_tx, mut outgoing_rx) = mpsc::channel::(NOTIFICATION_CHANNEL_CAPACITY); - tokio::spawn(async move { while outgoing_rx.recv().await.is_some() {} }); + if let Ok(handle) = tokio::runtime::Handle::try_current() { + handle.spawn(async move { while outgoing_rx.recv().await.is_some() {} }); + } Self::new(RpcNotificationSender::new(outgoing_tx)) } } diff --git a/codex-rs/hooks/src/registry.rs b/codex-rs/hooks/src/registry.rs index e78e1e2060..824d9f41e9 100644 --- a/codex-rs/hooks/src/registry.rs +++ b/codex-rs/hooks/src/registry.rs @@ -54,8 +54,9 @@ impl Default for HooksConfig { plugin_hook_load_warnings: Vec::new(), shell_program: None, shell_args: Vec::new(), - local_cwd: AbsolutePathBuf::current_dir() - .expect("test hook config should resolve current directory"), + local_cwd: AbsolutePathBuf::current_dir().unwrap_or_else(|err| { + panic!("test hook config should resolve current directory: {err}") + }), environment_manager: Arc::new(EnvironmentManager::default_for_tests()), } }