Skip to content

feat: add Codex sandbox wrapper, engine selection, and pre-commit hooks - #6

Merged
e6qu merged 2 commits into
mainfrom
codex-cli-sandbox-support
May 21, 2026
Merged

feat: add Codex sandbox wrapper, engine selection, and pre-commit hooks#6
e6qu merged 2 commits into
mainfrom
codex-cli-sandbox-support

Conversation

@e6qu

@e6qu e6qu commented May 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add scodex wrapper for OpenAI Codex CLI alongside sclaude, sharing one Docker image with both CLIs installed
  • Tool-specific config volumes (sclaude-config, scodex-config) and shared user volumes for /home/agent, .npm-global, .local, and apt cache/lists
  • Container engine selection via SAGENT_CONTAINER_ENGINE=docker|podman with bounded health checks (default: Docker, then Podman)
  • Auto-sync Codex auth (auth.json) and config (config.toml, instructions.md, AGENTS.md) from the host into the sandbox
  • Per-tool yolo mapping: --dangerously-skip-permissions for Claude, --dangerously-bypass-approvals-and-sandbox for Codex; --no-yolo opts out
  • New cleanup.sh macOS helper for reclaiming local disk and Docker/Podman state
  • Non-fatal wrapper release-check with daily caching; SAGENT_SKIP_RELEASE_CHECK=1 disables
  • Expanded E2E suite (23 tests, T01–T23) and devcontainer suite with per-test timeouts; bug log updated through #47

Tooling

  • Add .pre-commit-config.yaml wiring up actionlint, shellcheck, bash/zsh syntax checks, Conventional Commits validation, and AI-attribution stripping on commit-msg
  • CI workflow scoped to pull requests only (no longer runs on direct pushes to main); E2E/devcontainer jobs still gated to same-repo PRs to keep secrets safe from fork PRs
  • release-please uploads both sclaude and scodex as release assets and rewrites release notes with install/update commands for both

Testing

  • pre-commit run --all-files (all hooks green)
  • shellcheck sclaude scodex test_e2e.sh test_devcontainers.sh cleanup.sh
  • bash -n and zsh -n on both wrapper scripts
  • TEST_TIMEOUT_SECONDS=900 bash test_e2e.sh (Docker)
  • SAGENT_CONTAINER_ENGINE=podman TEST_TIMEOUT_SECONDS=900 bash test_e2e.sh
  • TEST_TIMEOUT_SECONDS=120 bash test_devcontainers.sh

@e6qu e6qu changed the title Add Codex sandbox wrapper support feat: add Codex sandbox wrapper support May 21, 2026
@e6qu
e6qu force-pushed the codex-cli-sandbox-support branch from a33aec9 to 638d1da Compare May 21, 2026 11:15
Safety / correctness:
- cleanup.sh: guard for macOS-only (referenced ~/.Trash and applehv paths);
  replace `rm -rf "$HOME/.Trash"/*` with `find` (set -e + empty/dotfile-only
  Trash aborted the script)
- sclaude/scodex: trap INT/TERM/HUP in addition to EXIT so temp Dockerfiles
  are cleaned up on signals
- sclaude/scodex: `reset` refuses non-TTY stdin without SAGENT_ASSUME_YES=1;
  previously `read -r` returned immediately on piped/CI stdin and silently
  deleted volumes
- scodex: reject CODEX_HOME symlinks (whole-dir and per-file) in
  sync_codex_config_files to prevent following attacker-controlled symlinks
  through the read-only mount
- sclaude/scodex: pass secrets via `-e VAR` (no =) so values no longer
  appear in `docker run` argv (visible in `ps -ef` and `docker inspect`)

Efficiency / quality:
- sclaude/scodex: cache HOST_UID/HOST_GID once at startup (was forking
  id -u / id -g 4-6 times per run)
- sclaude/scodex: create_volumes now runs one `volume ls` and creates only
  missing volumes (was 6 sequential `volume create` calls every run; high
  impact on Podman/macOS VM round-trips)
- sclaude/scodex: collapse build_image if/else into a single invocation
  with a build_args array
- sclaude/scodex: cleanup_images uses one combined `grep -vE` filter

Env var coverage (verified against current Claude Code and Codex docs):
- sclaude: pass through ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL,
  ANTHROPIC_MODEL, CLAUDE_CODE_OAUTH_TOKEN (the OAuth token is required
  for paid Claude.ai users who don't have an API key)
- scodex: rename OPENAI_ORG_ID -> OPENAI_ORGANIZATION and OPENAI_PROJECT_ID
  -> OPENAI_PROJECT (Codex CLI follows Python SDK convention, not Node);
  add SSL_CERT_FILE (documented fallback when CODEX_CA_CERTIFICATE unset)

Tests:
- test_e2e.sh T09: use SAGENT_ASSUME_YES=1 instead of `echo "" |` (matches
  the new reset guard; the old form would now fail correctly)
@e6qu
e6qu force-pushed the codex-cli-sandbox-support branch from a10f847 to a1f0a18 Compare May 21, 2026 11:48
@e6qu e6qu changed the title feat: add Codex sandbox wrapper support feat: add Codex sandbox wrapper, engine selection, and pre-commit hooks May 21, 2026
@e6qu
e6qu merged commit 3afc723 into main May 21, 2026
5 checks passed
@e6qu
e6qu deleted the codex-cli-sandbox-support branch May 21, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant