feat: port claude-jail upgrades — arg-parsing lock, pruning ignore walk, /opt/mcp + --mcp-image #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/upstream-2026-08-25"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Brings codex-jail up to date with claude-jail through a3d865c (2026-08-25). Five commits, one per upstream feature, each with its tests.
Position-anchored workspace parsing (claude-jail c0c8d87 + 62d22a3)
A bare word can claim the workspace only while the wrapper is still parsing its own arguments; anything bound for codex locks the slot.
codex . -p docsnow mounts.and forwards-p docsinstead ofsilently mounting
./docs. A--is consumed as the wrapper boundary while the slot is open and forwarded to codex once it is locked, socodex . mcp add srv --env K=V -- /opt/mcp/srvreaches the CLIintact. Two bare directories are a hard error naming both fixes, and the resolved workspace is printed to stderr. Spec ported to
docs/superpowers/specs/2026-08-25-argument-parsing-design.md..codexignorepruning find walk (claude-jail a92e6c6)Patterns become path-aware EREs fed to a single
findwalk that-prunes at each matching directory: hidingnode_modules/costs one mount and the walk never enters it, where the old globstarexpansion re-walked the whole tree per pattern and could push podman's argv past ARG_MAX. Also fixes the inherited defects: a pattern containing a space matched nothing, and trailing whitespace was
stripped one character at a time. Known divergence (documented, pinned by a test): a pattern segment no longer reaches through a symlinked directory.
Shared MCP servers:
/opt/mcp+--mcp-image(claude-jail 340140c + a3d865c)~/.codex-jail/mcpis mounted read-only at/opt/mcpin every container, socodex mcp add <name> -- /opt/mcp/<server>resolves in every workspace without depending onCODEX_JAIL_MOUNTS.--mcp-image <ref>(orCODEX_JAIL_MCP_IMAGES, comma-separated) fills the directory from OCI images whose entrypoint is a single static binary (e.g.ghcr.io/mudler/mcps/*): pulled every run so:latesttracks upstream, extracted from a created-but-never-started container, refreshed only when the image id moved, temp-file + rename so a concurrently executing binary is never written in place,pull failures fall back to the cached copy, hand-dropped binaries are never clobbered, and
--dry-runnarrates instead of touching podman.Divergence from upstream, by design: codex-jail mounts the whole jail directory read-write at
/home/codex/.codex, which claude-jail does not — an unprotectedmcp/would let the agent rewrite aserver binary that every future session, in any workspace, executes. The directory is therefore seeded on first run and its read-write view is hidden behind an empty tmpfs, exactly like the existing
env.defaultmask; binaries are reachable only through the read-only/opt/mcp. A stray non-directory at~/.codex-jail/mcpfails closed with a clear error.Catch-ups (claude-jail 3503587, f61edc2, c589ca2)
Dockerfile pre-creates
~/.cache/sshfor the SSH ControlPath socket;.gitignoregains the local-Claude-settings and worktrees entries;.env.exampledocumentsCODEX_JAIL_NETWORK(already supportedby script and README) and
CODEX_JAIL_MCP_IMAGES.Testing
The suite grows from 37 to 106 tests:
test_arg_parsing.sh(19),test_codexignore.sh(27),test_mcp_dir.sh(7),test_mcp_images.sh(16). The podman stub gains simulatedpull/image inspect/create/cp/rmsubcommands and a call journal (STUB_CALLS_FILE) so the extraction flow runs end to end. New-behaviour tests were watched fail before each implementation;bash tests/run.sh→ ALL TESTS PASSED, plus a real--dry-runverified the new mounts and stderr diagnostics by hand.Port of claude-jail c0c8d87 + 62d22a3. A bare word may claim the workspace only while the wrapper is still parsing its own arguments; anything bound for codex locks the slot, so an option value ('codex . -p docs') can no longer be mounted by accident. -- is consumed as the boundary while the slot is open and forwarded to codex once it is locked, so 'codex . mcp add srv --env K=V -- /path' reaches the CLI intact. Two bare directories are an error naming both fixes, and the resolved workspace is printed to stderr. Adds tests/test_arg_parsing.sh: 9 tests for the new behaviour and 10 pinning documented invocations (watched fail before the change). Claude-Session: https://claude.ai/code/session_0166CnS6KiUy1ZyMdgVGMemy