fix: allow node preflight to use explicit binary#5145
Conversation
4af57c0 to
c9a2923
Compare
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR updates AWF’s agent chroot startup preflight for Copilot runs to recognize an explicitly-provided Node.js executable path (GH_AW_NODE_BIN) before falling back to PATH-based discovery, improving compatibility with runner environments where sudo/secure_path trims toolcache PATH entries.
Changes:
- Treat
GH_AW_NODE_BINas a valid Node presence signal when it is set and executable. - Preserve the existing
command -v nodefallback whenGH_AW_NODE_BINis unset or unusable. - Add
GH_AW_NODE_BINandPATHto the Node-missing error output for better diagnostics.
Show a summary per file
| File | Description |
|---|---|
| containers/agent/entrypoint.sh | Updates the chroot startup script’s Node preflight to honor GH_AW_NODE_BIN and improve Node-missing diagnostics. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
|
✅ Security Guard completed successfully! |
Security Review: Node Preflight ChangeThis PR modifies a security-critical file (
|
Summary
GH_AW_NODE_BINwhen it points to an executable.command -v nodefallback for normal PATH-based resolution.GH_AW_NODE_BINandPATHin the error output when Node cannot be found.Problem
Copilot workflows can run through AWF with Node installed by
actions/setup-nodein the runner tool cache. The generatedgh-awworkflow records the resolved Node executable before invoking AWF:The generated command later uses that value to run the Copilot harness inside the chroot.
However, AWF performs its own Node preflight before the generated command runs. That preflight only checked
command -v node, so it could fail whensudo secure_pathremoved the setup-node tool-cache directory fromPATH, even thoughGH_AW_NODE_BINalready pointed at the correct executable and the tool cache was mounted into the chroot.Fix
The preflight now first checks whether
GH_AW_NODE_BINis set and executable. If so, it accepts that as proof that Node is available. If not, it falls back to the existingcommand -v nodebehavior.This aligns AWF's early preflight with the Node executable the generated agent command would use.
Test
Not run; shell-only entrypoint change.