Problem
Copilot CLI 1.0.21 introduced a startup model validation step: when COPILOT_MODEL is set, the CLI calls GET /models before executing. This endpoint rejects classic PATs (ghp_*), causing the workflow to fail with exit code 1 immediately on startup.
Workflows that do not set COPILOT_MODEL are unaffected (default model path skips validation).
Context
Root Cause
In src/docker-manager.ts, COPILOT_MODEL is not in EXCLUDED_ENV_VARS and passes freely through --env-all. When the api-proxy is enabled, COPILOT_GITHUB_TOKEN is replaced with a placeholder for credential isolation (line 651), and the real token is forwarded via the api-proxy sidecar. However, the /models endpoint validation by Copilot CLI 1.0.21 is hit before any proxy interception — it uses whichever COPILOT_GITHUB_TOKEN value is present in the agent environment at startup.
Additionally, the containers/api-proxy/server.js does not proxy the /models endpoint, so even with the api-proxy active, the model validation call may escape to the raw GitHub API using the placeholder token.
Proposed Solution
-
Short-term: In src/docker-manager.ts, when --enable-api-proxy is active, add /models to the api-proxy routing table in containers/api-proxy/server.js (Copilot listener, port 10002) so model validation calls are handled by the sidecar with a valid token.
-
Medium-term: Add a warning in AWF CLI (src/cli.ts) when COPILOT_MODEL is set and the token is a classic PAT — advise upgrading to a fine-grained token or OAuth token.
-
Documentation: Update docs/environment.md to note that COPILOT_MODEL requires a non-classic-PAT token when using Copilot CLI ≥ 1.0.21.
Generated by Firewall Issue Dispatcher · ● 1.6M · ◷
Problem
Copilot CLI 1.0.21 introduced a startup model validation step: when
COPILOT_MODELis set, the CLI callsGET /modelsbefore executing. This endpoint rejects classic PATs (ghp_*), causing the workflow to fail with exit code 1 immediately on startup.Workflows that do not set
COPILOT_MODELare unaffected (default model path skips validation).Context
COPILOT_MODELis set gh-aw#25593ghp_*) used asCOPILOT_GITHUB_TOKENRoot Cause
In
src/docker-manager.ts,COPILOT_MODELis not inEXCLUDED_ENV_VARSand passes freely through--env-all. When the api-proxy is enabled,COPILOT_GITHUB_TOKENis replaced with a placeholder for credential isolation (line 651), and the real token is forwarded via the api-proxy sidecar. However, the/modelsendpoint validation by Copilot CLI 1.0.21 is hit before any proxy interception — it uses whicheverCOPILOT_GITHUB_TOKENvalue is present in the agent environment at startup.Additionally, the
containers/api-proxy/server.jsdoes not proxy the/modelsendpoint, so even with the api-proxy active, the model validation call may escape to the raw GitHub API using the placeholder token.Proposed Solution
Short-term: In
src/docker-manager.ts, when--enable-api-proxyis active, add/modelsto the api-proxy routing table incontainers/api-proxy/server.js(Copilot listener, port 10002) so model validation calls are handled by the sidecar with a valid token.Medium-term: Add a warning in AWF CLI (
src/cli.ts) whenCOPILOT_MODELis set and the token is a classic PAT — advise upgrading to a fine-grained token or OAuth token.Documentation: Update
docs/environment.mdto note thatCOPILOT_MODELrequires a non-classic-PAT token when using Copilot CLI ≥ 1.0.21.