Nix entry points in Codex workers

Use the prebuilt-entry route on Linux. The conductor resolves and builds the project's declared apps..test.program, warms its runtime caches, then passes…

Nix entry points in Codex workers

Prompt-first procedure: Describe the outcome you want in your agent conversation. The agent should select and load the appropriate AIWG assets, explain material changes, request any needed approval, and report verification evidence. Exact commands and flags appear only in the CLI reference.

"Prepare this flake's test app outside the worker sandbox, then give the Codex

worker its exact built program and test arguments. Keep network access off and

allow writes only to the worktree, temporary files and the Nix/uv caches."

First time using AIWG? Begin with Install, Connect, and Verify.

Use the prebuilt-entry route on Linux. The conductor resolves and builds the project's declared `apps.<system>.test.program`, warms its runtime caches, then passes that exact store program to the worker. This preserves the flake's test environment; a host Python interpreter can differ from it.

Prepare on the conductor

Run these commands in the flake project outside the worker sandbox. The example test argument must be replaced with the project's required test selection.

system="$(nix eval the impure option the raw option the expr option builtins.currentSystem)"
program="$(nix eval the raw option ".#apps.${system}.test.program")"
printf '%s\
' "$program"
nix run .#test -- tests/example.py
UV_OFFLINE=1 "$program" tests/example.py

`nix run` on the conductor realizes the app and warms runtime dependencies (for example uv's Python environment). The direct offline run then verifies that the prepared entry needs no downloads. When its deriver is already known, you can also build with `nix build the no-link option "$program"` and run the program once to warm caches. Resolving a program string alone may not register its deriver; the conductor's `nix run` handles that case. Retain the exact program path, test arguments, exit code and output in the worker brief. Rebuild and re-resolve after changes to the flake or test wrapper. If the worker changes those inputs, prepare the new entry on the conductor before relying on worker test results.

Allow narrow cache writes

Create caches before qualification:

mkdir -p ~/.cache/nix ~/.cache/uv

In the existing `parallelism.clis.codex` entry, set:

{
  "extraWritableRoots": ["~/.cache/nix", "~/.cache/uv"],
  "nixDaemonSocket": false
}

Keep the existing adapter, accountScope and quotaScope. These settings also work for named installations using `providers:codex`. Use a `workspace-write` group sandbox with network off. Both options default off; leave `nixDaemonSocket` off on Linux. Cache roots supplement the worktree and native temporary roots; the worker reads `/nix/store` and receives no full-home write access. Include only caches the app needs; uv is needed only when the app uses it.

Roots must be absolute or `~/`-relative directories. AIWG expands `~`, resolves symlinks and rejects HOME, its ancestors, system directories, other users' homes and broad roots such as `/`, `/tmp`, `/var` and `/nix`. Qualification rejects roots containing installed worker code or its approval store. Input and final-output paths remain scoped to the worktree.

Use AIWG to complete this documented outcome: Roots must be absolute or ~/-relative directories. AIWG expands ~, resolves symlinks and rejects HOME, its ancestors, system directories, other users' homes and broad roots such as /, /tmp, /var and /nix. Qualification rejects roots contain
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

Cache and socket settings are part of the signed qualification scope. Any change invalidates the old approval: requalify, then run the agent-owned models operation again. Saved invocations also recheck the qualification digest.

Run the built entry in the worker

Give the worker the literal absolute store path printed by the conductor; variables from the conductor's shell do not carry into the worker. For example, its brief can assign that exact value to `program`, then run:

UV_OFFLINE=1 "$program" tests/example.py

Use the same arguments as the conductor. `UV_OFFLINE=1` prevents uv downloads; Codex's native sandbox separately keeps network access off. Compare exit codes and output. Missing cached dependencies require conductor preparation and a retry. If preparation or direct execution is unavailable, run the exact declared `nix run .#test -- tests/example.py` on the conductor and record its results.

Why the daemon route fails on Linux

With Codex 0.172.0 on Linux, `nix run .#test` in a workspace-write sandbox fails with `cannot connect to socket at '/nix/var/nix/daemon-socket/socket': Operation not permitted`. Writable caches alone do not fix Unix-socket access. Codex cannot allow a single Unix socket on Linux without allowing all Unix sockets; AIWG does not grant that broader permission. The existing `nixDaemonSocket` setting requests only the fixed Nix socket through the network proxy with no allowed HTTP domains. It remains a safe, qualified opt-in for platforms that support it, but is ineffective on Linux. It requires Codex 0.163.0 or newer within the supported profile range.

In flake projects, qualification separately probes the daemon and offline flake metadata. JSON results retain `codexSandboxChecks[].nix` for the daemon result, add `nixMetadata`, and describe both routes in `nixRoutes` and informational `findings`, with a pointer to this guide. A failed socket probe with the option enabled explicitly reports `nixDaemonSocket: ineffective on this platform`. `prebuiltEntry: "available-after-conductor-prebuild"` describes the supported route, not a claim that this project's program or caches have been prepared. Doctor does not build or execute project tests, update the lockfile or fetch inputs. Non-flake projects get no Nix probes; explicit external policies skip sandbox checks. Missing offline metadata is reported separately from the daemon. These findings do not block an otherwise valid worker approval.

The BT6 workspace identified and verified this prebuilt-entry recipe on a real project: 16 passed, 1 skipped, offline, with only the Nix/uv caches added as writable roots. Titan also verified direct program execution with Codex 0.172.0 while `nix run` still failed inside the sandbox. These observations establish the route; each project's conductor must still prepare its own entry and caches.