Skip to content

Make Agent Workflows Sandbox-Aware - #803

Merged
ptr727 merged 5 commits into
developfrom
feature/801-sandbox-aware
Aug 18, 2026
Merged

ptr727 merged 5 commits into
developfrom
feature/801-sandbox-aware

Conversation

@ptr727

@ptr727 ptr727 commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • make task isolation account for both worktree files and linked Git metadata
  • use a standalone temporary clone when the standard fleet path is not writable
  • keep uv and ruff caches outside restricted checkouts
  • distinguish sandbox boundaries from validation findings and document scoped reruns
  • exclude generated Python caches from editorconfig-checker as defense in depth

Root Cause

Restricted executors can expose the checkout, home caches, network, Docker socket, and linked-worktree metadata with different permissions. The prior workflow considered only the visible worktree path. Local validation also let one tool create cache files that a later repository-wide tool inspected.

Validation

  • 697 Python unit tests and the coverage suite
  • ruff, mypy, repository gate, spec validation, and prose gates
  • generated skill distribution parity
  • editorconfig-checker after ruff with no repository-local Python caches
  • actionlint, markdownlint, cspell, shellcheck, and PSScriptAnalyzer
  • signed commit and explicit-path staging from the temporary standalone clone

Closes #801

Copilot AI lite review requested due to automatic review settings August 18, 2026 01:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates fleet operational guidance and skill distributions to behave correctly under restricted/sandboxed executors by (a) keeping tool caches out of the checkout, (b) clarifying how to interpret sandbox denials vs. lint failures, and (c) adding a repo-worktree standalone-clone fallback when linked-worktree Git metadata is not writable (Closes #801).

Changes:

  • Document per-task temporary cache directories for uv/ruff and how to treat sandbox denials as execution boundaries (not lint verdicts).
  • Extend repo-worktree guidance with a standalone-clone fallback for executors that cannot write linked-worktree Git metadata.
  • Add editorconfig-checker excludes for common generated Python cache directories.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
OPERATIONS.md Updates local verification runbook to use per-run temp caches and document sandbox-denial rerun procedure.
GOVERNANCE.md Adds governance guidance for cache placement and for reporting sandbox denials vs. lint results.
AGENTS.md Adds agent operating rules for cache placement and for reporting execution boundaries.
.github/skills/repo-worktree/SKILL.md Documents sandbox-aware worktree creation, including standalone-clone fallback and cleanup.
.github/skills/python-codestyle/SKILL.md Adds restricted-executor cache guidance for uv/ruff.
.editorconfig-checker.json Excludes generated Python cache directories from editorconfig-checker scans.
.claude-plugin/fleet-skills/skills/repo-worktree/SKILL.md Synced generated skill copy for repo-worktree.
.claude-plugin/fleet-skills/skills/python-codestyle/SKILL.md Synced generated skill copy for python-codestyle.
.claude-plugin/fleet-skills/.source-digest Updates generated skill distribution digest.
.agents/skills/repo-worktree/SKILL.md Synced generated skill copy for repo-worktree.
.agents/skills/python-codestyle/SKILL.md Synced generated skill copy for python-codestyle.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .editorconfig-checker.json Resolved
Comment thread .github/skills/repo-worktree/SKILL.md Resolved
Copilot AI review requested due to automatic review settings August 18, 2026 01:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (4)

OPERATIONS.md:13

  • The command block is marked as sh, but set -Eeuo pipefail is bash-specific (not POSIX sh) and will fail if someone runs the snippet under a strict /bin/sh (e.g., dash). Label this block as bash (or avoid pipefail) so the runbook is executable as written.
```sh
set -Eeuo pipefail

.github/skills/repo-worktree/SKILL.md:120

  • The standalone-clone example uses a <origin-url> placeholder without showing how to derive it from the current checkout. This makes the fallback path harder to follow and risks using a different transport/auth method than the base clone. Consider deriving the URL from the current repo’s origin remote and cloning from that.
```sh
git clone --no-checkout <origin-url> <temporary-root>/<Repo>-<task-slug>
git -C <temporary-root>/<Repo>-<task-slug> fetch origin develop
git -C <temporary-root>/<Repo>-<task-slug> switch -c <task-branch> origin/develop
**.agents/skills/repo-worktree/SKILL.md:120**
* The standalone-clone example uses a `<origin-url>` placeholder without showing how to derive it from the current checkout. This makes the fallback path harder to follow and risks using a different transport/auth method than the base clone. Consider deriving the URL from the current repo’s `origin` remote and cloning from that.
git clone --no-checkout <origin-url> <temporary-root>/<Repo>-<task-slug>
git -C <temporary-root>/<Repo>-<task-slug> fetch origin develop
git -C <temporary-root>/<Repo>-<task-slug> switch -c <task-branch> origin/develop
**.claude-plugin/fleet-skills/skills/repo-worktree/SKILL.md:120**
* The standalone-clone example uses a `<origin-url>` placeholder without showing how to derive it from the current checkout. This makes the fallback path harder to follow and risks using a different transport/auth method than the base clone. Consider deriving the URL from the current repo’s `origin` remote and cloning from that.
git clone --no-checkout <origin-url> <temporary-root>/<Repo>-<task-slug>
git -C <temporary-root>/<Repo>-<task-slug> fetch origin develop
git -C <temporary-root>/<Repo>-<task-slug> switch -c <task-branch> origin/develop
</details>

Copilot AI review requested due to automatic review settings August 18, 2026 01:47
@ptr727

ptr727 commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

Addressed all 4 suppressed findings from Copilot review round 2.

  1. OPERATIONS.md:13 - Fixed in f67aea0. The command block that uses set -Eeuo pipefail is labeled bash.
  2. .github/skills/repo-worktree/SKILL.md:120 - Fixed in f67aea0. The standalone-clone example derives TASK_ORIGIN from the base clone's configured origin URL.
  3. .agents/skills/repo-worktree/SKILL.md:120 - Fixed in f67aea0. The source skill derives the clone URL from the current base clone.
  4. .claude-plugin/fleet-skills/skills/repo-worktree/SKILL.md:120 - Fixed in f67aea0. Regeneration carries the same source fix into the Claude Code distribution.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (2)

OPERATIONS.md:17

  • Severity: medium — Clean up the temporary tool cache directory. This runbook creates a new mktemp directory on every verification run but never removes it; repeated runs can accumulate under $TMPDIR and eventually cause disk-pressure or confusion when debugging. Add an EXIT trap to remove the directory after the commands complete.
set -Eeuo pipefail
PROJECTTEMPLATE_TOOL_CACHE="$(mktemp -d "${TMPDIR:-/tmp}/projecttemplate-tools.XXXXXX")"
export UV_CACHE_DIR="$PROJECTTEMPLATE_TOOL_CACHE/uv"
export RUFF_CACHE_DIR="$PROJECTTEMPLATE_TOOL_CACHE/ruff"

.editorconfig-checker.json:7

  • Severity: medium — Exclude pycache as part of the generated Python cache defense-in-depth. The PR description says editorconfig-checker should ignore generated Python caches, but pycache/ is still included. In environments where editorconfig-checker falls back to filesystem walking (or doesn’t honor .gitignore), these directories can be scanned and produce false failures.
  "Exclude": [
    "(^|/)\\.mypy_cache/",
    "(^|/)\\.pytest_cache/",
    "(^|/)\\.ruff_cache/",
    "(^|/)\\.venv/"
  ],

Copilot AI review requested due to automatic review settings August 18, 2026 01:55
@ptr727

ptr727 commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

Addressed all 2 suppressed findings from Copilot review round 3.

  1. OPERATIONS.md:17 - Fixed in 34f5da7. The Bash verification block installs an EXIT trap that removes the exact cache directory returned by mktemp.
  2. .editorconfig-checker.json:7 - Fixed in 34f5da7. The generated-cache exclusions now include __pycache__ at the repository root or any depth.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (2)

OPERATIONS.md:18

  • The runbook sets UV_CACHE_DIR/RUFF_CACHE_DIR under a temp directory, but coverage will still write its data file (default .coverage) into the checkout unless redirected. That contradicts the new guidance about keeping tool state outside restricted checkouts and can still create untracked artifacts for later whole-tree tools.

Consider exporting COVERAGE_FILE into the same temp directory before the coverage runs.

export UV_CACHE_DIR="$PROJECTTEMPLATE_TOOL_CACHE/uv"
export RUFF_CACHE_DIR="$PROJECTTEMPLATE_TOOL_CACHE/ruff"

OPERATIONS.md:21

  • uvx mypy@latest will create .mypy_cache/ in the current working directory by default (no cache_dir is configured in pyproject.toml). If the goal is to keep generated tool state outside the checkout in restricted executors, pass an explicit mypy cache directory under PROJECTTEMPLATE_TOOL_CACHE.
export UV_CACHE_DIR="$PROJECTTEMPLATE_TOOL_CACHE/uv"
export RUFF_CACHE_DIR="$PROJECTTEMPLATE_TOOL_CACHE/ruff"
uvx ruff@latest check .
uvx ruff@latest format --check .
uvx mypy@latest

Copilot AI review requested due to automatic review settings August 18, 2026 02:03
@ptr727

ptr727 commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

Addressed all 2 suppressed findings from Copilot review round 4.

  1. OPERATIONS.md:18 - Fixed in 43fc4a4. COVERAGE_FILE points to the task-specific temporary tool directory before every coverage command.
  2. OPERATIONS.md:21 - Fixed in 43fc4a4. MYPY_CACHE_DIR points to the same temporary tool directory before mypy runs. The Python skill and generated distributions name both variables.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

@ptr727
ptr727 marked this pull request as ready for review August 18, 2026 02:08
@ptr727
ptr727 merged commit ddb2669 into develop Aug 18, 2026
8 checks passed
@ptr727
ptr727 deleted the feature/801-sandbox-aware branch August 18, 2026 02: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.

2 participants