Skip to content

Commit 1f1dcf5

Browse files
authored
fix: tighten copilot executable detection for node preflight
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/345ed70b-1477-4fae-bb25-801df1d3fab2
1 parent bc38419 commit 1f1dcf5

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

containers/agent/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,8 @@ AWFEOF
711711
if ! command -v node >/dev/null 2>&1; then
712712
echo "[entrypoint][ERROR] Copilot CLI requires Node.js, but 'node' is not available inside AWF chroot."
713713
echo "[entrypoint][ERROR] Ensure Node.js is installed on the runner and reachable from PATH inside the chroot."
714-
echo "[entrypoint][ERROR] Common locations: /opt/hostedtoolcache/... or $HOME/.nvm/... (bind-mounted by AWF)."
715-
echo "[entrypoint][ERROR] Verify $HOME/.nvm exists on the host and contains an installed Node.js version."
714+
echo "[entrypoint][ERROR] If using setup-node or nvm, verify the install path is present and bind-mounted into /host."
715+
echo "[entrypoint][ERROR] Example locations include /opt/hostedtoolcache/... and $HOME/.nvm/..."
716716
exit 127
717717
fi
718718
AWFEOF

src/docker-manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,8 @@ export function generateDockerCompose(
818818
// Copilot CLI requires Node.js. Ask the agent entrypoint to fail fast with a
819819
// clear diagnostic if node is not reachable inside the chroot before startup.
820820
const commandExecutable = config.agentCommand.trim().split(/\s+/, 1)[0] || '';
821-
const isCopilotCommand = /(^|\/)copilot$/i.test(commandExecutable);
821+
const commandExecutableBase = path.posix.basename(commandExecutable.replace(/\\/g, '/'));
822+
const isCopilotCommand = commandExecutableBase.toLowerCase() === 'copilot';
822823
if (config.copilotGithubToken || config.copilotApiKey || isCopilotCommand) {
823824
environment.AWF_REQUIRE_NODE = '1';
824825
}

0 commit comments

Comments
 (0)