fix: correctly recover runner tool on PATH (after sudo w/ secure_path). remove incorrect reading from GITHUB_PATH#5144
Draft
zarenner wants to merge 5 commits into
Draft
fix: correctly recover runner tool on PATH (after sudo w/ secure_path). remove incorrect reading from GITHUB_PATH#5144zarenner wants to merge 5 commits into
zarenner wants to merge 5 commits into
Conversation
Contributor
Contributor
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 97.30% | 97.29% | ➡️ -0.01% |
| Statements | 97.16% | 97.11% | 📉 -0.05% |
| Functions | 98.84% | 98.84% | ➡️ +0.00% |
| Branches | 91.92% | 91.88% | 📉 -0.04% |
📁 Per-file Coverage Changes (2 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/services/agent-environment/host-path-recovery.ts |
100.0% → 93.0% (-6.98%) | 100.0% → 88.9% (-11.12%) |
src/workdir-setup.ts |
92.7% → 94.5% (+1.82%) | 92.7% → 94.5% (+1.82%) |
Coverage comparison generated by scripts/ci/compare-coverage.ts
Contributor
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
zarenner
commented
Jun 17, 2026
Collaborator
Author
There was a problem hiding this comment.
this was wrong - GITHUB_PATH is meant to be written to (to then have the runner automatically add it to PATH in subsequent steps). It is not meant to be read from, and will be empty again on each new step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recover runner
toolcachebin directories into the chrootPATHused by the agent container when AWF runs undersudoor when the runner tool cache contains needed binaries. This avoids preflight failures (e.g., missingnode) caused bysudosanitizingPATHon self-hosted/DinD runners.Root cause
When
sudois used inside some self-hosted runner environments,secure_pathin/etc/sudoersmay remove the runner's tool-cachebindirectories fromPATH. AWF's previous attempt to read per-stepGITHUB_PATHwas incorrect (it's per-step and cannot reliably recover prior step changes), which led to brittle behavior and confusing documentation.What this change does
RUNNER_TOOL_CACHEbin directories and merges them ahead of the existingPATHintoAWF_HOST_PATHso chrooted agent processes can find tool binaries.GITHUB_PATHfor PATH recovery.GITHUB_ENVwhen AWF is running undersudo(unchanged behavior, but clarified).RUNNER_TOOL_CACHEdiscovery.Testing
toolcache/*/<version>/<arch>/bindirectoriesRUNNER_TOOL_CACHEis not setRUNNER_TOOL_CACHEpoints to non-directories or contains non-directory entriesGITHUB_ENVwhen running as root withSUDO_UIDsetnpm test -- --coverage— all tests passed.Risk and rollout
Low-risk. Changes are localized to host-path recovery logic and tests. If a regression is seen, revert the commit that modifies
src/services/agent-environment/host-path-recovery.ts.Notes for reviewers
discoverRunnerToolCacheBinDirslogic and the test cases that exercise non-directory entries and permission-safe reads.GITHUB_PATHmerging; see docs update in the branch for rationale.Related
GH_AW_NODE_BINwhen set.