Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: [IMPROVEMENT] Integrate the app server daemon into devel/codex.
To:
David Uhden Collado <daviduhden@gmail.com>
Cc:
ports@openbsd.org, stu@spacehopper.org
Date:
Wed, 14 Oct 2026 22:11:24 +0200

Download raw body.

Thread
On Wed, 14 Oct 2026 21:56:00 +0200,
David Uhden Collado <daviduhden@gmail.com> wrote:
> 
> + #[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")?;

Why this patch is specific for OpenBSD?

> ++/// A distributor-owned executable has no managed package or internal updater.
> ++/// This is a build-time choice, so the runtime environment cannot redirect it.
> ++pub(crate) fn system_codex_bin() -> Option<&'static Path> {
> ++    option_env!("CODEX_SYSTEM_DAEMON_PATH")
> ++        .filter(|path| !path.is_empty())
> ++        .map(Path::new)
> ++}

It is the same codex binary. Why do you need CODEX_SYSTEM_DAEMON_PATH?

Codex already uses path to itself.

> + /// Prepare a missing package while the caller holds the daemon operation lock.
> + pub(super) async fn prepare(daemon: &Daemon, settings: &DaemonSettings) -> Result<()> {
> ++    if let Some(path) = managed_install::system_codex_bin() {
> ++        daemon.ensure_managed_codex_bin()?;
> ++        let context = InstallContext::from_exe(
> ++            cfg!(target_os = "macos"),
> ++            Some(path),
> ++            /*method_override*/ None,
> ++        );

I very supprised to see target_os = "macos" in OpenBSD patch.

> ++        let expected = env!("CARGO_PKG_VERSION");
> ++        anyhow::ensure!(
> ++            manifest.version.to_string() == expected,
> ++            "system Codex package version {} differs from CLI version {expected}; update the codex package with pkg_add -u",
> ++            manifest.version
> ++        );
> ++        let version = tokio::time::timeout(
> ++            std::time::Duration::from_secs(5),
> ++            managed_install::managed_codex_version(path),
> ++        )
> ++        .await
> ++        .context("timed out checking the system Codex executable version")??;
> ++        anyhow::ensure!(
> ++            version == expected,
> ++            "system Codex executable version {version} differs from CLI version {expected}; update the codex package with pkg_add -u"
> ++        );
> ++        return Ok(());

Why have you invented version comparison?

> @@ -1,15 +0,0 @@
> -Disable daemon auto start by default
> -https://github.com/openai/codex/issues/48050
> -
> -Index: codex-rs/features/src/lib.rs
> ---- codex-rs/features/src/lib.rs.orig
> -+++ codex-rs/features/src/lib.rs
> -@@ -992,7 +992,7 @@ pub const FEATURES: &[FeatureSpec] = &[
> -         id: Feature::DaemonAutoStart,
> -         key: "daemon_auto_start",
> -         stage: Stage::Stable,
> --        default_enabled: true,
> -+        default_enabled: false,
> -     },
> -     FeatureSpec {
> -         id: Feature::TranscriptV2,

Are you sure that switch it on by default is good idea?

You run codex and it spawn some background daemon which lay around.

-- 
wbr, Kirill