summaryrefslogtreecommitdiff
path: root/gnu/packages/codex.scm
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@friendly-machines.com>2026-04-26 17:47:37 +0200
committerDanny Milosavljevic <dannym@friendly-machines.com>2026-04-26 22:47:11 +0200
commita1a82d252573dde7694078006f93cec12d7acb37 (patch)
tree25e562596dc110d0da625f0c20ca8235231c736d /gnu/packages/codex.scm
parentecda809fd454fa1574616ecfcd695678238e3aca (diff)
gnu: codex: Update to 0.124.0.
* gnu/packages/patches/rust-codex-0.124.0-code-mode-stub-toolname.patch: New file. * gnu/packages/patches/rust-codex-0.124.0-remove-patch-sections.patch: New file. * gnu/local.mk (dist_patch_DATA): Add references to them. * gnu/packages/codex.scm (codex): Update to 0.124.0. * gnu/packages/rust-crates.scm: Update. * gnu/packages/rust-sources.scm (rust-codex-0.124.0): New variable. Change-Id: I90570206d39c533edfc6d70e229ee3f7eda9dcf2
Diffstat (limited to 'gnu/packages/codex.scm')
-rw-r--r--gnu/packages/codex.scm252
1 files changed, 229 insertions, 23 deletions
diff --git a/gnu/packages/codex.scm b/gnu/packages/codex.scm
index 3be606801d3..45ce360fd02 100644
--- a/gnu/packages/codex.scm
+++ b/gnu/packages/codex.scm
@@ -18,10 +18,10 @@
18 18
19;;; This module is separate from (gnu packages rust-apps) to avoid a 19;;; This module is separate from (gnu packages rust-apps) to avoid a
20;;; circular module dependency: (gnu packages rust-sources), which 20;;; circular module dependency: (gnu packages rust-sources), which
21;;; defines rust-codex-0.120.0, transitively loads (gnu packages 21;;; defines rust-codex-0.124.0, transitively loads (gnu packages
22;;; rust-apps) through its #:use-module chain. If the codex package 22;;; rust-apps) through its #:use-module chain. If the codex package
23;;; lived in rust-apps.scm, loading rust-sources would trigger loading 23;;; lived in rust-apps.scm, loading rust-sources would trigger loading
24;;; rust-apps before rust-codex-0.120.0 is defined, causing an unbound 24;;; rust-apps before rust-codex-0.124.0 is defined, causing an unbound
25;;; variable error. 25;;; variable error.
26 26
27(define-module (gnu packages codex) 27(define-module (gnu packages codex)
@@ -54,14 +54,14 @@
54(define-public codex 54(define-public codex
55 (package 55 (package
56 (name "codex") 56 (name "codex")
57 (version (package-version rust-codex-0.120.0)) 57 (version (package-version rust-codex-0.124.0))
58 (source 58 (source
59 (origin 59 (origin
60 (inherit (package-source rust-codex-0.120.0)) 60 (inherit (package-source rust-codex-0.124.0))
61 (patches (search-patches 61 (patches (search-patches
62 "codex-acp-0.11.1-disable-code-mode.patch" 62 "codex-acp-0.11.1-disable-code-mode.patch"
63 "rust-codex-0.117.0-remove-patch-sections.patch" 63 "rust-codex-0.124.0-code-mode-stub-toolname.patch"
64 "rust-codex-0.120.0-connectors-cache-test-race.patch" 64 "rust-codex-0.124.0-remove-patch-sections.patch"
65 "rust-codex-0.120.0-remove-libwebrtc.patch" 65 "rust-codex-0.120.0-remove-libwebrtc.patch"
66 "rust-codex-0.98.0-test-shebangs.patch" 66 "rust-codex-0.98.0-test-shebangs.patch"
67 "rust-codex-0.120.0-test-timeout.patch")))) 67 "rust-codex-0.120.0-test-timeout.patch"))))
@@ -69,7 +69,12 @@
69 (arguments 69 (arguments
70 (list 70 (list
71 #:install-source? #f 71 #:install-source? #f
72 #:cargo-install-paths '(list "cli" "exec" "exec-server" 72 ;; exec-server is library-only in 0.124 (no [[bin]] in
73 ;; exec-server/Cargo.toml); cargo install --path exec-server fails
74 ;; with "no packages found with binaries or examples". Drop it
75 ;; from the install paths -- the library is consumed via the
76 ;; workspace by other binaries here, not installed standalone.
77 #:cargo-install-paths '(list "cli" "exec"
73 "linux-sandbox" "mcp-server" 78 "linux-sandbox" "mcp-server"
74 "app-server" "tui") 79 "app-server" "tui")
75 ;; schema_fixtures_match_generated (upstream fixture is stale: 80 ;; schema_fixtures_match_generated (upstream fixture is stale:
@@ -317,7 +322,164 @@
317 ;; (chatgpt.com, api.github.com) wait 322 ;; (chatgpt.com, api.github.com) wait
318 ;; for TCP timeout instead of failing 323 ;; for TCP timeout instead of failing
319 ;; instantly at TLS, eating the budget. 324 ;; instantly at TLS, eating the budget.
320 "--skip" "mcp_server_status_list_tools_and_auth_only_skips_slow_inventory_calls") 325 "--skip" "mcp_server_status_list_tools_and_auth_only_skips_slow_inventory_calls"
326 ;;; BEGIN Stack overflow in 'current_thread'
327 ;;; tokio runtime. The sibling tests in
328 ;;; tracing_tests.rs use the local helper
329 ;;; run_current_thread_test_with_stack
330 ;;; (4 MiB) but this one uses bare
331 ;;; #[tokio::test] on the 2 MiB default
332 ;;; test-thread stack, and TurnStart's
333 ;;; future graph exceeds it. With
334 ;;; RUST_MIN_STACK raised the overflow is
335 ;;; gone but the test then deterministically
336 ;;; times out waiting for a span tagged
337 ;;; codex.op = "user_input" on the remote
338 ;;; trace that upstream never emits on that
339 ;;; trace in our environment.
340 "--skip" "turn_start_jsonrpc_span_parents_core_turn_spans"
341 ;;; END tracing test stack/timeout
342 ;;; BEGIN The upstream loader resolves the
343 ;;; MCP OAuth credentials store mode by
344 ;;; calling
345 ;;; resolve_mcp_oauth_credentials_store_mode
346 ;;; with env!("CARGO_PKG_VERSION") -- which
347 ;;; in the released 0.124.0 tarball is
348 ;;; "0.124.0". These fixture tests
349 ;;; construct the expected Config by
350 ;;; passing the LOCAL_DEV_BUILD_VERSION
351 ;;; constant ("0.0.0") to the same
352 ;;; resolver, and the resolver only returns
353 ;;; File for "0.0.0" -- Auto otherwise.
354 ;;; Upstream CI builds from a checkout
355 ;;; still carrying version = "0.0.0" so the
356 ;;; tests pass there; they cannot pass
357 ;;; against a released tag.
358 "--skip" "test_precedence_fixture_with_gpt3_profile"
359 "--skip" "test_precedence_fixture_with_gpt5_profile"
360 "--skip" "test_precedence_fixture_with_o3_profile"
361 "--skip" "test_precedence_fixture_with_zdr_profile"
362 ;;; END LOCAL_DEV_BUILD_VERSION fixture mismatch
363 ;;; BEGIN Verifies that Codex's user-shell
364 ;;; spawn produces a child where
365 ;;; CODEX_SANDBOX_NETWORK_DISABLED is unset
366 ;;; (asserts stdout == "not-set"). We
367 ;;; deliberately set that env var at the
368 ;;; check phase to trigger upstream's
369 ;;; skip_if_no_network! guards; the var then
370 ;;; leaks into the spawned shell and the
371 ;;; assertion fails. The guix skip is a
372 ;;; direct cost of the network-gate fix --
373 ;;; trading one broken test for two that
374 ;;; now skip cleanly.
375 "--skip" "user_shell_command_does_not_set_network_sandbox_env_var"
376 ;;; END CODEX_SANDBOX_NETWORK_DISABLED leak
377 ;;; BEGIN The exec-server/tests/file_system
378 ;;; integration tests invoke the real
379 ;;; system bwrap, which tries to execvp the
380 ;;; test binary at the cargo target path
381 ;;; under the build dir. Same root cause
382 ;;; as the existing
383 ;;; sandbox_reenables_writable_subpaths_under_unreadable_parents
384 ;;; skip: guix builds live under /tmp but
385 ;;; bwrap's mount namespace excludes /tmp,
386 ;;; making the binary invisible inside the
387 ;;; namespace.
388 "--skip" "file_system_copy_preserves_symlink_source"
389 "--skip" "file_system_copy_rejects_symlink_escape_destination"
390 "--skip" "file_system_copy_rejects_symlink_escape_source"
391 "--skip" "file_system_create_directory_rejects_symlink_escape"
392 "--skip" "file_system_read_directory_rejects_symlink_escape"
393 "--skip" "file_system_remove_rejects_symlink_escape"
394 "--skip" "file_system_remove_removes_symlink_not_target"
395 "--skip" "file_system_sandboxed_read_allows_readable_root"
396 "--skip" "file_system_sandboxed_read_rejects_symlink_escape"
397 "--skip" "file_system_sandboxed_read_rejects_symlink_parent_dotdot_escape"
398 "--skip" "file_system_sandboxed_write_allows_additional_write_root"
399 "--skip" "file_system_sandboxed_write_rejects_symlink_escape"
400 "--skip" "file_system_sandboxed_write_rejects_unwritable_path"
401 ;;; END bwrap-cant-see-/tmp file_system tests
402 ;;; BEGIN Landlock is unavailable on Guix,
403 ;;; so the sandbox cannot deny network
404 ;;; syscalls. These tests expect
405 ;;; SandboxErr::Denied for the nc, ping,
406 ;;; ssh, getent, and dev_tcp_redirection
407 ;;; commands but those commands instead
408 ;;; block on connect() until the test's 2s
409 ;;; timeout fires (Timeout, exit 124).
410 ;;; Same root cause as the Landlock skips
411 ;;; at the top of this list; new test names
412 ;;; in 0.124.
413 "--skip" "sandbox_blocks_nc"
414 "--skip" "sandbox_blocks_ping"
415 "--skip" "sandbox_blocks_dev_tcp_redirection"
416 "--skip" "sandbox_blocks_getent"
417 "--skip" "sandbox_blocks_ssh"
418 ;;; END Landlock network block
419 ;;; BEGIN Requires github.com network access.
420 ;;; With no "extraKnownMarketplaces" entry
421 ;;; in settings.json,
422 ;;; collect_marketplace_import_sources
423 ;;; inserts a fallback entry for the
424 ;;; "claude-plugins-official" marketplace
425 ;;; pointing at the github shorthand
426 ;;; "anthropics/claude-plugins-official".
427 ;;; add_marketplace -> parse_marketplace_source
428 ;;; expands that to a github.com/.git URL
429 ;;; and clone_git_source runs 'git clone'.
430 ;;; The Guix build sandbox has no network,
431 ;;; so the clone fails and the marketplace
432 ;;; lands in failed_marketplaces. No mock
433 ;;; cloner is injected via
434 ;;; ExternalAgentConfigService::new_for_test,
435 ;;; so there is no in-tree way to satisfy
436 ;;; the test offline.
437 "--skip" "import_plugins_infers_claude_official_marketplace_when_missing_from_settings"
438 ;;; END github.com network access
439 ;;; BEGIN Async race between the rollout
440 ;;; writer task and a direct SQLite read.
441 ;;; The test calls
442 ;;; update_memory_settings_with_app_server,
443 ;;; which routes through the in-memory
444 ;;; thread path on the app-server's
445 ;;; ThreadMemoryModeSet handler ->
446 ;;; Session::set_thread_memory_mode ->
447 ;;; persist_thread_memory_mode_update,
448 ;;; which writes a RolloutItem::SessionMeta
449 ;;; with the new mode to the rollout file
450 ;;; via recorder.record_items + flush. The
451 ;;; rollout writer task then asynchronously
452 ;;; calls sync_thread_state_after_write,
453 ;;; which calls state_db::apply_rollout_items
454 ;;; to mirror the SessionMeta into SQLite.
455 ;;; flush() only awaits the rollout-file
456 ;;; write, not the subsequent SQLite sync.
457 ;;; The test opens a fresh StateRuntime and
458 ;;; reads get_thread_memory_mode
459 ;;; immediately, so it observes the creation
460 ;;; default of "enabled" written by
461 ;;; upsert_thread_with_creation_memory_mode
462 ;;; instead of the new "disabled". Upstream
463 ;;; CI wins this race; we lose.
464 "--skip" "update_memory_settings_updates_current_thread_memory_mode"
465 ;;; END memory-mode rollout/sqlite race
466 ;;; BEGIN The Stopwatch::new constructor in
467 ;;; codex_shell_escalation anchors
468 ;;; T0 = Instant::now() at construction;
469 ;;; the spawned cancellation task fires at
470 ;;; T0 + limit. The test captures
471 ;;; start = Instant::now() at T1 > T0 (after
472 ;;; cancellation_token() returns) and
473 ;;; asserts start.elapsed() >= limit,
474 ;;; i.e. (T0 + limit) - T1 >= limit, which
475 ;;; is always false by the offset T1 - T0.
476 ;;; The test only passes when scheduler
477 ;;; jitter on the sleep wakeup happens to
478 ;;; exceed that offset. Upstream wins the
479 ;;; race; we don't always.
480 "--skip" "cancellation_receiver_fires_after_limit"
481 ;;; END Stopwatch construction/start offset race
482 )
321 #:cargo-package-crates 483 #:cargo-package-crates
322 ''(;;; Tier 0: No internal deps. 484 ''(;;; Tier 0: No internal deps.
323 "codex-ansi-escape" 485 "codex-ansi-escape"
@@ -358,22 +520,31 @@
358 "codex-debug-client" 520 "codex-debug-client"
359 "codex-analytics" 521 "codex-analytics"
360 "codex-rollout" 522 "codex-rollout"
523 "codex-rollout-trace"
361 "codex-terminal-detection" 524 "codex-terminal-detection"
362 "codex-utils-approval-presets" 525 "codex-utils-approval-presets"
363 "codex-utils-cli" 526 "codex-utils-cli"
527 "codex-uds"
528 "codex-install-context"
529 "codex-device-key"
364 ;;; Tier 2. 530 ;;; Tier 2.
365 "codex-app-server-protocol" 531 "codex-app-server-protocol"
366 "codex-rmcp-client" 532 "codex-rmcp-client"
367 "codex-otel" 533 "codex-otel"
534 "codex-thread-store"
368 "codex-state" 535 "codex-state"
369 "codex-features" 536 "codex-features"
537 "codex-model-provider"
370 "codex-config" 538 "codex-config"
539 "codex-agent-identity"
540 "codex-aws-auth"
371 "codex-hooks" 541 "codex-hooks"
372 "codex-instructions"
373 "codex-code-mode" 542 "codex-code-mode"
374 "codex-feedback" 543 "codex-feedback"
375 "codex-skills" 544 "codex-skills"
545 "codex-test-binary-support"
376 "codex-core" 546 "codex-core"
547 "codex-core-plugins"
377 "codex-utils-sandbox-summary" 548 "codex-utils-sandbox-summary"
378 "codex-linux-sandbox" 549 "codex-linux-sandbox"
379 "codex-sandboxing" 550 "codex-sandboxing"
@@ -425,7 +596,7 @@
425 ;; Update them to match the actual package version. 596 ;; Update them to match the actual package version.
426 (let ((snap-files (find-files "." "\\.snap$"))) 597 (let ((snap-files (find-files "." "\\.snap$")))
427 (substitute* snap-files 598 (substitute* snap-files
428 (("\\(v0\\.0\\.0\\) ") "(v0.120.0) "))))) 599 (("\\(v0\\.0\\.0\\) ") "(v0.124.0) ")))))
429 (add-after 'chdir-to-workspace 'patch-git-deps-to-vendor 600 (add-after 'chdir-to-workspace 'patch-git-deps-to-vendor
430 (lambda _ 601 (lambda _
431 ;; Replace git dependencies with version references so cargo 602 ;; Replace git dependencies with version references so cargo
@@ -436,32 +607,55 @@
436 (("runfiles = \\{ git = [^}]+\\}") 607 (("runfiles = \\{ git = [^}]+\\}")
437 "runfiles = \"0.1.0\"")) 608 "runfiles = \"0.1.0\""))
438 ;; Remove workspace members that have unbuildable deps 609 ;; Remove workspace members that have unbuildable deps
439 ;; (libwebrtc requires git fetch, v8-poc requires V8). 610 ;; (v8-poc requires V8). code-mode stays a workspace member
611 ;; so its codex-protocol resolves to the same local copy as
612 ;; the rest of the build; disabling its default features
613 ;; (below) avoids pulling in V8.
440 (substitute* "Cargo.toml" 614 (substitute* "Cargo.toml"
441 (("\"v8-poc\",") "") 615 (("\"v8-poc\",") ""))
442 (("\"code-mode\",") "")) 616 ;; Disable V8 runtime in codex-code-mode by turning off
443 ;; Disable V8 runtime in codex-code-mode: remove path 617 ;; default features. Keep path= so code-mode is resolved
444 ;; so cargo resolves it from the vendor (where it has 618 ;; from the local source tree and shares codex-protocol
445 ;; optional = true on v8) and disable default features. 619 ;; (and other workspace crates) with the rest of the build;
620 ;; resolving it from the vendor instead introduces a
621 ;; duplicate codex-protocol and causes E0308 type
622 ;; mismatches in codex-tools.
446 (substitute* "Cargo.toml" 623 (substitute* "Cargo.toml"
447 (("codex-code-mode = \\{ path = \"code-mode\" \\}") 624 (("codex-code-mode = \\{ path = \"code-mode\" \\}")
448 "codex-code-mode = { version = \"0.120.0\", default-features = false }")))) 625 "codex-code-mode = { path = \"code-mode\", default-features = false }"))
626 ;; cargo build at workspace root ignores per-dep
627 ;; default-features=false and builds code-mode with its
628 ;; own default features, which include v8-runtime and
629 ;; would pull in V8. Make the default feature empty.
630 (substitute* "code-mode/Cargo.toml"
631 (("^default = \\[\"v8-runtime\"\\]") "default = []"))))
449 (add-after 'patch-git-deps-to-vendor 'add-version-to-workspace-deps 632 (add-after 'patch-git-deps-to-vendor 'add-version-to-workspace-deps
450 (lambda _ 633 (lambda _
451 ;; cargo package requires all dependencies to have versions. 634 ;; cargo package requires all dependencies to have versions.
452 ;; cargo package requires all dependencies to have versions. 635 ;; Add version = "0.124.0" to internal path dependencies.
453 ;; Add version = "0.120.0" to internal path dependencies.
454 (let ((cargo-files (find-files "." "^Cargo\\.toml$"))) 636 (let ((cargo-files (find-files "." "^Cargo\\.toml$")))
455 (substitute* cargo-files 637 (substitute* cargo-files
456 ;; Handle inline deps: name = { path = "..." } 638 ;; Handle inline deps: name = { path = "..." }
457 (("(codex-[a-z0-9-]+) = \\{ path = " all name) 639 (("(codex-[a-z0-9-]+) = \\{ path = " all name)
458 (string-append name " = { version = \"0.120.0\", path = ")) 640 (string-append name " = { version = \"0.124.0\", path = "))
459 ;; Handle inline deps with package: name = { package = "...", path = "..." } 641 ;; Handle inline deps with package: name = { package = "...", path = "..." }
460 (("(codex-[a-z0-9-]+) = \\{ package = " all name) 642 (("(codex-[a-z0-9-]+) = \\{ package = " all name)
461 (string-append name " = { version = \"0.120.0\", package = ")) 643 (string-append name " = { version = \"0.124.0\", package = "))
462 ;; Handle section deps: [dependencies.X] with path = "..." 644 ;; Handle section deps: [dependencies.X] with path = "..."
463 (("^(path = \"\\.\\./[^\"]*\")" all path-line) 645 (("^(path = \"\\.\\./[^\"]*\")" all path-line)
464 (string-append path-line "\nversion = \"0.120.0\"")))))) 646 (string-append path-line "\nversion = \"0.124.0\""))))))
647 (add-after 'chdir-to-workspace 'use-gnu-store-in-sandbox
648 (lambda _
649 ;; LINUX_PLATFORM_DEFAULT_READ_ROOTS in linux-sandbox/src/
650 ;; bwrap.rs is the read-only baseline that codex's bwrap
651 ;; sandbox bind-mounts so commands can read /usr/bin/ls,
652 ;; libc, etc. Upstream lists "/nix/store" for NixOS;
653 ;; Guix's equivalent is "/gnu/store". Without this swap,
654 ;; the codex sandbox cannot locate any binaries on a Guix
655 ;; system because every "system" path resolves into
656 ;; /gnu/store/<hash>-pkg/bin/...
657 (substitute* "linux-sandbox/src/bwrap.rs"
658 (("\"/nix/store\"") "\"/gnu/store\""))))
465 (add-after 'chdir-to-workspace 'patch-hardcoded-paths 659 (add-after 'chdir-to-workspace 'patch-hardcoded-paths
466 (lambda* (#:key inputs #:allow-other-keys) 660 (lambda* (#:key inputs #:allow-other-keys)
467 (let ((bash-bin (string-append 661 (let ((bash-bin (string-append
@@ -561,10 +755,12 @@
561 ;; double quotes. 755 ;; double quotes.
562 (substitute* 756 (substitute*
563 (list "core/src/plugins/startup_sync_tests.rs" 757 (list "core/src/plugins/startup_sync_tests.rs"
758 "core/src/tools/runtimes/shell/unix_escalation_tests.rs"
564 "core/tests/suite/client.rs" 759 "core/tests/suite/client.rs"
565 "core/tests/suite/js_repl.rs" 760 "core/tests/suite/js_repl.rs"
566 "core/tests/suite/skill_approval.rs" 761 "core/tests/suite/skill_approval.rs"
567 "core/tests/suite/user_notification.rs" 762 "core/tests/suite/user_notification.rs"
763 "exec-server/tests/file_system.rs"
568 "login/src/auth/auth_tests.rs" 764 "login/src/auth/auth_tests.rs"
569 "models-manager/src/manager_tests.rs" 765 "models-manager/src/manager_tests.rs"
570 "sandboxing/src/bwrap_tests.rs") 766 "sandboxing/src/bwrap_tests.rs")
@@ -613,7 +809,17 @@
613 ;; ~/... and 30 snapshot tests fail. 809 ;; ~/... and 30 snapshot tests fail.
614 (setenv "HOME" "/tmp/guix-home") 810 (setenv "HOME" "/tmp/guix-home")
615 (mkdir-p "/tmp/guix-home") 811 (mkdir-p "/tmp/guix-home")
616 (setenv "USER" "nixbld")))))) 812 (setenv "USER" "nixbld")
813 ;; Default libtest thread stack is 2 MiB, which is not
814 ;; enough for tokio current_thread tests that drive
815 ;; codex-core's full turn pipeline. Upstream gates such
816 ;; tests through run_current_thread_test_with_stack (4 MiB)
817 ;; in app-server/src/message_processor/tracing_tests.rs;
818 ;; raise the global default so future additions that
819 ;; forget the wrapper still pass.
820 (setenv "RUST_MIN_STACK" "8388608")
821 ;; Disable network access.
822 (setenv "CODEX_SANDBOX_NETWORK_DISABLED" "1"))))))
617 (native-inputs `(("bubblewrap" ,bubblewrap) ;tests need bwrap on PATH 823 (native-inputs `(("bubblewrap" ,bubblewrap) ;tests need bwrap on PATH
618 ("clang" ,clang) 824 ("clang" ,clang)
619 ("cmake-minimal" ,cmake-minimal) 825 ("cmake-minimal" ,cmake-minimal)