Skip to content

Commit bc38419

Browse files
authored
fix: avoid broad copilot matching in node preflight gate
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/345ed70b-1477-4fae-bb25-801df1d3fab2
1 parent 91a2953 commit bc38419

2 files changed

Lines changed: 5 additions & 7 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] 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."
716716
exit 127
717717
fi
718718
AWFEOF

src/docker-manager.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,9 @@ export function generateDockerCompose(
817817

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.
820-
if (
821-
config.copilotGithubToken
822-
|| config.copilotApiKey
823-
|| /\bcopilot\b/i.test(config.agentCommand)
824-
) {
820+
const commandExecutable = config.agentCommand.trim().split(/\s+/, 1)[0] || '';
821+
const isCopilotCommand = /(^|\/)copilot$/i.test(commandExecutable);
822+
if (config.copilotGithubToken || config.copilotApiKey || isCopilotCommand) {
825823
environment.AWF_REQUIRE_NODE = '1';
826824
}
827825

0 commit comments

Comments
 (0)