Repository navigation
[WIP] Fix cleanup and isolation for self-hosted job runtimes - #75444
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…egressions Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Review summary
No actionable correctness, security, performance, or maintainability issues were identified in the changed lines during the manual review. The specialist pass was unavailable because its file-access call was denied by workflow permissions; this is not treated as evidence of a clean specialist review.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
What this change does: It removes broad sudo sweeps of legacy AWF chroots and gives each installer a private staging directory with identity-checked cleanup. It also adds a large JavaScript regression suite for concurrency, interruption, rootless setup, and Docker-written leftovers.
Should fix:
-
The staging allocator reimplements
mktemp(actions/setup/sh/release_integrity.sh:L37-L64)- What this is: The shared helper generates random bytes, validates them, and retries directory creation five times.
- Problem:
mktemp -dalready atomically creates a private unique directory, and the repository already uses it for installer staging. The custom allocator adds code and a portability/test surface without changing the identity snapshot or cleanup requirement. - Fix: Keep parent canonicalization, identity recording, and traps, but replace the nonce and retry block with
mktemp -d "${parent}/${prefix}-install-XXXXXX". - If we skip it: Both installers carry a hand-rolled allocator that must be maintained around behavior the platform already provides.
-
The Docker regression is never exercised by repository CI (
actions/setup/js/release_staging.test.cjs:L452-L531)- What this is: This is an 80-line Docker fixture for root-owned leftovers, plus a cleanup helper and two helper-only tests.
- Problem: No workflow or Make target sets
GH_AW_TEST_DOCKER_IMAGE, soskipIfskips this code in every repository CI run while adding a second cleanup framework and Docker-specific maintenance burden. - Fix: Remove this optional block and its private cleanup helper until a real CI job can execute it, or wire it into one such job before keeping it.
- If we skip it: The largest specialized part of the staging test can drift while every normal run remains green.
Not checked: live Docker execution; the repository does not configure the image variable.
Verdict: fix 1 and 2 first.
Lean: -170 lines possible.
Generated by ✂️ Ponytail Reviewer for #75444 · codex · routed: gpt56 max · ~7 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. Requesting changes because the shared-/tmp cleanup this PR targets is still partly sudo-based.
📋 Key Themes & Highlights
Key Themes
- Incomplete isolation fix:
actions/setup/post.js:109andactions/setup/clean.sh:35still runsudo rm -rf /tmp/gh-aw. That can delete state belonging to another runner sharing the host, which contradicts the goal of scoping teardown without sudo. The matching checklist item in the PR body is still unchecked, so this is expected for WIP, but it blocks merge. - Test coverage is weaker than it looks:
chroot_home_cleanup.test.jschecks source text, not behavior. The root-skipped and Docker-gated cases inrelease_staging.test.cjsmay not run in CI. - Unverified edge paths: the BSD
stat -ffallback, EXIT trap ordering, and the rootless hard-fail behavior change have no direct regression test.
Positive Highlights
- ✅
create_release_stagingallocates a0700private directory and checks device:inode:uid before cleanup. It refuses to remove a replaced directory. - ✅ The concurrency, symlink-replacement, interruption, and fake-sudo tests cover the real failure modes well.
- ✅
bash -nand shellcheck pass on all four changed shell scripts.
Not verified in this review
- I did not run the vitest or Go suites. Vitest discovery for
actions/setup/js/*.cjsand whether CI setsGH_AW_TEST_DOCKER_IMAGEare unconfirmed.
@copilot please address the review comments above, starting with the remaining sudo rm -rf on /tmp/gh-aw.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~14 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
The change regresses temporary-directory fallback and leaves AWF chroots without scoped cleanup, while macOS test defects and missing Docker CI coverage leave key behavior insufficiently validated.
5 open issues
What changed in this PR
This PR begins addressing #75441 by isolating installer staging and removing cross-job AWF chroot cleanup from gh-aw’s setup action.
Changes:
- Add private installer staging with collision-resistant names, ownership checks, and scoped cleanup.
- Remove shared
/tmpchroot sweeps and recursive Copilot ownership changes in rootless mode. - Add concurrency, interruption, path-portability, and optional Docker ownership regressions.
| File | Description |
|---|---|
pkg/cli/install_copilot_cli_test.go |
Prepare temporary directories and assert rootless installation avoids chown. |
pkg/cli/install_copilot_cli_cooldown_test.go |
Update prerequisites and temporary-directory fixtures. |
actions/setup/sh/release_integrity.sh |
Add private staging allocation and ownership-checked cleanup. |
actions/setup/sh/release_integrity_test.sh |
Create the runner temporary-directory fixture. |
actions/setup/sh/install_copilot_cli.sh |
Adopt private staging, remove chroot sweeps, and adjust rootless preflight. |
actions/setup/sh/install_awf_binary.sh |
Adopt private staging and remove shared chroot cleanup. |
actions/setup/post.js |
Replace broad chroot cleanup with a warning. |
actions/setup/js/release_staging.test.cjs |
Add staging lifecycle, concurrency, portability, and optional Docker tests. |
actions/setup/js/chroot_home_cleanup.test.js |
Replace sweep tests with source checks enforcing cleanup boundaries. |
actions/setup/clean.sh |
Replace script-mode chroot sweeps with a warning. |
Review effort: Max (auto)
| path.join(bin, "stat"), | ||
| `#!/bin/sh | ||
| if [ "$1" = "-c" ]; then exit 1; fi | ||
| exec "$REAL_STAT" -c "$2" "$3" |
| expect(fs.existsSync(job.dir)).toBe(false); | ||
| }); | ||
|
|
||
| it.skipIf(!dockerImage || !process.getuid || process.getuid() === 0)( |
| # Other invocations can share both /tmp and the runner UID. Neither a filename | ||
| # pattern nor the filesystem owner proves that a chroot belongs to this install. |
| echo "ERROR: Invalid release staging prefix" >&2 | ||
| return 1 | ||
| fi | ||
| parent="${RUNNER_TEMP:-$PWD}" |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Addressed the Actions-bot reviews in 9aebaac. Ponytail review 5805003897: replaced the custom allocator with mktemp and removed the Docker fixture that CI never exercised. Skills review 5805082164: removed shared /tmp/gh-aw sudo/recursive cleanup from both post steps, replaced source-string checks with behavior tests, added actual-installer EXIT cleanup tests, BSD snapshot coverage, and a root-independent preflight failure test. The existing unwritable-directory test also passes. All nine Actions threads have direct replies and are resolved. Code-quality review 5804965042 reported no actionable findings; its specialist-pass limitation remains acknowledged. The 20 focused JavaScript tests, Copilot installer Go tests, shell integrity/AWF suites, build, and change-scoped lint/drift checks pass. The with-tests gate initially lacked lint tooling; after restoring dependencies, its lint gate passed and the focused Go installer tests passed after updating the restricted PATH fixture for mktemp. The PR description records that legacy shared state is intentionally left untouched, live Docker-created ownership coverage is not established, and full runtime-path migration remains incomplete. This does not claim the new Copilot review findings are all addressed, or that the outstanding changes-requested review has been superseded. |
|
@copilot address all review feedback |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Addressed the outstanding review findings in |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |

Actions review follow-up
Installer staging uses native
mktemp -dunder the canonical runner scratch directory, with device/inode/UID-checked, unprivileged cleanup. Rootless Copilot installation now fails explicitly if~/.copilotis unusable or unwritable; it does not repair ownership or reclaim existing state. Concurrent installer and error-path regressions cover staging cleanup, and a non-root permissions test plus a root-independent invalid-directory test cover preflight failure.Legacy
/tmp/gh-awand AWF chroots lack trustworthy per-job ownership records. Both post-step implementations leave them untouched rather than using sudo or recursively deleting another runner's state. Hosts must manage these legacy leftovers outside active jobs; full runtime-path migration remains a separate unchecked item above. No unconditional AWF-chroot warning is emitted.The optional Docker fixture and its private cleanup framework were removed because no repository CI job configured its image. The retained unprivileged failure regression checks warning/exit behavior without claiming live Docker ownership coverage. BSD stat field-order fixtures and a real macOS stat regression cover ownership snapshots; actual installer failure tests verify the EXIT cleanup survives setup.