Problem
When AWF is invoked with --env-all and the assembled prompt is large (100–200+ KB, from many imported skill/reference files), the agent container's execve call is rejected by the Linux kernel with E2BIG ("Argument list too long", exit code 126). The Copilot CLI never launches.
/bin/bash: line 1: /usr/local/bin/node: Argument list too long
Context
Original report: github/gh-aw#26045
Two factors combine to exceed ARG_MAX (~2 MB):
- The entire assembled prompt is passed as a single
argv element via --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)" (shell expansion inlines hundreds of KB into argv).
--env-all forwards the full GitHub Actions runner environment (~1.5–2 MB of envp).
Root Cause
In containers/agent/entrypoint.sh, the user command is executed directly via exec, which passes the expanded prompt as an argv element. Combined with --env-all forwarding hundreds of GITHUB_* env vars, the combined argv + envp size exceeds the kernel ARG_MAX limit.
The same pattern was already fixed for threat detection (passing via file instead of inline arg), but the agent entrypoint itself doesn't apply this mitigation.
Proposed Solution
- Pass prompt via file reference instead of inline arg: In
containers/agent/entrypoint.sh, detect when --prompt arg length exceeds a threshold (e.g., 64 KB) and write to a temp file, then replace the arg with --prompt-file /tmp/awf-prompt.txt (if the CLI supports it) — or have AWF write the prompt to a volume-mounted file and pass the path.
- In
src/docker-manager.ts: When generating the agent command, detect large prompts and write them to a file in workDir (which is bind-mounted into the container), passing --prompt-file instead of inline --prompt.
- Filter redundant env vars with
--env-all: In src/docker-manager.ts buildAgentEnv() (around line 620), strip low-value high-volume env vars (e.g., RUNNER_*, ACTIONS_CACHE_URL, matrix variables) that contribute to envp size without benefit to the agent.
Generated by Firewall Issue Dispatcher · ● 2.1M · ◷
Problem
When AWF is invoked with
--env-alland the assembled prompt is large (100–200+ KB, from many imported skill/reference files), the agent container'sexecvecall is rejected by the Linux kernel withE2BIG("Argument list too long", exit code 126). The Copilot CLI never launches.Context
Original report: github/gh-aw#26045
Two factors combine to exceed
ARG_MAX(~2 MB):argvelement via--prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"(shell expansion inlines hundreds of KB intoargv).--env-allforwards the full GitHub Actions runner environment (~1.5–2 MB ofenvp).Root Cause
In
containers/agent/entrypoint.sh, the user command is executed directly viaexec, which passes the expanded prompt as anargvelement. Combined with--env-allforwarding hundreds ofGITHUB_*env vars, the combinedargv + envpsize exceeds the kernelARG_MAXlimit.The same pattern was already fixed for threat detection (passing via file instead of inline arg), but the agent entrypoint itself doesn't apply this mitigation.
Proposed Solution
containers/agent/entrypoint.sh, detect when--promptarg length exceeds a threshold (e.g., 64 KB) and write to a temp file, then replace the arg with--prompt-file /tmp/awf-prompt.txt(if the CLI supports it) — or have AWF write the prompt to a volume-mounted file and pass the path.src/docker-manager.ts: When generating the agent command, detect large prompts and write them to a file inworkDir(which is bind-mounted into the container), passing--prompt-fileinstead of inline--prompt.--env-all: Insrc/docker-manager.tsbuildAgentEnv()(around line 620), strip low-value high-volume env vars (e.g.,RUNNER_*,ACTIONS_CACHE_URL, matrix variables) that contribute toenvpsize without benefit to the agent.