Skip to content

Make repo-worktree sandbox-aware for Codex #801

Closed

Description

@ptr727

Problem

The repo-worktree skill mandates ~/repos/worktrees/<Repo>-<task-slug>. A Codex session can have a workspace-write sandbox that permits edits only in the primary checkout and /tmp. In that environment, Git can create the standard worktree with approved elevation, but subsequent file edits fail because the worktree is outside the writable roots.

This occurred while implementing issue #800. The clean worktree had to be removed and recreated under /tmp before implementation could begin.

Required Work

  • Teach repo-worktree to inspect or account for the active writable roots before choosing a path.
  • Preserve the standard fleet layout when it is writable.
  • Define a Codex-compatible fallback under a writable temporary root when the standard path is not writable.
  • Preserve the existing isolation, base-branch, continuation, ownership, and cleanup guarantees.
  • State how a temporary worktree is named and cleaned up after merge.
  • Add or update skill validation and generated distributions.

Acceptance Criteria

  • A Codex session with only the repository and /tmp writable can create and edit an isolated task worktree without relocating it after creation.
  • A session that can write the standard fleet path continues to use it.
  • The fallback does not weaken the rule that every task gets its own branch and worktree before the first edit.
  • The generated skill distributions remain synchronized.

Activity

  1. ptr727 commented on Aug 18, 2026

    @ptr727
    OwnerAuthor

    A second recurring Codex sandbox class surfaced during issue #800 verification:

    • uvx could not create temporary files under the default ~/.cache/uv because that path was read-only. Setting UV_CACHE_DIR to a task-specific directory under /tmp fixed the write boundary.
    • The sandbox then blocked DNS access to PyPI, so the prescribed uvx ...@latest checks required an approved rerun with network access.
    • Docker-based linters could not access /var/run/docker.sock inside the sandbox, so the prescribed container checks required an approved host-access rerun.

    Please expand the issue beyond worktree placement to make the operational rules sandbox-aware where Codex is the executor. The guidance should define:

    • a task-specific writable cache location for tools such as uv, without repurposing HOME or CODEX_HOME
    • the expected escalation path after a required command fails because DNS or network access is sandbox-blocked
    • the expected escalation path for prescribed Docker checks that need the host Docker socket
    • how to distinguish a sandbox failure from a test or lint finding in progress reports and verification evidence
    • reusable, safely scoped approval prefixes where appropriate

    Acceptance should include a Codex session completing the standard Python and Docker-backed validation commands from a restricted workspace-write sandbox without rediscovering these workarounds per task.

  2. ptr727 commented on Aug 18, 2026

    @ptr727
    OwnerAuthor

    Two more repeatable sandbox/validation failures surfaced at the end of issue #800:

    1. uvx ruff created an ignored .ruff_cache in the worktree. The subsequent repository-wide editorconfig-checker container scanned that ignored cache and failed its generated files for line endings. A clean CI checkout avoids the cache, but the prescribed local sequence creates its own false failure and forces manual cleanup. Make the validation path exclude tool caches such as .ruff_cache, either in editorconfig-checker configuration or by directing ruff cache output to a task-specific temporary location outside the checked tree. The normal lint sequence should not need destructive cleanup between tools.

    2. A worktree under /tmp was writable, but git add still failed because the linked worktree index lives at <primary>/.git/worktrees/<name>/index.lock, and the sandbox exposed that administrative path read-only. Sandbox-aware worktree guidance must account for both the worktree files and its Git administrative directory. A fallback is incomplete if edits work but staging cannot update the index.

    Additional acceptance criteria:

    • Running ruff followed by editorconfig-checker in a non-clean local checkout does not inspect or fail on .ruff_cache.
    • The prescribed cache strategy leaves no generated tool cache inside the repository tree, or the relevant repository-wide gates explicitly ignore it.
    • A Codex-created fallback worktree supports both file edits and Git index operations such as explicit-path staging.
    • The guidance states when Git worktree metadata requires scoped escalation even though the worktree path itself is writable.
  3. added
    agents
    on Aug 18, 2026
  4. added a commit that references this issue on Aug 18, 2026
    ddb2669
  5. ptr727 commented on Aug 18, 2026

    @ptr727
    OwnerAuthor

    Resolved by squash commit ddb2669 from PR #803. The commit was verified on origin/develop before closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agents

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions