Index | Thread | Search

From:
David Uhden Collado <daviduhden@gmail.com>
Subject:
[IMPROVEMENT] Integrate the app server daemon into devel/codex.
To:
ports@openbsd.org, kirill@korins.ky
Date:
Tue, 13 Oct 2026 18:42:00 +0000

Download raw body.

Thread
Hello,

Please find attached a patch proposing proper integration of the Codex 
app-server daemon with the OpenBSD package system.

The port already includes the daemon functionality, but upstream 
normally expects a complete standalone installation and may try to 
install another Codex executable under ~/.codex/packages. This is 
unsuitable for a package managed by pkg_add.

The proposed changes address this without disabling the daemon or 
rewriting its lifecycle management.

The CLI and app-server already share the same executable. The port now 
installs it under:

     /usr/local/libexec/codex/bin/codex

with /usr/local/bin/codex as a symlink. It also installs the code-mode 
host and a codex-package.json manifest containing the package version 
and native OpenBSD target.

The daemon resolver uses this package-owned executable instead of 
downloading or copying another installation. Version checks ensure that 
the CLI, manifest and daemon are compatible.

The existing upstream functionality remains available, including 
automatic startup for eligible sessions, process management, Unix 
sockets, JSON-RPC communication, restart and recovery.

Only internal installation and self-update mechanisms are disabled. 
Updates are handled through pkg_add -u, followed by an explicit daemon 
restart. The /daemon menu also reflects this behavior.

No Node.js, npm, additional daemon executable, rc.d service or separate 
system user is required.

The patch also includes adjustments to reduce Rust/LLVM memory 
consumption during compilation, along with OpenBSD portability fixes for V8.

I tested an installed Codex 0.162.1 package on OpenBSD 8.0-current 
amd64. The following checks passed:

- Daemon start, reuse, version reporting, restart and stop.
- WebSocket and JSON-RPC communication over a Unix socket.
- Rejection of internal updates without interrupting the daemon.
- Correct resolution of the package-owned executable.
- No additional daemon package copies under CODEX_HOME.

These are real runtime tests, although the installed package was not 
rebuilt from the attached diff during this test session. Interactive TUI 
auto-start, authenticated model sessions, the complete test suite and 
aarch64 remain untested.

I believe this provides a maintainable way to support the daemon while 
preserving OpenBSD's package management model and most of upstream's 
existing implementation.

Thank you for your time and consideration.

Best regards,
David.
? devel/codex/files
? devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
? devel/codex/patches/patch-codex-rs_app-server-daemon_src_lib_rs
? devel/codex/patches/patch-codex-rs_app-server-daemon_src_managed_install_rs
? devel/codex/patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni
? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py
? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp
? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp
? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp
? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni
? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc
? devel/codex/patches/patch-codex-rs_tui_src_app_daemon_menu_rs
Index: devel/codex/Makefile
===================================================================
RCS file: /cvs/ports/devel/codex/Makefile,v
diff -u -p -u -r1.59 Makefile
--- devel/codex/Makefile	10 Oct 2026 12:50:48 -0000	1.59
+++ devel/codex/Makefile	13 Oct 2026 18:17:59 -0000
@@ -8,11 +8,12 @@ USE_NOEXECONLY =	Yes
 
 COMMENT =		OpenAI terminal-based coding agent
 
-DPB_PROPERTIES =	parallel
+DPB_PROPERTIES =	lonesome
 
 USE_WXNEEDED =		Yes
 
 V =			0.162.1
+REVISION =		0
 GH_ACCOUNT =		openai
 GH_PROJECT =		codex
 GH_TAGNAME =		rust-v${V}
@@ -21,14 +22,14 @@ PKGNAME =		codex-${V}
 # only build the Rust workspace (the repo also contains JS tooling).
 WRKSRC =		${WRKDIST}/codex-rs
 
-DIST_TUPLE += github nornagon crossterm ed1cdab335221515706178d68495bba2aed1924f ./crossterm
-DIST_TUPLE += github openai-oss-forks tokio-tungstenite 0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186 ./tokio-tungstenite
-DIST_TUPLE += github openai-oss-forks tungstenite-rs 4fffad30fe373adbdcffab9545e9e9bf4f2fc19f ./tungstenite
-DIST_TUPLE += github helix-editor nucleo 4253de9faabb4e5c6d81d946a5e35a90f87347ee ./nucleo
-DIST_TUPLE += github modelcontextprotocol rust-sdk 3e636cab26c013eca5131103c03d20237f12c4df ./rmcp
-DIST_TUPLE += github dzbarsky rules_rust b56cbaa8465e74127f1ea216f813cd377295ad81 ./runfiles
-DIST_TUPLE += github microsoft mxc 6cd3d58f05d3447e67109cfb75e042803b843ca4 ./mxc
-DIST_TUPLE += github hyperium h3 e07e69412876f7e26f026bd75a48b2704d8c8283 ./h3
+DIST_TUPLE +=		github openai-oss-forks crossterm ed1cdab335221515706178d68495bba2aed1924f ./crossterm
+DIST_TUPLE +=		github openai-oss-forks tokio-tungstenite 0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186 ./tokio-tungstenite
+DIST_TUPLE +=		github openai-oss-forks tungstenite-rs 4fffad30fe373adbdcffab9545e9e9bf4f2fc19f ./tungstenite
+DIST_TUPLE +=		github helix-editor nucleo 4253de9faabb4e5c6d81d946a5e35a90f87347ee ./nucleo
+DIST_TUPLE +=		github dzbarsky rules_rust b56cbaa8465e74127f1ea216f813cd377295ad81 ./runfiles
+DIST_TUPLE +=		github microsoft mxc 6cd3d58f05d3447e67109cfb75e042803b843ca4 ./mxc
+DIST_TUPLE +=		github hyperium h3 e07e69412876f7e26f026bd75a48b2704d8c8283 ./h3
+DIST_TUPLE +=		github modelcontextprotocol rust-sdk 3e636cab26c013eca5131103c03d20237f12c4df ./rust-sdk
 
 MAINTAINER =		Kirill A. Korinsky <kirill@korins.ky>
 
@@ -39,8 +40,8 @@ HOMEPAGE =		https://github.com/openai/co
 # Apache 2.0
 PERMIT_PACKAGE =	Yes
 
-WANTLIB += ${MODCARGO_WANTLIB} bz2 crypto dbus-1 execinfo lzma
-WANTLIB += m onig ssl util
+WANTLIB +=		${MODCARGO_WANTLIB} bz2 crypto dbus-1 execinfo lzma
+WANTLIB +=		m onig ssl util
 
 BUILD_DEPENDS =		devel/cmake/core \
 			devel/git \
@@ -57,7 +58,7 @@ RUN_DEPENDS =		lang/python/3 \
 
 MODULES =		devel/cargo
 
-CONFIGURE_STYLE = 	cargo
+CONFIGURE_STYLE =	cargo
 
 COMPILER =		base-clang
 
@@ -85,16 +86,27 @@ MODCARGO_ENV +=		V8_FROM_SOURCE=1 \
 			use_glib=false \
 			v8_enable_cet_ibt=true"
 
+# Keep large Rust crates buildable on memory-constrained hosts.
+MAKE_JOBS =		1
+MODCARGO_ENV +=		CARGO_PROFILE_RELEASE_LTO=off
+
 # Makes the build look more alive while compiling v8
 MODCARGO_BUILD_ARGS +=	-vv
 
-MODCARGO_INSTALL_TARGET_PATHS = cli code-mode-host
+MODCARGO_INSTALL_TARGET_PATHS =	cli code-mode-host
 
 MODCARGO_BUILD_ARGS +=	-p codex-cli \
 			-p codex-code-mode-host \
 			--bin codex \
 			--bin codex-code-mode-host
 
+# The CLI and daemon share one executable and the same package metadata.
+# Only pkg_add installs or replaces it; Codex owns the per-user process.
+MODCARGO_ENV +=		CODEX_SYSTEM_DAEMON_PATH=${LOCALBASE}/libexec/codex/bin/codex
+
+CODEX_TARGET =		${MACHINE_ARCH:S/amd64/x86_64/}-unknown-openbsd
+SUBST_VARS +=		V CODEX_TARGET
+
 MAKE_ENV =		${MODCARGO_ENV}
 
 # test suite expects network access and a configured OpenAI account
@@ -108,15 +120,33 @@ V8_DISTDIR =		${MODCARGO_VENDOR_DIR}/v8-
 post-patch:
 	mkdir ${V8_DISTDIR}/third_party/icu/common
 	cp ${MODCARGO_VENDOR_DIR}/deno_core_icudata-${DENO_CORE_ICUDATA_V}/src/icudtl.dat \
-	    ${V8_DISTDIR}/third_party/icu/common/
+		${V8_DISTDIR}/third_party/icu/common/
+
+# Split the largest crates into smaller LLVM modules with less optimization.
+post-configure:
+.for crate in codex-core codex-tui
+	printf '%s\n' '[profile.release.package.${crate}]' \
+		'opt-level = 1' 'codegen-units = 16' \
+		>>${WRKDIR}/.cargo/config.toml
+.endfor
 
 post-build:
+	${SUBST_CMD} -m 644 -c ${FILESDIR}/codex-package.json \
+		${WRKBUILD}/codex-package.json
 .for s in bash fish zsh
 	cd ${WRKBUILD}/target/release && \
 		./codex completion $s > codex.$s
 .endfor
 
 post-install:
+	${INSTALL_DATA_DIR} ${PREFIX}/libexec/codex/bin
+	mv ${PREFIX}/bin/codex ${PREFIX}/libexec/codex/bin/
+	mv ${PREFIX}/bin/codex-code-mode-host ${PREFIX}/libexec/codex/bin/
+	ln -s ../libexec/codex/bin/codex ${PREFIX}/bin/codex
+	ln -s ../libexec/codex/bin/codex-code-mode-host \
+		${PREFIX}/bin/codex-code-mode-host
+	${INSTALL_DATA} ${WRKBUILD}/codex-package.json \
+		${PREFIX}/libexec/codex/
 	mv ${PREFIX}/bin/logs_client ${PREFIX}/bin/codex-logs-client
 	${INSTALL_DATA_DIR} ${PREFIX}/share/bash-completion/completions \
 		${PREFIX}/share/fish/vendor_completions.d \
Index: devel/codex/distinfo
===================================================================
RCS file: /cvs/ports/devel/codex/distinfo,v
diff -u -p -u -r1.57 distinfo
--- devel/codex/distinfo	10 Oct 2026 12:50:48 -0000	1.57
+++ devel/codex/distinfo	13 Oct 2026 18:17:59 -0000
@@ -1298,7 +1298,7 @@ SHA256 (helix-editor-nucleo-4253de9faabb
 SHA256 (hyperium-h3-e07e69412876f7e26f026bd75a48b2704d8c8283.tar.gz) = O52KnRCEH+J/uGyXoGvs4UEfywrPrcDKhXtjZdTl0po=
 SHA256 (microsoft-mxc-6cd3d58f05d3447e67109cfb75e042803b843ca4.tar.gz) = fNUbeETOP2JEnGCm1gKZaZL2RKsB1JbhfqWz/SoY/Dg=
 SHA256 (modelcontextprotocol-rust-sdk-3e636cab26c013eca5131103c03d20237f12c4df.tar.gz) = AZnma+bWj4BmTiC+okKDkO8krgNNZ4tYjCATFE+wF4w=
-SHA256 (nornagon-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = NTDNN30IByL2McZWbl7bSESri+j0sYXWvkoru6VZFTE=
+SHA256 (openai-oss-forks-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = NTDNN30IByL2McZWbl7bSESri+j0sYXWvkoru6VZFTE=
 SHA256 (openai-oss-forks-tokio-tungstenite-0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186.tar.gz) = odi/7fQepZ1e03XrwoDa1wmdDDOY6RQGxR1IUnAZaj0=
 SHA256 (openai-oss-forks-tungstenite-rs-4fffad30fe373adbdcffab9545e9e9bf4f2fc19f.tar.gz) = 2FOTRn3VhDaIBZuyBKYbdFDc4RZqLIqrPIdHiVX/zkg=
 SIZE (cargo/Inflector-0.11.4.tar.gz) = 17438
@@ -2601,6 +2601,6 @@ SIZE (helix-editor-nucleo-4253de9faabb4e
 SIZE (hyperium-h3-e07e69412876f7e26f026bd75a48b2704d8c8283.tar.gz) = 244832
 SIZE (microsoft-mxc-6cd3d58f05d3447e67109cfb75e042803b843ca4.tar.gz) = 5985947
 SIZE (modelcontextprotocol-rust-sdk-3e636cab26c013eca5131103c03d20237f12c4df.tar.gz) = 711661
-SIZE (nornagon-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = 162382
+SIZE (openai-oss-forks-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = 162382
 SIZE (openai-oss-forks-tokio-tungstenite-0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186.tar.gz) = 33055
 SIZE (openai-oss-forks-tungstenite-rs-4fffad30fe373adbdcffab9545e9e9bf4f2fc19f.tar.gz) = 293806
Index: devel/codex/patches/patch-codex-rs_Cargo_toml
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_Cargo_toml,v
diff -u -p -u -r1.44 patch-codex-rs_Cargo_toml
--- devel/codex/patches/patch-codex-rs_Cargo_toml	9 Oct 2026 14:39:58 -0000	1.44
+++ devel/codex/patches/patch-codex-rs_Cargo_toml	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,10 @@
+Resolve pinned Git dependencies from DIST_TUPLE sources, rather than fetching
+Git repositories during the Cargo build.
+
 Index: codex-rs/Cargo.toml
 --- codex-rs/Cargo.toml.orig
 +++ codex-rs/Cargo.toml
-@@ -322,12 +322,12 @@ codex-windows-sandbox-test-support = { path = "windows
+@@ -322,12 +322,12 @@
  core_test_support = { path = "core/tests/common" }
  
  # External
@@ -17,7 +20,7 @@ Index: codex-rs/Cargo.toml
  arboard = { version = "3", features = ["wayland-data-control"] }
  arc-swap = "1.9.0"
  assert_cmd = "2"
-@@ -415,7 +415,7 @@ memchr = "2.7.6"
+@@ -415,7 +415,7 @@
  mime_guess = "2.0.5"
  multimap = "0.10.0"
  notify = "8.2.0"
@@ -26,18 +29,18 @@ Index: codex-rs/Cargo.toml
  once_cell = "1.20.2"
  openssl-sys = "*"
  opentelemetry = "0.31.0"
-@@ -449,8 +449,8 @@ regex-lite = "0.1.8"
+@@ -449,8 +449,8 @@
  regex-syntax = "0.8.8"
  reqwest = { version = "0.12", features = ["cookies"] }
  # rmcp-v3.3.0 includes enterprise authorization helpers (rust-sdk#1234).
 -rmcp = { git = "https://github.com/modelcontextprotocol/rust-sdk", rev = "3e636cab26c013eca5131103c03d20237f12c4df", version = "=3.3.0", default-features = false }
 -runfiles = { git = "https://github.com/dzbarsky/rules_rust", rev = "b56cbaa8465e74127f1ea216f813cd377295ad81" }
-+rmcp = { path = "../rmcp/crates/rmcp", version = "=3.3.0", default-features = false }
++rmcp = { path = "../rust-sdk/crates/rmcp", version = "=3.3.0", default-features = false }
 +runfiles = { path = "../runfiles/rust/runfiles" }
  rustix = { version = "1.1.4", features = ["net"] }
  rustls = { version = "0.23.45", default-features = false, features = [
      "aws_lc_rs",
-@@ -643,12 +643,6 @@ opt-level = 0
+@@ -643,12 +643,6 @@
  [patch.crates-io]
  # Uncomment to debug local changes.
  # ratatui = { path = "../../ratatui" }
Index: devel/codex/patches/patch-codex-rs_apply-patch_src_lib_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_apply-patch_src_lib_rs,v
diff -u -p -u -r1.2 patch-codex-rs_apply-patch_src_lib_rs
--- devel/codex/patches/patch-codex-rs_apply-patch_src_lib_rs	9 Oct 2026 14:39:58 -0000	1.2
+++ devel/codex/patches/patch-codex-rs_apply-patch_src_lib_rs	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,10 @@
+Preserve the anyhow error chain when reporting patch verification failures;
+the outer error alone hides the filesystem failure useful for diagnosis.
+
 Index: codex-rs/apply-patch/src/lib.rs
 --- codex-rs/apply-patch/src/lib.rs.orig
 +++ codex-rs/apply-patch/src/lib.rs
-@@ -406,7 +406,7 @@ async fn apply_hunks_with_options(
+@@ -406,7 +406,7 @@
              Ok(delta)
          }
          Err(error) => {
Index: devel/codex/patches/patch-codex-rs_chatgpt_src_lib_rs
===================================================================
RCS file: devel/codex/patches/patch-codex-rs_chatgpt_src_lib_rs
diff -N devel/codex/patches/patch-codex-rs_chatgpt_src_lib_rs
--- devel/codex/patches/patch-codex-rs_chatgpt_src_lib_rs	8 Oct 2026 10:03:39 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-Index: codex-rs/chatgpt/src/lib.rs
---- codex-rs/chatgpt/src/lib.rs.orig
-+++ codex-rs/chatgpt/src/lib.rs
-@@ -1,5 +1,6 @@
- #![recursion_limit = "256"]
- 
-+#![recursion_limit = "256"]
- pub mod apply_command;
- mod chatgpt_client;
- pub mod connectors;
Index: devel/codex/patches/patch-codex-rs_cli_src_main_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_cli_src_main_rs,v
diff -u -p -u -r1.4 patch-codex-rs_cli_src_main_rs
--- devel/codex/patches/patch-codex-rs_cli_src_main_rs	5 Sep 2026 13:04:45 -0000	1.4
+++ devel/codex/patches/patch-codex-rs_cli_src_main_rs	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Raise the macro expansion recursion limit for the CLI to 256.
+
 Index: codex-rs/cli/src/main.rs
 --- codex-rs/cli/src/main.rs.orig
 +++ codex-rs/cli/src/main.rs
Index: devel/codex/patches/patch-codex-rs_code-mode-protocol_build_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_code-mode-protocol_build_rs,v
diff -u -p -u -r1.1 patch-codex-rs_code-mode-protocol_build_rs
--- devel/codex/patches/patch-codex-rs_code-mode-protocol_build_rs	21 Aug 2026 13:33:37 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_code-mode-protocol_build_rs	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,10 @@
+Use protoc from the protobuf build dependency instead of the vendored
+protoc binary, which has no OpenBSD release.
+
 Index: codex-rs/code-mode-protocol/build.rs
 --- codex-rs/code-mode-protocol/build.rs.orig
 +++ codex-rs/code-mode-protocol/build.rs
-@@ -5,7 +5,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
+@@ -5,7 +5,6 @@
      println!("cargo:rerun-if-changed=src/grpc");
  
      let mut config = tonic_prost_build::Config::new();
Index: devel/codex/patches/patch-codex-rs_core_src_config_mod_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_core_src_config_mod_rs,v
diff -u -p -u -r1.45 patch-codex-rs_core_src_config_mod_rs
--- devel/codex/patches/patch-codex-rs_core_src_config_mod_rs	9 Oct 2026 14:39:58 -0000	1.45
+++ devel/codex/patches/patch-codex-rs_core_src_config_mod_rs	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,10 @@
+Default to package-manager updates rather than checking upstream releases
+at startup. An explicit user setting still overrides this default.
+
 Index: codex-rs/core/src/config/mod.rs
 --- codex-rs/core/src/config/mod.rs.orig
 +++ codex-rs/core/src/config/mod.rs
-@@ -4101,7 +4101,7 @@ impl Config {
+@@ -4101,7 +4101,7 @@
  
          let review_model = override_review_model.or(cfg.review_model);
  
Index: devel/codex/patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs,v
diff -u -p -u -r1.7 patch-codex-rs_core_src_tools_handlers_apply_patch_rs
--- devel/codex/patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs	9 Oct 2026 14:39:58 -0000	1.7
+++ devel/codex/patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,11 @@
+For local OpenBSD execution with full disk read access, verify patch files
+without the unsupported filesystem sandbox. Preserve verification contexts
+for remote environments and restricted read policies.
+
 Index: codex-rs/core/src/tools/handlers/apply_patch.rs
 --- codex-rs/core/src/tools/handlers/apply_patch.rs.orig
 +++ codex-rs/core/src/tools/handlers/apply_patch.rs
-@@ -45,6 +45,7 @@ use codex_apply_patch::ApplyPatchFileChange;
+@@ -45,6 +45,7 @@
  use codex_apply_patch::Hunk;
  use codex_apply_patch::StreamingPatchParser;
  use codex_exec_server::ExecutorFileSystem;
@@ -9,10 +13,11 @@ Index: codex-rs/core/src/tools/handlers/
  use codex_features::Feature;
  use codex_protocol::models::AdditionalPermissionProfile;
  use codex_protocol::models::FileSystemPermissions;
-@@ -60,6 +61,23 @@ use codex_utils_path_uri::PathUri;
- 
+@@ -59,6 +60,23 @@
+ use codex_utils_path_uri::PathUri;
+
  const APPLY_PATCH_ARGUMENT_DIFF_BUFFER_INTERVAL: Duration = Duration::from_millis(500);
- 
++
 +fn apply_patch_verification_sandbox<'a>(
 +    environment: &TurnEnvironment,
 +    sandbox: &'a FileSystemSandboxContext,
@@ -29,16 +34,14 @@ Index: codex-rs/core/src/tools/handlers/
 +        Some(sandbox)
 +    }
 +}
-+
+ 
  /// Handles freeform `apply_patch` requests and routes verified patches to the
  /// selected environment filesystem.
- #[derive(Default)]
-@@ -338,11 +356,13 @@ impl ApplyPatchHandler {
+@@ -338,11 +356,12 @@
          )?;
          let fs = turn_environment.environment.get_filesystem();
          let sandbox = turn_environment.sandbox_context(/*additional_permissions*/ None);
-+        let verification_sandbox =
-+            apply_patch_verification_sandbox(turn_environment, &sandbox);
++        let verification_sandbox = apply_patch_verification_sandbox(turn_environment, &sandbox);
          match codex_apply_patch::verify_apply_patch_args(
              args,
              turn_environment.cwd(),
@@ -48,13 +51,20 @@ Index: codex-rs/core/src/tools/handlers/
          )
          .await
          {
-@@ -446,7 +466,8 @@ pub(crate) async fn intercept_apply_patch(
+@@ -446,8 +465,14 @@
      tool_name: &str,
  ) -> Result<Option<FunctionToolOutput>, FunctionCallError> {
      let sandbox = turn_environment.sandbox_context(/*additional_permissions*/ None);
 -    match codex_apply_patch::maybe_parse_apply_patch_verified(command, cwd, fs, Some(&sandbox))
+-        .await
 +    let verification_sandbox = apply_patch_verification_sandbox(&turn_environment, &sandbox);
-+    match codex_apply_patch::maybe_parse_apply_patch_verified(command, cwd, fs, verification_sandbox)
-         .await
++    match codex_apply_patch::maybe_parse_apply_patch_verified(
++        command,
++        cwd,
++        fs,
++        verification_sandbox,
++    )
++    .await
      {
          codex_apply_patch::MaybeApplyPatchVerified::Body(changes) => {
+             let tool_ctx = ToolCtx {
Index: devel/codex/patches/patch-codex-rs_features_src_lib_rs
===================================================================
RCS file: devel/codex/patches/patch-codex-rs_features_src_lib_rs
diff -N devel/codex/patches/patch-codex-rs_features_src_lib_rs
--- devel/codex/patches/patch-codex-rs_features_src_lib_rs	9 Oct 2026 14:39:58 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -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,
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl
--- devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl	22 Sep 2026 22:08:21 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Generate ARM64 Keccak constants in read-only data rather than execute-only
+text; use page-relative addressing to reach the separate section.
+
 Index: codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/crypto/fipsmodule/sha/asm/keccak1600-armv8.pl
 --- codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/crypto/fipsmodule/sha/asm/keccak1600-armv8.pl.orig
 +++ codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/crypto/fipsmodule/sha/asm/keccak1600-armv8.pl
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S
--- devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S	22 Sep 2026 22:08:21 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Keep the shipped ARM64 Keccak assembly in sync with the generator patch:
+constants must remain readable under OpenBSD execute-only mappings.
+
 Index: codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S
 --- codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S.orig
 +++ codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs
--- devel/codex/patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs	21 Aug 2026 13:33:37 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,7 @@
+Do not use descriptor zero as an absent-watch sentinel. Keep the watched
+set consistent and skip queued events for already removed descriptors
+against the original deadline rather than extending the timeout.
+
 Index: codex-rs/modcargo-crates/kqueue-1.1.1/src/lib.rs
 --- codex-rs/modcargo-crates/kqueue-1.1.1/src/lib.rs.orig
 +++ codex-rs/modcargo-crates/kqueue-1.1.1/src/lib.rs
@@ -39,9 +43,10 @@ Index: codex-rs/modcargo-crates/kqueue-1
                  format!("{filename:?} was not being watched"),
              ));
 -        }
-+        };
- 
+-
 -        self.watched = new_watched;
++        };
++
          let ret = self.delete_kevents(Ident::Fd(fd), filter);
          let close_err = unsafe { close(fd) };
          if close_err != 0 {
@@ -69,12 +74,13 @@ Index: codex-rs/modcargo-crates/kqueue-1
 -    } else {
 -        unsafe { kevent(watcher.queue, ptr::null(), 0, &mut kev, 1, ptr::null()) }
 -    };
-+    let started_at = Instant::now();
- 
+-
 -    match ret {
 -        -1 => Some(Event::from_error(kev, watcher)),
 -        0 => None, // timeout expired
 -        _ => Some(Event::new(kev, watcher)),
++    let started_at = Instant::now();
++
 +    loop {
 +        let mut kev = kevent::new(
 +            0,
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Select the OpenBSD host toolchain and expose BSD platform flags. Reuse
+the Linux GN scaffolding where subsequent patches exclude Linux-only APIs.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILDCONFIG.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILDCONFIG.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILDCONFIG.gn
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn	13 Oct 2026 18:17:59 -0000
@@ -1,22 +1,17 @@
+Use the current Chromium BSD default-libraries branch without altering Linux.
+The former iterator-debugging hunk is redundant with is_linux on OpenBSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILD.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILD.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILD.gn
-@@ -119,7 +119,7 @@ config("debug") {
-       # builds, and we have to tell it to turn it off.
-       defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
-     }
--  } else if ((is_linux || is_chromeos) && current_cpu == "x64" &&
-+  } else if ((is_linux || is_bsd || is_chromeos) && current_cpu == "x64" &&
-              enable_iterator_debugging) {
-     # Enable libstdc++ debugging facilities to help catch problems early, see
-     # http://crbug.com/65151 .
-@@ -211,9 +211,7 @@ config("default_libs") {
+@@ -209,6 +209,10 @@
+     # Targets should choose to explicitly link frameworks they require. Since
+     # linking can have run-time side effects, nothing should be listed here.
      libs = []
++  } else if (is_bsd) {
++    libs = [
++      "pthread",
++    ]
    } else if (is_linux || is_chromeos) {
      libs = [
--      "dl",
-       "pthread",
--      "rt",
-     ]
-   }
- }
+       "dl",
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Disable Clang modules on BSD for the port-provided compiler toolchain.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/c++.gni
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/c++.gni.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/c++.gni
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Do not generate C++ module maps on BSD with the system toolchain.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/modules.gni
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/modules.gni.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/modules.gni
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,9 @@
+Use system compiler builtins on BSD; retain upstream linkage elsewhere.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/BUILD.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/BUILD.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/BUILD.gn
-@@ -243,7 +243,12 @@ template("clang_lib") {
+@@ -243,7 +243,12 @@
  
  # Adds a dependency on the Clang runtime library clang_rt.builtins.
  clang_lib("compiler_builtins") {
@@ -15,12 +17,3 @@ Index: codex-rs/modcargo-crates/v8-150.4
      libname = "osx"
    } else if (is_ios) {
      if (target_platform == "iphoneos") {
-@@ -268,7 +273,7 @@ clang_lib("compiler_builtins") {
-       assert(false, "unsupported target_platform=$target_platform")
-     }
-   } else if (current_cpu != "ppc64" && current_cpu != "s390x") {
--    libname = "builtins"
-+    #libname = "builtins"
-   }
- }
- 
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,10 @@
+Adapt Chromium compiler/linker settings to the OpenBSD system toolchain,
+omitting unsupported flags and enabling the wxneeded JIT executable flag.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn
-@@ -203,7 +203,7 @@ declare_args() {
+@@ -203,7 +203,7 @@
    # This greatly reduces the size of debug builds, at the cost of
    # debugging information which is required by some specialized
    # debugging tools.
@@ -10,7 +13,16 @@ Index: codex-rs/modcargo-crates/v8-150.4
  
    # This switch is used to enable -Wexit-time-destructors by default. This
    # warning serves as a flip switch to allow a gradual migration of targets
-@@ -314,13 +314,16 @@ config("default_include_dirs") {
+@@ -296,7 +296,7 @@
+ #
+ # Since this is referenced both when passing the file and when deciding which
+ # warnings to enable, store it in a separate variable here.
+-use_clang_warning_suppression_file =
++use_clang_warning_suppression_file = !is_bsd &&
+     is_clang && clang_warning_suppression_file != ""
+ 
+ # default_include_dirs ---------------------------------------------------------
+@@ -314,12 +314,15 @@
  # Compiler instrumentation can introduce dependencies in DSOs to symbols in
  # the executable they are loaded into, so they are unresolved at link-time.
  config("no_unresolved_symbols") {
@@ -21,14 +33,13 @@ Index: codex-rs/modcargo-crates/v8-150.4
        "-Wl,-z,defs",
        "-Wl,--as-needed",
      ]
-   }
++  }
 +  if (current_cpu == "x86" && is_openbsd) {
 +    ldflags = [ "-Wl,-z,notext", "-Wl,--strip-all" ]
-+  }
+   }
  }
  
- # compiler ---------------------------------------------------------------------
-@@ -440,6 +443,10 @@ config("compiler") {
+@@ -440,6 +443,10 @@
      # --------------------------------
      cflags += [ "-fno-strict-aliasing" ]  # See http://crbug.com/32204
  
@@ -39,7 +50,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
      # Stack protection. ShadowCallStack and Stack protector address the same
      # problems. Therefore, we only enable one or the other. Clang advertises SCS
      # as a stronger alternative to StackProtector, so we give SCS precedence
-@@ -588,9 +595,9 @@ config("compiler") {
+@@ -588,9 +595,9 @@
    if (is_clang) {
      # Flags for diagnostics.
      cflags += [ "-fcolor-diagnostics" ]
@@ -51,7 +62,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
        # Combine after https://github.com/llvm/llvm-project/pull/192241
        cflags += [ "/clang:-fdiagnostics-show-inlining-chain" ]
      }
-@@ -615,7 +622,7 @@ config("compiler") {
+@@ -615,7 +622,7 @@
      }
    }
  
@@ -60,7 +71,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
      cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
      if (save_reproducers_on_lld_crash && use_lld) {
        ldflags += [
-@@ -1071,7 +1078,8 @@ config("linker") {
+@@ -1071,7 +1078,8 @@
          # errors. We only apply fatal warnings when using lld.
          ldflags += [ "-Wl,-fatal_warnings" ]
        }
@@ -70,7 +81,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
          ldflags += [ "-Wl,--fatal-warnings" ]
        }
      }
-@@ -1418,7 +1426,7 @@ config("compiler_deterministic") {
+@@ -1418,7 +1426,7 @@
        "-file-prefix-map",
        rebase_path("//.", "") + "=" + rebase_path("//.", root_build_dir),
      ]
@@ -79,7 +90,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
        # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
        asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
      }
-@@ -1471,7 +1479,7 @@ config("compiler_deterministic") {
+@@ -1471,7 +1479,7 @@
  
  config("clang_revision") {
    if (is_clang && clang_base_path == default_clang_base_path &&
@@ -88,7 +99,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
      _perform_consistency_checks = current_toolchain == default_toolchain
      if (llvm_force_head_revision) {
        _head_revision_stamp_path = "//third_party/llvm-build/force_head_revision"
-@@ -1584,7 +1592,7 @@ config("clang_warning_suppression") {
+@@ -1584,7 +1592,7 @@
  # See also: https://crbug.com/40891132#comment10
  ubsan_hardening("c_array_bounds") {
    sanitizer = "array-bounds"
@@ -97,7 +108,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
  
    # Because we've enabled array-bounds sanitizing we also want to suppress
    # the related warning about "unsafe-buffer-usage-in-static-sized-array",
-@@ -1598,6 +1606,7 @@ ubsan_hardening("c_array_bounds") {
+@@ -1598,6 +1606,7 @@
  # `NOTREACHED()` at the end of such functions.
  ubsan_hardening("return") {
    sanitizer = "return"
@@ -105,25 +116,29 @@ Index: codex-rs/modcargo-crates/v8-150.4
  }
  
  config("rustc_revision") {
-@@ -1933,10 +1942,15 @@ config("default_warnings") {
-       # TODO(crbug.com/432275627): Fix and re-enable.
-       "-Wno-uninitialized-const-pointer",
- 
+@@ -1930,12 +1939,16 @@
+       # TODO(crbug.com/376641662): Fix and re-enable.
+       "-Wno-nontrivial-memcall",
+ 
+-      # TODO(crbug.com/432275627): Fix and re-enable.
+-      "-Wno-uninitialized-const-pointer",
+-
 -      # TODO(crbug.com/495753203): Fix and re-enable.
 -      "-Wno-unused-but-set-global",
      ]
- 
++
 +    if (!is_bsd) {
 +      cflags += [
 +        # TODO(crbug.com/495753203): Fix and re-enable.
 +        "-Wno-unused-but-set-global",
++        # TODO(crbug.com/432275627): Fix and re-enable.
++        "-Wno-uninitialized-const-pointer",
 +      ]
 +    }
-+
+ 
      cflags_cc += [
        # TODO(crbug.com/328490295): Fix and re-enable for C flags.
-       "-Wenum-compare-conditional",
-@@ -2304,8 +2318,8 @@ config("export_dynamic") {
+@@ -2304,8 +2317,8 @@
  # 2. Remove the thin_archive config, so that the .a file actually contains all
  #    .o files, instead of just references to .o files in the build directoy
  config("thin_archive") {
@@ -134,7 +149,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
      # The macOS and iOS linker ld64.ldd doesn't support thin archive without
      # symbol table, gcc on linux also throws the error `archive has no index`.
      # AIX does support -s option, not -S option.
-@@ -2748,7 +2762,7 @@ config("afdo_optimize_size") {
+@@ -2748,7 +2761,7 @@
  # There are some targeted places that AFDO regresses, so we provide a separate
  # config to allow AFDO to be disabled per-target.
  config("afdo") {
@@ -143,7 +158,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
      cflags = []
      if (clang_emit_debug_info_for_profiling) {
        # Add the following flags to generate debug info for profiling.
-@@ -2775,7 +2789,7 @@ config("afdo") {
+@@ -2775,7 +2788,7 @@
        cflags += [ "-Wno-backend-plugin" ]
        inputs = [ _clang_sample_profile ]
      }
@@ -152,7 +167,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
      cflags = [ "-fauto-profile=${auto_profile_path}" ]
      inputs = [ auto_profile_path ]
    }
-@@ -2827,10 +2841,6 @@ config("split_dwarf") {
+@@ -2827,10 +2840,6 @@
    # thinlto requires -gsplit-dwarf in ldflags.
    if (use_thin_lto && !is_apple) {
      ldflags = split_dwarf_flags
@@ -163,7 +178,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
    }
  }
  
-@@ -2909,7 +2919,7 @@ config("symbols") {
+@@ -2909,7 +2918,7 @@
      }
  
      if (current_os != "zos") {
@@ -172,7 +187,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
      }
  
      if (is_clang && !is_tsan && !is_asan && !use_dwarf5) {
-@@ -2932,7 +2942,7 @@ config("symbols") {
+@@ -2932,7 +2941,7 @@
      # Disable debugger index for Android, which uses lldb. lldb can create (and
      # cache) its own index in about 20 seconds, so there's no need to pay the
      # price of an index on every link.
@@ -181,7 +196,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
                          (use_lld || use_mold) && !is_wasm && !is_android
      if (_add_symbol_index) {
        if (use_dwarf5) {
-@@ -2972,7 +2982,7 @@ config("symbols") {
+@@ -2972,7 +2981,7 @@
      cflags += [ "-gomit-unreferenced-methods" ]
    }
  
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Avoid Chromium-specific ABI and architecture compiler switches on BSD
+when using the port-selected system toolchain.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler_cpu_abi.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler_cpu_abi.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler_cpu_abi.gn
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn	13 Oct 2026 18:17:59 -0000
@@ -1,14 +1,14 @@
+Exclude BSD from libatomic linkage; preserve the upstream Linux condition.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/BUILD.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/BUILD.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/BUILD.gn
-@@ -40,10 +40,6 @@ config("runtime_library") {
-     defines = [ "OS_CHROMEOS" ]
+@@ -41,7 +41,7 @@
    }
  
--  if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") &&
+   if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") &&
 -      (!use_custom_libcxx || current_cpu == "mipsel")) {
--    libs = [ "atomic" ]
--  }
++      (!use_custom_libcxx || current_cpu == "mipsel") && !is_bsd) {
+     libs = [ "atomic" ]
+   }
  }
- 
- config("libcap") {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Allow the pkg-config helper to operate on OpenBSD and FreeBSD as well
+as Linux.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/pkg-config.py
 --- codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/pkg-config.py.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/pkg-config.py
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Use nm options accepted by the OpenBSD toolchain; omit GNU --format=posix.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_solink_wrapper.py
 --- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_solink_wrapper.py.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_solink_wrapper.py
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Use system compiler/binutils names and expose extra flags passed by the
+port, rather than requiring the Chromium LLVM directory layout.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_toolchain.gni
 --- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_toolchain.gni.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_toolchain.gni
@@ -29,7 +32,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
    gcc_toolchain(target_name) {
 -    _path = "$clang_base_path/bin"
 -    _is_path_absolute = get_path_info(_path, "abspath") == _path
- 
+-
 -    # Preserve absolute paths for tools like distcc.
 -    if (_is_path_absolute && filter_include([ _path ], [ "//*" ]) == []) {
 -      prefix = _path
@@ -39,6 +42,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
 -
 -    cc = "${prefix}/clang"
 -    cxx = "${prefix}/clang++"
++
 +    cc = "cc"
 +    cxx = "c++"
      ld = cxx
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Provide GN toolchain definitions for OpenBSD, including the amd64 and
+arm64 targets supported by this port.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/openbsd/BUILD.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/openbsd/BUILD.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/openbsd/BUILD.gn
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Include OpenBSD in the POSIX toolchain branch.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/toolchain.gni
 --- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/toolchain.gni.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/toolchain.gni
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Recognize BSD in Abseil platform feature selection.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/config.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/config.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/config.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Use BSD sysctl paths and exclude the incompatible thread-ID branches
+from Abseil system information code.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/internal/sysinfo.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/internal/sysinfo.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Use libc locale functions available on OpenBSD instead of unavailable
+per-locale variants. This inherited fallback uses the process locale.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/include/__locale_dir/support/bsd_like.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/include/__locale_dir/support/bsd_like.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/include/__locale_dir/support/bsd_like.h
@@ -37,9 +40,10 @@ Index: codex-rs/modcargo-crates/v8-150.4
  
  #  if _LIBCPP_HAS_WIDE_CHARACTERS
 -inline _LIBCPP_HIDE_FROM_ABI wint_t __btowc(int __c, __locale_t __loc) { return ::btowc_l(__c, __loc); }
-+inline _LIBCPP_HIDE_FROM_ABI wint_t __btowc(int __c, __locale_t __loc) { return ::btowc(__c); }
- 
+-
 -inline _LIBCPP_HIDE_FROM_ABI int __wctob(wint_t __c, __locale_t __loc) { return ::wctob_l(__c, __loc); }
++inline _LIBCPP_HIDE_FROM_ABI wint_t __btowc(int __c, __locale_t __loc) { return ::btowc(__c); }
++
 +inline _LIBCPP_HIDE_FROM_ABI int __wctob(wint_t __c, __locale_t __loc) { return ::wctob(__c); }
  
  inline _LIBCPP_HIDE_FROM_ABI size_t
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Select clock_gettime for filesystem timestamps on BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/src/filesystem/filesystem_clock.cpp
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/src/filesystem/filesystem_clock.cpp.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/src/filesystem/filesystem_clock.cpp
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Exclude the auxiliary-vector register detection path on BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/Registers.hpp
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/Registers.hpp.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/Registers.hpp
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Disable memory tagging and the Linux x64 feature branch on BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/partition_alloc.gni
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/partition_alloc.gni.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/partition_alloc.gni
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Do not select Linux-specific allocator sources when reusing Linux GN
+settings for BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/BUILD.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/BUILD.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/BUILD.gn
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Use the BSD address-space randomization branch instead of the memory
+tool override.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/address_space_randomization.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/address_space_randomization.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/address_space_randomization.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Allow variable allocator page sizes for BSD ARM64 and related targets.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_constants.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_constants.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_constants.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Apply the POSIX allocator API branch to BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,11 @@
+Avoid Linux-style ifunc support on BSD and report the OpenBSD zero segment.
+Adapt the Chromium ports zero-segment hunk to the native VM_MIN_ADDRESS
+guarantee for the two architectures supported by this port.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.cc
-@@ -43,7 +43,7 @@ uint32_t SecTaskGetCodeSignStatus(SecTaskRef task) API
+@@ -43,7 +43,7 @@
  
  #if PA_BUILDFLAG(HAS_MEMORY_TAGGING) ||                                        \
      (defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1) && \
@@ -10,3 +14,18 @@ Index: codex-rs/modcargo-crates/v8-150.4
  struct __ifunc_arg_t;
  
  #include "partition_alloc/aarch64_support.h"
+@@ -228,6 +228,14 @@
+   return static_cast<size_t>(address);
+ }
+ 
++#elif PA_BUILDFLAG(IS_OPENBSD)
++
++size_t GetZeroSegmentSizeFromOS() {
++  // VM_MIN_ADDRESS is PAGE_SIZE on OpenBSD amd64 and arm64. Do not assume
++  // Linux's 64KB mmap_min_addr when describing the unmappable zero segment.
++  return SystemPageSize();
++}
++
+ #elif PA_BUILDFLAG(IS_LINUX)
+ 
+ size_t GetZeroSegmentSizeFromOS() {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Use BSD page-discard handling and MADV_FREE rather than the Linux path.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Exclude Linux /proc mapping support on BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Select the BSD-compatible POSIX stack trace path without Linux-only
+/proc and signal-stack assumptions.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Use getentropy for BSD allocator randomness before the existing fallback.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/rand_util_posix.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Define the BSD allocator thread ID type.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Include BSD in the POSIX allocator threading declaration branch.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Include BSD in the POSIX allocator threading implementation branch.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Enable the BSD allocator platform configuration alongside the existing
+POSIX platforms.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_config.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_config.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_config.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Select allocator alignment and ARM64 constants for BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_constants.h
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_constants.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_constants.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h
===================================================================
RCS file: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h
diff -N devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h	9 Aug 2026 11:29:25 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_forward.h
---- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_forward.h.orig
-+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_forward.h
-@@ -29,9 +29,13 @@ namespace internal {
- // the second one 16. We could technically return something different for
- // malloc() and operator new(), but this would complicate things, and most of
- // our allocations are presumably coming from operator new() anyway.
-+#if defined(__i386__) && defined(OS_FREEBSD)
-+constexpr size_t kAlignment = 8;
-+#else
- constexpr inline size_t kAlignment =
-     std::max(alignof(max_align_t),
-              static_cast<size_t>(__STDCPP_DEFAULT_NEW_ALIGNMENT__));
-+#endif
- static_assert(base::bits::HasSingleBit(kAlignment),
-               "Alignment must be power of two.");
- static_assert(kAlignment <= 16,
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Include BSD in allocator page accounting and ARM64 handling.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_root.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_root.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_root.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc
===================================================================
RCS file: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc
diff -N devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,37 +0,0 @@
-Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/spinning_mutex.cc
---- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/spinning_mutex.cc.orig
-+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/spinning_mutex.cc
-@@ -20,7 +20,16 @@
- #endif
- 
- #if PA_CONFIG(HAS_LINUX_KERNEL)
-+#if defined(OS_OPENBSD)
-+#include <sys/time.h>
-+#include <sys/futex.h>
-+#elif defined(OS_FREEBSD)
-+#include <sys/types.h>
-+#include <sys/thr.h>
-+#include <sys/umtx.h>
-+#else
- #include <linux/futex.h>
-+#endif
- #include <sys/syscall.h>
- #include <unistd.h>
- 
-@@ -150,8 +159,16 @@ PA_ALWAYS_INLINE long FutexSyscall(volatile void* ftx,
-   int saved_errno = errno;
-   errno = 0;
- 
-+#if defined(OS_FREEBSD)
-+  long retval = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE,
-+                    kLockedContended, nullptr, nullptr);
-+#elif defined(OS_OPENBSD)
-+  long retval = futex(reinterpret_cast<volatile unsigned int *>(&state_), FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
-+                    kLockedContended, nullptr, nullptr);
-+#else
-   long retval = syscall(SYS_futex, ftx, op | FUTEX_PRIVATE_FLAG, value, nullptr,
-                         nullptr, 0);
-+#endif
-   if (retval == -1) {
-     // These are programming errors, check them.
-     [[maybe_unused]] const int futex_errno = errno;
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc	13 Oct 2026 18:17:59 -0000
@@ -1,17 +1,20 @@
+Obtain thread stack bounds with the BSD pthread APIs, including
+pthread_stackseg_np on OpenBSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/stack/stack.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/stack/stack.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/stack/stack.cc
-@@ -19,6 +19,10 @@
+@@ -17,6 +17,10 @@
+ #include <windows.h>
+ #else
  #include <pthread.h>
- #endif
- 
-+#if PA_BUILDFLAG(IS_BSD)
-+#include <pthread_np.h>
 +#endif
 +
- #if PA_BUILDFLAG(PA_LIBC_GLIBC)
- extern "C" void* __libc_stack_end;
++#if PA_BUILDFLAG(IS_BSD)
++#include <pthread_np.h>
  #endif
+ 
+ #if PA_BUILDFLAG(PA_LIBC_GLIBC)
 @@ -49,6 +53,36 @@ void* GetStackTop() {
  
  void* GetStackTop() {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Exclude the non-BSD platform guard in allocator protection-key handling.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/thread_isolation/pkey.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/thread_isolation/pkey.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/thread_isolation/pkey.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Export OpenBSD/BSD V8 platform defines, select platform-openbsd.cc and
+link libexecinfo instead of Linux platform sources.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/BUILD.gn
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/BUILD.gn.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/BUILD.gn
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Do not enable Chromium PartitionAlloc as the V8 allocator on BSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/build_overrides/partition_alloc.gni
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/build_overrides/partition_alloc.gni.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/build_overrides/partition_alloc.gni
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Use the alternate memory-handling branch on OpenBSD as on Android.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8-internal.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8-internal.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8-internal.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Recognize OpenBSD as a V8 target and exclude incompatible compiler
+feature assumptions.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8config.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8config.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8config.h
@@ -17,18 +20,18 @@ Index: codex-rs/modcargo-crates/v8-150.4
    || defined(V8_TARGET_OS_WIN) \
    || defined(V8_TARGET_OS_CHROMEOS)
  #  error A target OS is defined but V8_HAVE_TARGET_OS is unset.
-@@ -247,6 +249,11 @@ path. Add it with -I<path> to the command line
- # define V8_TARGET_OS_LINUX
- #endif
+@@ -245,6 +247,11 @@ path. Add it with -I<path> to the command line
  
+ #ifdef V8_OS_LINUX
+ # define V8_TARGET_OS_LINUX
++#endif
++
 +#ifdef V8_OS_OPENBSD
 +# define V8_TARGET_OS_OPENBSD
 +# define V8_TARGET_OS_BSD
-+#endif
-+
- #ifdef V8_OS_MACOS
- # define V8_TARGET_OS_MACOS
  #endif
+ 
+ #ifdef V8_OS_MACOS
 @@ -394,6 +401,7 @@ path. Add it with -I<path> to the command line
  #if (defined(_M_X64) || defined(__x86_64__)            /* x64 (everywhere) */  \
       || ((defined(__AARCH64EL__) || defined(_M_ARM64)) /* arm64, but ... */    \
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Include OpenBSD in V8 POSIX API and memory handling branches.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/api/api.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/api/api.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/api/api.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Select the atomic operation declarations appropriate to OpenBSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/atomicops.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/atomicops.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/atomicops.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Implement the thread stack-start query using OpenBSD pthread_stackseg_np.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-openbsd.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-openbsd.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-openbsd.cc
@@ -9,11 +11,10 @@ Index: codex-rs/modcargo-crates/v8-150.4
  #include <semaphore.h>
  #include <signal.h>
  #include <stdlib.h>
-@@ -121,6 +122,17 @@ void OS::SignalCodeMovingGC() {
- }
+@@ -122,6 +123,17 @@ void OS::SignalCodeMovingGC() {
  
  void OS::AdjustSchedulingParams() {}
-+
+ 
 +// static
 +Stack::StackSlot Stack::ObtainCurrentThreadStackStart() {
 +  stack_t ss;
@@ -24,6 +25,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
 +  base = (void*)((size_t) ss.ss_sp - ss.ss_size);
 +  return reinterpret_cast<uint8_t*>(base) + ss.ss_size;
 +}
- 
++
  std::optional<OS::MemoryRange> OS::GetFirstFreeMemoryRangeWithin(
      OS::Address boundary_start, OS::Address boundary_end, size_t minimum_size,
+     size_t alignment) {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Use BSD mapping semantics, let OpenBSD choose randomized mmap addresses,
+and exclude incompatible POSIX platform branches.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-posix.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-posix.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-posix.cc
@@ -10,29 +13,21 @@ Index: codex-rs/modcargo-crates/v8-150.4
  #define MAP_ANONYMOUS MAP_ANON
  #endif
  
-@@ -210,6 +210,7 @@ void* Allocate(void* hint, size_t size, OS::MemoryPerm
- int GetProtectionFromMemoryPermission(OS::MemoryPermission access) {
-   switch (access) {
-     case OS::MemoryPermission::kNoAccess:
-+      return PROT_NONE;
-     case OS::MemoryPermission::kNoAccessWillJitLater:
-       return PROT_NONE;
-     case OS::MemoryPermission::kRead:
-@@ -359,6 +360,13 @@ void OS::SetRandomMmapSeed(int64_t seed) {
+@@ -359,6 +359,13 @@
    }
  }
  
 +#if V8_OS_OPENBSD
 +// Allow OpenBSD's mmap to select a random address on OpenBSD
-+ // static
-+ void* OS::GetRandomMmapAddr() {
++// static
++void* OS::GetRandomMmapAddr() {
 +  return nullptr;
 +}
 +#else
  // static
  void* OS::GetRandomMmapAddr() {
    uintptr_t raw_addr;
-@@ -457,6 +465,7 @@ void* OS::GetRandomMmapAddr() {
+@@ -457,6 +464,7 @@
  #endif
    return reinterpret_cast<void*>(raw_addr);
  }
@@ -40,7 +35,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
  
  // TODO(bbudge) Move Cygwin and Fuchsia stuff into platform-specific files.
  #if !V8_OS_CYGWIN && !V8_OS_FUCHSIA
-@@ -772,7 +781,7 @@ void OS::DestroySharedMemoryHandle(SharedMemoryHandle 
+@@ -772,7 +780,7 @@
  #if !V8_OS_ZOS
  // static
  bool OS::HasLazyCommits() {
@@ -49,7 +44,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
    return true;
  #else
    // TODO(bbudge) Return true for all POSIX platforms.
-@@ -1423,7 +1432,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void*
+@@ -1423,7 +1431,7 @@
  // keep this version in POSIX as most Linux-compatible derivatives will
  // support it. MacOS and FreeBSD are different here.
  #if !defined(V8_OS_FREEBSD) && !defined(V8_OS_DARWIN) && !defined(_AIX) && \
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h	13 Oct 2026 18:17:59 -0000
@@ -1,12 +1,14 @@
+Include cstdarg explicitly for variable argument declarations.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/strings.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/strings.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/strings.h
-@@ -9,6 +9,8 @@
+@@ -8,6 +8,8 @@
+ #include "src/base/base-export.h"
  #include "src/base/macros.h"
  #include "src/base/vector.h"
- 
-+#include <cstdarg>
 +
++#include <cstdarg>
+ 
  namespace v8 {
  namespace base {
- 
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Count online CPUs on OpenBSD using HW_NCPUONLINE.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/sys-info.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/sys-info.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/sys-info.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Keep PerfJitLogger definitions available on BSD to match V8 callers.
+This inherited patch broadens the upstream Linux/Darwin compile guard.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Keep PerfJitLogger declarations in sync with the BSD implementation patch.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Mark embedded V8 code executable with mprotect on OpenBSD outside IA32.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/execution/isolate.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/execution/isolate.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/execution/isolate.cc
@@ -12,15 +14,17 @@ Index: codex-rs/modcargo-crates/v8-150.4
  extern "C" const uint8_t v8_Default_embedded_blob_code_[];
  extern "C" uint32_t v8_Default_embedded_blob_code_size_;
  extern "C" const uint8_t v8_Default_embedded_blob_data_[];
-@@ -5714,6 +5718,11 @@ void Isolate::InitializeDefaultEmbeddedBlob() {
-   uint32_t code_size = DefaultEmbeddedBlobCodeSize();
+@@ -5715,6 +5719,13 @@
    const uint8_t* data = DefaultEmbeddedBlobData();
    uint32_t data_size = DefaultEmbeddedBlobDataSize();
-+
+ 
 +#if defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32)
-+  mprotect(reinterpret_cast<void *>(const_cast<uint8_t *>(code)),
-+        code_size, PROT_READ | PROT_EXEC);
++  if (code_size > 0) {
++    mprotect(reinterpret_cast<void *>(const_cast<uint8_t *>(code)),
++             code_size, PROT_READ | PROT_EXEC);
++  }
 +#endif
- 
++
    if (StickyEmbeddedBlobCode() != nullptr) {
      base::MutexGuard guard(current_embedded_blob_refcount_mutex_.Pointer());
+     // Check again now that we hold the lock.
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc	13 Oct 2026 18:17:59 -0000
@@ -1,17 +1,19 @@
+Make initialized V8 flags immutable with OpenBSD mimmutable.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/flags/flags.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/flags/flags.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/flags/flags.cc
-@@ -17,6 +17,10 @@
+@@ -16,6 +16,10 @@
+ #include <set>
  #include <sstream>
  #include <unordered_map>
- 
++
 +#if V8_OS_OPENBSD
 +#include <sys/mman.h>
 +#endif
-+
+ 
  #include "src/base/fpu.h"
  #include "src/base/hashing.h"
- #include "src/base/lazy-instance.h"
 @@ -887,6 +891,10 @@ void FlagList::FreezeFlags() {
    // Note that for string flags we only protect the pointer itself, but not the
    // string storage. TODO(12887): Fix this.
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Exclude the incompatible NEON64 SIMD path on OpenBSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/objects/simd.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/objects/simd.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/objects/simd.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Apply the alternate sandbox reservation branch on OpenBSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/sandbox/sandbox.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/sandbox/sandbox.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/sandbox/sandbox.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Recognize openbsd as an embedded snapshot target OS.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Represent OpenBSD in the embedded snapshot target OS enumeration.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc	13 Oct 2026 18:17:59 -0000
@@ -1,17 +1,20 @@
+Emit page-aligned OpenBSD embedded code and the .openbsd.mutable section
+to support the required memory protections.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
-@@ -9,6 +9,10 @@
+@@ -8,6 +8,10 @@
+ #include <cinttypes>
  
  #include "src/objects/instruction-stream.h"
- 
++
 +#if V8_OS_OPENBSD
 +#include <sys/param.h>
 +#endif
-+
+ 
  namespace v8 {
  namespace internal {
- 
 @@ -35,6 +39,10 @@ const char* DirectiveAsString(DataDirective directive)
  void PlatformEmbeddedFileWriterGeneric::SectionText() {
    if (target_os_ == EmbeddedTargetOs::kChromeOS) {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Use OpenBSD signal-context registers and avoid absent siginfo codes.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.cc
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.cc.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.cc
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Include OpenBSD in the POSIX trap-handler declarations.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.h
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h,v
diff -u -p -u -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h
--- devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h	9 Aug 2026 11:29:25 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,5 @@
+Allow V8 trap handling on OpenBSD.
+
 Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/trap-handler.h
 --- codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/trap-handler.h.orig
 +++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/trap-handler.h
Index: devel/codex/patches/patch-codex-rs_tcp-tunnel_Cargo_toml
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_tcp-tunnel_Cargo_toml,v
diff -u -p -u -r1.1 patch-codex-rs_tcp-tunnel_Cargo_toml
--- devel/codex/patches/patch-codex-rs_tcp-tunnel_Cargo_toml	22 Sep 2026 22:08:21 -0000	1.1
+++ devel/codex/patches/patch-codex-rs_tcp-tunnel_Cargo_toml	13 Oct 2026 18:17:59 -0000
@@ -1,7 +1,10 @@
+Use the pinned h3 DIST_TUPLE source for both crates instead of a build-time
+Git fetch.
+
 Index: codex-rs/tcp-tunnel/Cargo.toml
 --- codex-rs/tcp-tunnel/Cargo.toml.orig
 +++ codex-rs/tcp-tunnel/Cargo.toml
-@@ -11,8 +11,8 @@ doctest = false
+@@ -11,8 +11,8 @@
  anyhow = { workspace = true }
  bytes = { workspace = true }
  clap = { workspace = true, features = ["derive"] }
Index: devel/codex/patches/patch-tokio-tungstenite_Cargo_toml
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-tokio-tungstenite_Cargo_toml,v
diff -u -p -u -r1.3 patch-tokio-tungstenite_Cargo_toml
--- devel/codex/patches/patch-tokio-tungstenite_Cargo_toml	23 Jun 2026 13:47:22 -0000	1.3
+++ devel/codex/patches/patch-tokio-tungstenite_Cargo_toml	13 Oct 2026 18:17:59 -0000
@@ -1,3 +1,6 @@
+Resolve tungstenite from the pinned DIST_TUPLE source rather than fetching
+the fork during the build.
+
 Index: tokio-tungstenite/Cargo.toml
 --- tokio-tungstenite/Cargo.toml.orig
 +++ tokio-tungstenite/Cargo.toml
Index: devel/codex/pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/codex/pkg/PLIST,v
diff -u -p -u -r1.8 PLIST
--- devel/codex/pkg/PLIST	9 Aug 2026 11:29:25 -0000	1.8
+++ devel/codex/pkg/PLIST	13 Oct 2026 18:17:59 -0000
@@ -1,6 +1,11 @@
-@bin bin/codex
-@bin bin/codex-code-mode-host
+bin/codex
+bin/codex-code-mode-host
 @bin bin/codex-logs-client
+libexec/codex/
+libexec/codex/bin/
+@bin libexec/codex/bin/codex
+@bin libexec/codex/bin/codex-code-mode-host
+libexec/codex/codex-package.json
 share/bash-completion/completions/codex
 share/doc/codex/
 share/doc/codex/CLA.md
Index: devel/codex/pkg/README
===================================================================
RCS file: /cvs/ports/devel/codex/pkg/README,v
diff -u -p -u -r1.2 README
--- devel/codex/pkg/README	24 Aug 2026 16:39:57 -0000	1.2
+++ devel/codex/pkg/README	13 Oct 2026 18:17:59 -0000
@@ -20,3 +20,42 @@ datasize limit in used login class..
 
 Also, ${PKGSTEM} may use a lot of open files, you may need to raise both
 the system-wide maxfiles and used login class limits.
+
+The local app-server daemon is enabled for eligible interactive sessions by
+upstream's daemon_auto_start feature (enabled by default). It uses the same
+executable as the CLI, installed at:
+
+	${LOCALBASE}/libexec/codex/bin/codex
+
+${LOCALBASE}/bin/codex is a link to that executable. The code-mode host is
+installed beside it, and ${LOCALBASE}/libexec/codex/codex-package.json records
+the package's version and native OpenBSD target. Codex checks the manifest and
+executable versions before a new daemon start; no npm or Node.js is needed.
+
+The daemon runs as the invoking user. Codex starts it on demand, detaches it
+from the terminal, and leaves it running for other clients. Lifecycle commands:
+
+	codex app-server daemon start
+	codex app-server daemon version
+	codex app-server daemon restart
+	codex app-server daemon stop
+
+PID records, logs, settings, and recovery data remain under CODEX_HOME
+(default ~/.codex). The advertised socket is under app-server-control there;
+on Unix it points to a protected socket under /tmp/codex-daemon-<uid>.
+The daemon inherits the environment of the terminal that starts it, shared
+by later clients. There is no system rc.d service and no restart after reboot.
+
+The package manager owns the executable, host, and manifest. Use pkg_add -u
+to update them, then `codex app-server daemon restart`. A running process keeps
+its old image; an incompatible daemon version is reported with restart
+instructions rather than being silently reused or internally replaced.
+Restart also picks up port revisions with an unchanged upstream version.
+
+Codex's daemon updater and --from-cli package replacement are disabled, not
+the daemon. The /daemon update menu directs updates to pkg_add. No daemon
+executable or package manifest is copied to ~/.codex/packages. Other optional
+user-installed components and existing packages are left alone.
+
+When migrating from an internally managed daemon, stop it with the old CLI
+before replacing the package. No user-managed package files are deleted.
Index: devel/codex/files/codex-package.json
===================================================================
--- /dev/null
+++ devel/codex/files/codex-package.json
@@ -0,0 +1,7 @@
+{
+  "layoutVersion": 1,
+  "version": "${V}",
+  "target": "${CODEX_TARGET}",
+  "variant": "codex",
+  "entrypoint": "bin/codex"
+}
Index: devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
@@ -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 @@
+ 
+ #[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")?;
Index: devel/codex/patches/patch-codex-rs_app-server-daemon_src_lib_rs
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_app-server-daemon_src_lib_rs
@@ -0,0 +1,91 @@
+Use a distributor-owned executable with the normal daemon lifecycle and IPC.
+Reject binary self-updates and incompatible running daemons; installation
+and replacement belong to pkg_add.
+
+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
+@@ -225,6 +225,12 @@
+     Restart,
+ }
+ 
++/// A distributor-owned daemon is installed and updated outside Codex.
++/// Process lifecycle and IPC still use the normal managed-daemon backend.
++pub fn system_daemon_path() -> Option<&'static Path> {
++    managed_install::system_codex_bin()
++}
++
+ pub async fn run(command: LifecycleCommand) -> Result<LifecycleOutput> {
+     ensure_supported_platform()?;
+     #[cfg(windows)]
+@@ -282,6 +288,10 @@
+     restore_release: Option<String>,
+ ) -> Result<()> {
+     ensure_supported_platform()?;
++    anyhow::ensure!(
++        managed_install::system_codex_bin().is_none(),
++        "the daemon is managed by the system package manager; use pkg_add -u"
++    );
+     #[cfg(windows)]
+     backend::windows::ensure_not_elevated()?;
+     update_loop::run(http_client_factory, restore_release).await
+@@ -291,6 +301,20 @@
+     http_client_factory: codex_http_client::HttpClientFactory,
+ ) -> Result<UpdateOutput> {
+     ensure_supported_platform()?;
++    if let Some(path) = managed_install::system_codex_bin() {
++        let daemon = Daemon::from_environment()?;
++        return Ok(UpdateOutput {
++            status: UpdateStatus::Unsupported,
++            managed_codex_path: path.to_path_buf(),
++            installed_version: daemon.managed_codex_version_best_effort().await,
++            running_version: client::probe(&daemon.socket_path)
++                .await
++                .ok()
++                .map(|info| info.app_server_version),
++            message: "The daemon is managed by the system package manager; use pkg_add -u."
++                .to_string(),
++        });
++    }
+     #[cfg(windows)]
+     backend::windows::ensure_not_elevated()?;
+     update_loop::request_manual_update(&Daemon::from_environment()?, http_client_factory).await
+@@ -448,6 +472,15 @@
+                 self.wait_until_ready().await?,
+             )
+         };
++        if managed_install::system_codex_bin().is_some() {
++            anyhow::ensure!(
++                info.app_server_version == env!("CARGO_PKG_VERSION"),
++                "system-managed daemon is running version {} but this CLI requires {}; \
++                 run `codex app-server daemon restart` after pkg_add -u",
++                info.app_server_version,
++                env!("CARGO_PKG_VERSION")
++            );
++        }
+         if backend.is_some()
+             && let Err(err) = managed.ensure_managed_updater(&settings).await
+         {
+@@ -892,6 +925,10 @@
+ 
+     async fn ensure_managed_updater(&self, settings: &DaemonSettings) -> Result<bool> {
+         let updater = backend::pid_update_loop_backend(self.backend_paths(settings));
++        if managed_install::system_codex_bin().is_some() {
++            updater.stop().await?;
++            return Ok(false);
++        }
+         if !settings.auto_update_enabled {
+             updater.stop().await?;
+             return Ok(false);
+@@ -981,6 +1018,11 @@
+         }
+ 
+         let managed_codex_path = self.managed_codex_bin.display();
++        if managed_install::system_codex_bin().is_some() {
++            return Err(anyhow!(
++                "system daemon executable not found at {managed_codex_path}; reinstall the codex package with pkg_add"
++            ));
++        }
+         Err(anyhow!(
+             "daemon executable not found at {managed_codex_path}; repair the existing installation, or run `codex app-server daemon start` to install a missing daemon"
+         ))
Index: devel/codex/patches/patch-codex-rs_app-server-daemon_src_managed_install_rs
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_app-server-daemon_src_managed_install_rs
@@ -0,0 +1,42 @@
+Allow the port to select its already installed codex as the app-server
+executable. System ownership is a build-time setting and takes precedence
+over user-managed packages; it never opts into the internal release updater.
+
+Index: codex-rs/app-server-daemon/src/managed_install.rs
+--- codex-rs/app-server-daemon/src/managed_install.rs.orig
++++ codex-rs/app-server-daemon/src/managed_install.rs
+@@ -13,6 +13,14 @@
+ use tokio::fs;
+ use tokio::process::Command;
+ use tokio::time::timeout;
++
++/// 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)
++}
+ 
+ /// New daemons own their packages, regardless of how the calling CLI was installed.
+ /// Preserve legacy launch state, including logs left after a daemon is stopped;
+@@ -57,6 +65,9 @@
+ 
+ /// Resolve both packaged and legacy binaries without requiring a valid install.
+ pub(crate) fn managed_codex_bin(codex_home: &Path) -> PathBuf {
++    if let Some(path) = system_codex_bin() {
++        return path.to_path_buf();
++    }
+     let root = package_root(codex_home);
+     let current = root.join("current");
+     let packaged = current.join("bin").join(managed_codex_file_name());
+@@ -72,6 +83,9 @@
+ 
+ /// Only latest-channel stable releases may run the public latest-version updater.
+ pub(crate) fn is_stable_standalone_release(codex_home: &Path, codex_bin: &Path) -> bool {
++    if system_codex_bin().is_some() {
++        return false;
++    }
+     let standalone = package_root(codex_home);
+     let Ok(releases) = std::fs::canonicalize(standalone.join("releases")) else {
+         return false;
Index: devel/codex/patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
@@ -0,0 +1,56 @@
+Validate the system package manifest and executable version without copying
+a CLI package into CODEX_HOME. Reject explicit --from-cli replacement of
+an executable owned by the system package manager.
+
+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
+@@ -26,6 +26,37 @@
+ 
+ /// 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,
++        );
++        let manifest = context.package_manifest().with_context(|| {
++            format!(
++                "system Codex package metadata missing or invalid for {}; reinstall the codex package with pkg_add",
++                path.display()
++            )
++        })?;
++        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(());
++    }
+     let source = InstallContext::current().package_layout.as_ref();
+     // Keep package replacement state out of the CLI dispatcher's async stack frame.
+     Box::pin(prepare_from_package(
+@@ -46,6 +77,10 @@
+     confirm: impl FnOnce(&InstallRequest) -> Result<bool>,
+ ) -> Result<Option<crate::UpdateOutput>> {
+     crate::ensure_supported_platform()?;
++    anyhow::ensure!(
++        managed_install::system_codex_bin().is_none(),
++        "the daemon is managed by the system package manager; use pkg_add -u"
++    );
+     #[cfg(windows)]
+     crate::backend::windows::ensure_not_elevated()?;
+     let daemon = Daemon::from_environment()?;
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni
@@ -0,0 +1,13 @@
+Exclude BSD from Linux Clang module support, as in Chromium ports.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/clang.gni
+--- codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/clang.gni.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/clang.gni
+@@ -40,6 +40,7 @@
+   "x86",
+ ]
+ clang_modules_platform_supported =
++    !is_bsd &&
+     # s390x should work, but IBM doesn't want it enabled for that cpu arch.
+     (is_linux && current_cpu != "s390x") ||
+     (is_android &&
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py
@@ -0,0 +1,15 @@
+Recognize OpenBSD arm64 before the generic arm prefix.
+The Chromium patch places this branch after arm and cannot match arm64 there.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/build/detect_host_arch.py
+--- codex-rs/modcargo-crates/v8-150.4.0/build/detect_host_arch.py.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/build/detect_host_arch.py
+@@ -20,6 +20,8 @@
+     host_arch = 'ia32'
+   elif host_arch in ['x86_64', 'amd64']:
+     host_arch = 'x64'
++  elif host_arch.startswith('arm64'):
++    host_arch = 'arm64'
+   elif host_arch.startswith('arm'):
+     host_arch = 'arm'
+   elif host_arch.startswith('aarch64'):
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp
@@ -0,0 +1,89 @@
+Cache unwind sections by PC using the same RB tree as Chromium ports.
+Treat DW_EH_PE_omit before decoding its low four bits.
+Reference: www/chromium/patches/patch-third_party_libunwind_src_src_AddressSpace_hpp.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/AddressSpace.hpp
+--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/AddressSpace.hpp.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/AddressSpace.hpp
+@@ -16,6 +16,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/tree.h>
+ 
+ #include "libunwind.h"
+ #include "config.h"
+@@ -157,6 +158,62 @@
+ #endif
+ };
+ 
++class UnwindInfoSectionsCache {
++public:
++
++  struct CacheItem {
++    CacheItem(UnwindInfoSections &uis, uintptr_t pc)
++      : m_uis(uis), m_pc(pc) {
++    }
++    CacheItem(uintptr_t pc)
++      : m_pc(pc) {
++    }
++
++    UnwindInfoSections m_uis;
++    uintptr_t m_pc;
++
++    RB_ENTRY(CacheItem) entry;
++  };
++
++  typedef uintptr_t CacheItemKey;
++
++  int CacheCmp(struct CacheItem *c1, struct CacheItem *c2) {
++    return (c1->m_pc < c2->m_pc ? -1 : c1->m_pc > c2->m_pc);
++  }
++
++  UnwindInfoSectionsCache() {
++    m_head = RB_INITIALIZER(&head);
++  }
++
++  bool getUnwindInfoSectionsForPC(CacheItemKey key, UnwindInfoSections &uis) {
++    UnwindInfoSections *result = nullptr;
++    if (m_prev_req_item && m_prev_req_item->m_pc == key)
++      result = &m_prev_req_item->m_uis;
++    else {
++      struct CacheItem find(key), *res;
++      res = RB_FIND(CacheTree, &m_head, &find);
++      if (res) {
++        m_prev_req_item = res;
++        result = &res->m_uis;
++      }
++    }
++    if (result) {
++      uis = *result;
++      return true;
++    }
++    return false;
++  }
++
++  void setUnwindInfoSectionsForPC(CacheItemKey key, UnwindInfoSections &uis) {
++    CacheItem *p_item(new CacheItem(uis, key));
++    RB_INSERT(CacheTree, &m_head, p_item);
++  }
++
++private:
++  CacheItem *m_prev_req_item = nullptr;
++  RB_HEAD(CacheTree, CacheItem) m_head;
++  RB_GENERATE(CacheTree, CacheItem, entry, CacheCmp);
++};
+ 
+ /// LocalAddressSpace is used as a template parameter to UnwindCursor when
+ /// unwinding a thread in the same process.  The wrappers compile away,
+@@ -283,6 +340,10 @@
+   pint_t startAddr = addr;
+   const uint8_t *p = (uint8_t *)addr;
+   pint_t result;
++
++  if (encoding == DW_EH_PE_omit) {
++    return (pint_t)NULL;
++  }
+ 
+   // first get value
+   switch (encoding & 0x0F) {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp
@@ -0,0 +1,27 @@
+Recognize DW_EH_PE_omit before masking the table encoding; otherwise
+0xff becomes 0x0f and takes the unknown-encoding abort path.
+Reference: www/chromium/patches/patch-third_party_libunwind_src_src_EHHeaderParser_hpp.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/EHHeaderParser.hpp
+--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/EHHeaderParser.hpp.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/EHHeaderParser.hpp
+@@ -161,6 +161,10 @@
+ 
+ template <typename A>
+ size_t EHHeaderParser<A>::getTableEntrySize(uint8_t tableEnc) {
++  if (tableEnc == DW_EH_PE_omit) {
++    return 0;
++  }
++
+   switch (tableEnc & 0x0f) {
+   case DW_EH_PE_sdata2:
+   case DW_EH_PE_udata2:
+@@ -174,8 +178,6 @@
+   case DW_EH_PE_sleb128:
+   case DW_EH_PE_uleb128:
+     _LIBUNWIND_ABORT("Can't binary search on variable length encoded data.");
+-  case DW_EH_PE_omit:
+-    return 0;
+   default:
+     _LIBUNWIND_ABORT("Unknown DWARF encoding for search table.");
+   }
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp
@@ -0,0 +1,32 @@
+Reuse unwind sections by PC through a thread-local cache, matching
+the current Chromium/OpenBSD lookup and cache lifetime.
+Reference: www/chromium/patches/patch-third_party_libunwind_src_src_UnwindCursor_hpp.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/UnwindCursor.hpp
+--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/UnwindCursor.hpp.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/UnwindCursor.hpp
+@@ -113,6 +113,8 @@
+ #endif
+ 
+ namespace libunwind {
++
++static thread_local UnwindInfoSectionsCache uwis_cache;
+ 
+ #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
+ /// Cache of recently found FDEs.
+@@ -2776,7 +2778,14 @@
+ 
+   // Ask address space object to find unwind sections for this pc.
+   UnwindInfoSections sects;
+-  if (_addressSpace.template findUnwindSections<R>(pc, sects)) {
++  bool have_sects = false;
++  if (uwis_cache.getUnwindInfoSectionsForPC(pc, sects))
++    have_sects = true;
++  else if (_addressSpace.template findUnwindSections<R>(pc, sects)) {
++    uwis_cache.setUnwindInfoSectionsForPC(pc, sects);
++    have_sects = true;
++  }
++  if (have_sects) {
+ #if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND)
+     // If there is a compact unwind encoding table, look there first.
+     if (sects.compact_unwind_section != 0) {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni
@@ -0,0 +1,15 @@
+Include OpenBSD in the supported WASM interpreter platforms.
+Correct the openbds typo in the Chromium ports reference; keep the default off.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/v8/gni/v8.gni
+--- codex-rs/modcargo-crates/v8-150.4.0/v8/gni/v8.gni.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/v8/gni/v8.gni
+@@ -351,7 +351,7 @@
+     (v8_current_cpu == "x64" || v8_current_cpu == "arm64" ||
+      v8_current_cpu == "riscv64") &&
+     (target_os == "win" || target_os == "linux" || target_os == "mac" ||
+-     target_os == "ios")
++     target_os == "ios" || target_os == "openbsd" || target_os == "freebsd")
+ 
+ # Turbofan is enabled by default, except in lite mode.
+ if (v8_enable_turbofan == "") {
Index: devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc
@@ -0,0 +1,31 @@
+Mark only the usable WASM stack segment with MAP_STACK on OpenBSD.
+Preserve both no-access guard pages and the existing allocation lifetime.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/wasm/stacks.cc
+--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/wasm/stacks.cc.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/wasm/stacks.cc
+@@ -3,6 +3,10 @@
+ // found in the LICENSE file.
+ 
+ #include "src/wasm/stacks.h"
++
++#if V8_OS_OPENBSD
++#include <sys/mman.h>
++#endif
+ 
+ #include "src/base/platform/platform.h"
+ #include "src/execution/frames.h"
+@@ -86,6 +90,13 @@
+                                 "StackMemory::StackSegment::StackSegment");
+   }
+   limit_ += page_size;
++#if V8_OS_OPENBSD
++  if (mmap(limit_, size_, PROT_READ | PROT_WRITE,
++           MAP_FIXED | MAP_STACK | MAP_ANON | MAP_PRIVATE, -1, 0) == MAP_FAILED) {
++    V8::FatalProcessOutOfMemory(nullptr,
++                              "StackMemory::StackSegment::StackSegment");
++  }
++#endif
+ #ifdef V8_ENABLE_SANDBOX_HARDWARE_SUPPORT
+   // The actual stack memory must be accessible to sandboxed code, so we need
+   // to register it as sandbox extension memory here.
Index: devel/codex/patches/patch-codex-rs_tui_src_app_daemon_menu_rs
===================================================================
--- /dev/null
+++ devel/codex/patches/patch-codex-rs_tui_src_app_daemon_menu_rs
@@ -0,0 +1,28 @@
+Keep the daemon enabled while directing package updates to pkg_add.
+Do not offer self-installation actions for a distributor-owned executable.
+
+Index: codex-rs/tui/src/app/daemon_menu.rs
+--- codex-rs/tui/src/app/daemon_menu.rs.orig
++++ codex-rs/tui/src/app/daemon_menu.rs
+@@ -38,6 +38,10 @@
+         let unavailable = if matches!(self.app_server_target, AppServerTarget::Remote { .. }) {
+             Some(
+                 "Manage this server on its host. Local daemon updates are unavailable for remote connections.",
++            )
++        } else if codex_app_server_daemon::system_daemon_path().is_some() {
++            Some(
++                "The daemon is installed by the system package manager. Use pkg_add -u, then codex app-server daemon restart.",
+             )
+         } else if self.daemon_cli_executable.is_none() {
+             Some("Run the Codex CLI to manage the daemon from this menu.")
+@@ -89,7 +93,9 @@
+         let Some(executable) = &self.daemon_cli_executable else {
+             return;
+         };
+-        if matches!(self.app_server_target, AppServerTarget::Remote { .. }) {
++        if matches!(self.app_server_target, AppServerTarget::Remote { .. })
++            || codex_app_server_daemon::system_daemon_path().is_some()
++        {
+             return;
+         }
+         let mut explanation = match source {