Commit 02d71c3
authored
fix(cli): exclude GITHUB_API_URL when api-proxy is enabled (#1303)
* Initial plan
* fix(cli): exclude GITHUB_API_URL when api-proxy is enabled
On GHES, workflows set GITHUB_API_URL to the GHES API endpoint (e.g.,
https://api.ghes-host). When api-proxy is enabled, this variable should
NOT be passed to the agent container, because Copilot CLI would use it
for Copilot API requests, which don't exist on GHES API.
Instead, the agent should use COPILOT_API_URL pointing to the proxy,
which correctly routes Copilot API requests to api.enterprise.githubcopilot.com
(not the GHES API which lacks Copilot endpoints).
This fix ensures:
- GITHUB_API_URL is excluded from agent env when --enable-api-proxy is set
- COPILOT_API_URL takes precedence for Copilot API routing
- The API proxy's deriveCopilotApiTarget() correctly determines the endpoint
Fixes: github/gh-aw#20875
---------
Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>1 parent 8cd7451 commit 02d71c3
2 files changed
Lines changed: 57 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
487 | 493 | | |
488 | 494 | | |
489 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
253 | 303 | | |
0 commit comments