Kirill A. Korinsky wrote:
On Tue, 20 Oct 2026 09:05:00 +0200,
David Uhden Collado <[email protected]> wrote:

@@ -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")?;

Is it OpenBSD specific fix or behaviour?

I don't think so.

I've tried random linux and linux's ps respect TZ env settings as well.

What makes me assume that this is upstream desired behaviour or upstream
bug.

I think you need to report it to upstream.


Hello Kirill,

You're right, this is not OpenBSD-specific. The problem affects
Codex's generic Unix process identification.

In fact, the same issue was already reported upstream on macOS:

https://github.com/openai/codex/issues/43608

The report reproduces a case where changing the locale causes Codex
to discard the PID record of a still-running daemon. The issue was
closed, but the relevant code in 0.163.0 still uses the unnormalized
ps output.

Codex stores the formatted lstart string and later compares it
against another ps invocation. Different locale or timezone settings
can make the same process appear to have a different start time.

I agree that the proper upstream fix should cover all Unix platforms.
Meanwhile, setting LC_ALL=C and TZ=UTC provides a small workaround.

Thanks,
David.

Reply via email to