Skip to content

fix: reclaim non-writable /tmp/gh-aw/sandbox before AWF writeConfigs() to prevent EACCES#42400

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/aw-failures-reclaim-rootless-sandbox
Open

fix: reclaim non-writable /tmp/gh-aw/sandbox before AWF writeConfigs() to prevent EACCES#42400
Copilot wants to merge 2 commits into
mainfrom
copilot/aw-failures-reclaim-rootless-sandbox

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Rootless containers on GitHub-hosted runners can leave /tmp/gh-aw/sandbox owned by root. AWF's writeConfigs() then dies with EACCES: mkdir /tmp/gh-aw/sandbox/firewall/logs before the agent is ever invoked — and the chmod -R a+rX fallback inside AWF fails for the same reason, making the error unrecoverable. This manifests as a per-runner ownership race: identical runs succeed or fail depending on whether a prior rootless job ran on the same runner.

Changes

  • create_gh_aw_tmp_dir.sh — added a pre-flight check before mkdir: if /tmp/gh-aw/sandbox exists but is not writable by the current user, remove it with sudo rm -rf (falling back to plain rm -rf) so the subsequent mkdir -p creates a fresh, uid-owned tree before AWF starts

    if [ -d "${sandbox_dir}" ] && ! [ -w "${sandbox_dir}" ]; then
      echo "[WARN] ... reclaiming before AWF starts..."
      sudo rm -rf "${sandbox_dir}" 2>/dev/null || rm -rf "${sandbox_dir}" 2>/dev/null || ...
    fi

    Uses [ -w ] rather than UID comparison — portable across Linux/macOS and directly tests the condition that causes EACCES.

  • create_gh_aw_tmp_dir_test.sh — new test covering: syntax validity, normal creation, user-owned sandbox preservation (no removal), and simulated non-writable sandbox reclaim (fake sudo records arguments and mimics root privilege).

…) to prevent EACCES

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix EACCES error in Smoke CI startup fix: reclaim non-writable /tmp/gh-aw/sandbox before AWF writeConfigs() to prevent EACCES Jun 30, 2026
Copilot AI requested a review from pelikhan June 30, 2026 02:45
@pelikhan pelikhan marked this pull request as ready for review June 30, 2026 03:41
Copilot AI review requested due to automatic review settings June 30, 2026 03:41

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

This PR hardens gh-aw’s runner setup by proactively reclaiming a stale, non-writable /tmp/gh-aw/sandbox (often left root-owned by prior rootless container jobs) so AWF writeConfigs() doesn’t fail early with EACCES during sandbox config/log directory creation.

Changes:

  • Add preflight detection and reclamation of /tmp/gh-aw/sandbox when it exists but is not writable, using sudo rm -rf with a fallback to rm -rf.
  • Add a shell test script validating normal creation, preservation of user-owned sandboxes, and simulated reclaim behavior.
  • Add a changeset documenting the patch release.
Show a summary per file
File Description
actions/setup/sh/create_gh_aw_tmp_dir.sh Adds sandbox reclamation logic prior to creating gh-aw temp directories.
actions/setup/sh/create_gh_aw_tmp_dir_test.sh Adds a dedicated test script to validate the new sandbox reclaim behavior.
.changeset/patch-reclaim-sandbox-rootless-eacces.md Documents the patch release rationale and behavior change.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment on lines 1 to +3
#!/usr/bin/env bash
set +o histexpand

Comment on lines +17 to +20
else
echo "[WARN] Failed to remove ${sandbox_dir}; AWF writeConfigs() may fail with EACCES" >&2
fi
fi
Comment on lines +12 to +14
TESTS_PASSED=0
TESTS_FAILED=0

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Design Decision Gate 🏗️ is checking for design decision records on this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Test Quality Sentinel is analyzing test quality on this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

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

Labels

None yet

Projects

None yet

3 participants