Hello,

Please find attached a small OpenBSD-specific patch for the Codex
app-server daemon.

Codex uses ps to obtain the process state and start time when
identifying a running daemon.

On OpenBSD, the lstart output can depend on the locale and timezone,
causing inconsistent comparisons between sessions.

The patch sets LC_ALL=C and TZ=UTC for the ps invocation, making
the reported start time consistent regardless of the calling
environment.

Other platforms remain unchanged.

Thanks,
David.
Index: devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
===================================================================
RCS file: devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
diff -N devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs	18 Oct 2026 16:10:35 -0000
@@ -0,0 +1,21 @@
+OpenBSD uses the generic ps-based process identity. Keep its lstart string
+independent of the invoking client's locale and timezone so start/stop from
+different terminals can verify the same daemon. Other platforms are unchanged.
+
+Index: codex-rs/app-server-daemon/src/backend/pid.rs
+--- codex-rs/app-server-daemon/src/backend/pid.rs.orig
++++ codex-rs/app-server-daemon/src/backend/pid.rs
+@@ -746,8 +746,11 @@ async fn read_process_start_time(pid: u3
+ 
+ #[cfg(unix)]
+ async fn read_process_details(pid: u32) -> Result<(String, String)> {
+-    let output = Command::new("ps")
+-        .args(["-p", &pid.to_string(), "-o", "stat=", "-o", "lstart="])
++    let mut command = Command::new("ps");
++    command.args(["-p", &pid.to_string(), "-o", "stat=", "-o", "lstart="]);
++    #[cfg(target_os = "openbsd")]
++    command.env("LC_ALL", "C").env("TZ", "UTC");
++    let output = command
+         .output()
+         .await
+         .context("failed to invoke ps for pid-managed app server")?;

Reply via email to