Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: [IMPROVEMENT] Integrate the app server daemon into devel/codex.
To:
OpenBSD ports <ports@openbsd.org>, daviduhden@gmail.com
Date:
Thu, 15 Oct 2026 00:18:05 +0200

Download raw body.

Thread
  • Mike Larkin:

    [IMPROVEMENT] Integrate the app server daemon into devel/codex.

  • from another hand here is quite small approach which seems to wrok:
    
    ~ $ ps auxww | grep codex | grep app-server
    ~ $ codex app-server daemon start          
    {"status":"started","backend":"pid","pid":49277,"managedCodexPath":"/usr/local/bin/codex","managedCodexVersion":"0.162.1","socketPath":"/home/catap/.codex/app-server-control/app-server-control.sock","cliVersion":"0.162.1","appServerVersion":"0.162.1"}
    ~ $ ps auxww | grep codex | grep app-server
    catap    49277  1.6  0.1  945864  113476 ??  S      12:15AM    0:00.70 /usr/local/bin/codex app-server --listen unix:// --analytics-default-enabled --managed-daemon
    ~ $ codex app-server daemon version         
    {"status":"running","backend":"pid","managedCodexPath":"/usr/local/bin/codex","managedCodexVersion":"0.162.1","socketPath":"/home/catap/.codex/app-server-control/app-server-control.sock","cliVersion":"0.162.1","appServerVersion":"0.162.1"}
    ~ $ codex app-server daemon stop    
    {"status":"stopped","backend":"pid","managedCodexPath":"/usr/local/bin/codex","managedCodexVersion":"0.162.1","socketPath":"/home/catap/.codex/app-server-control/app-server-control.sock","cliVersion":"0.162.1"}
    ~ $ ps auxww | grep codex | grep app-server 
    ~ $ 
    
    If you willing to test here prebuild amd64 packages:
    https://kirill.korins.ky/pub/packages/codex-0.162.1p0.tgz
    
    Index: Makefile
    ===================================================================
    RCS file: /home/cvs/ports/devel/codex/Makefile,v
    diff -u -p -r1.59 Makefile
    --- Makefile	10 Oct 2026 12:50:48 -0000	1.59
    +++ Makefile	14 Oct 2026 21:12:22 -0000
    @@ -13,6 +13,7 @@ DPB_PROPERTIES =	parallel
     USE_WXNEEDED =		Yes
     
     V =			0.162.1
    +REVISION =		0
     GH_ACCOUNT =		openai
     GH_PROJECT =		codex
     GH_TAGNAME =		rust-v${V}
    Index: patches/patch-codex-rs_app-server-daemon_src_lib_rs
    ===================================================================
    RCS file: patches/patch-codex-rs_app-server-daemon_src_lib_rs
    diff -N patches/patch-codex-rs_app-server-daemon_src_lib_rs
    --- /dev/null	1 Jan 1970 00:00:00 -0000
    +++ patches/patch-codex-rs_app-server-daemon_src_lib_rs	14 Oct 2026 21:08:57 -0000
    @@ -0,0 +1,25 @@
    +Index: codex-rs/app-server-daemon/src/lib.rs
    +--- codex-rs/app-server-daemon/src/lib.rs.orig
    ++++ codex-rs/app-server-daemon/src/lib.rs
    +@@ -328,7 +328,7 @@ impl Daemon {
    +             .as_path()
    +             .to_path_buf();
    +         let state_dir = codex_home.as_path().join(STATE_DIR_NAME);
    +-        let managed_codex_bin = managed_codex_bin(codex_home.as_path());
    ++        let managed_codex_bin = std::env::current_exe()?;
    +         // Old CLIs must not mistake a daemon-owned installation for their backend.
    +         let (pid_file, update_pid_file) =
    +             if managed_codex_bin.starts_with(codex_home.as_path().join("packages/standalone")) {
    +@@ -941,6 +941,12 @@ impl Daemon {
    +         ))
    +     }
    + 
    ++    #[cfg(target_os = "openbsd")]
    ++    fn current_managed_codex_bin(&self) -> Result<PathBuf> {
    ++        Ok(self.managed_codex_bin.clone())
    ++    }
    ++
    ++    #[cfg(not(target_os = "openbsd"))]
    +     fn current_managed_codex_bin(&self) -> Result<PathBuf> {
    +         // An installer can move a legacy binary into bin/ while this updater runs.
    +         let home = self
    Index: patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
    ===================================================================
    RCS file: patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
    diff -N patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
    --- /dev/null	1 Jan 1970 00:00:00 -0000
    +++ patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs	14 Oct 2026 21:08:53 -0000
    @@ -0,0 +1,16 @@
    +Index: codex-rs/app-server-daemon/src/prepare_install.rs
    +--- codex-rs/app-server-daemon/src/prepare_install.rs.orig
    ++++ codex-rs/app-server-daemon/src/prepare_install.rs
    +@@ -24,6 +24,12 @@ pub struct InstallRequest {
    +     pub restart_required: bool,
    + }
    + 
    ++#[cfg(target_os = "openbsd")]
    ++pub(super) async fn prepare(daemon: &Daemon, _settings: &DaemonSettings) -> Result<()> {
    ++    daemon.ensure_managed_codex_bin()
    ++}
    ++
    ++#[cfg(not(target_os = "openbsd"))]
    + /// Prepare a missing package while the caller holds the daemon operation lock.
    + pub(super) async fn prepare(daemon: &Daemon, settings: &DaemonSettings) -> Result<()> {
    +     let source = InstallContext::current().package_layout.as_ref();
    
    
    -- 
    wbr, Kirill
    
    
  • Mike Larkin:

    [IMPROVEMENT] Integrate the app server daemon into devel/codex.