Commit 132609b
feat: add github copilot api proxy support (#945)
* Initial plan
* feat(api-proxy): add copilot api proxy support
- Add copilotApiKey to WrapperConfig type
- Update CLI to read COPILOT_API_KEY from environment
- Add GitHub Copilot proxy endpoint on port 10002 in api-proxy server
- Pass COPILOT_API_KEY to api-proxy container
- Set COPILOT_API_URL and COPILOT_TOKEN in agent container
- Exclude COPILOT_API_KEY from agent environment when api-proxy enabled
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* test(api-proxy): add copilot proxy integration tests
Add integration tests for GitHub Copilot API proxy:
- Health check endpoint test
- COPILOT_API_URL environment variable test
- COPILOT_TOKEN placeholder test
- Health providers reporting test
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* feat(examples): enable api-proxy and debug logging in copilot example
- Enable --enable-api-proxy flag to use Copilot API proxy
- Set AWF_ONE_SHOT_TOKEN_DEBUG=1 for debug output
- Add COPILOT_API_KEY environment variable check
- Update domain list to use api.githubcopilot.com (proxied)
- Add --log-level debug for verbose output
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* feat(workflows): enable copilot api-proxy in smoke test
- Add --enable-api-proxy flag to awf command
- Set COPILOT_API_KEY environment variable from secrets
- Set AWF_ONE_SHOT_TOKEN_DEBUG=1 for debug logging
- Update validation to check both COPILOT_GITHUB_TOKEN and COPILOT_API_KEY
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* fix(docker-manager): configure one-shot-token protection for sensitive tokens
Set AWF_ONE_SHOT_TOKENS to protect COPILOT_GITHUB_TOKEN and other sensitive tokens.
The C implementation of one-shot-token requires this env var to be configured
with the list of tokens to protect. Without it, tokens like COPILOT_GITHUB_TOKEN
were not being cached/protected and remained fully accessible in the agent.
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* fix(workflows): include api-proxy logs in smoke-copilot artifacts
- Add /tmp/gh-aw/sandbox/firewall/api-proxy-logs/ to artifact upload
- Fix permissions for api-proxy-logs directory before upload
- API proxy logs were being written to a sibling directory of firewall logs
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* fix(docker-manager): exclude copilot_github_token from agent when api-proxy enabled
COPILOT_GITHUB_TOKEN is now excluded from the agent environment when
--enable-api-proxy is used, ensuring no GitHub tokens are exposed to the
agent container. This follows the credential isolation pattern where sensitive
credentials are not passed to the agent when using the API proxy.
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* feat(agent): add copilot api proxy health check with url logging
Add health check for GitHub Copilot API proxy configuration that:
- Logs COPILOT_API_URL value at container startup
- Verifies COPILOT_API_KEY and COPILOT_GITHUB_TOKEN are excluded
- Validates COPILOT_TOKEN is placeholder value
- Tests connectivity to the proxy endpoint
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* feat(docker-manager): set copilot_github_token placeholder for one-shot protection
Instead of excluding COPILOT_GITHUB_TOKEN entirely, set it to a placeholder value
that gets protected by the one-shot-token library (already in hard-coded defaults).
Changes:
- Remove COPILOT_GITHUB_TOKEN from EXCLUDED_ENV_VARS
- Set COPILOT_GITHUB_TOKEN=placeholder-token-for-credential-isolation in agent
- Update health check to validate placeholder value (not absence)
- COPILOT_GITHUB_TOKEN is already in both C and Rust one-shot-token defaults
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* fix(docker-manager): set copilot_github_token placeholder before env-all
Move COPILOT_GITHUB_TOKEN placeholder initialization to before --env-all logic
to prevent the real token from overriding the placeholder value.
Changes:
- Set COPILOT_GITHUB_TOKEN placeholder early (right after environment init)
- Add copilot-pre-exec-check.sh script for pre-execution validation
- Run validation before Copilot CLI executes in smoke test
- Validates COPILOT_API_URL is set and COPILOT_GITHUB_TOKEN is placeholder
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* fix(workflows): remove copilot pre-exec check, rely on health check
Remove copilot-pre-exec-check.sh script and revert to simple execution pattern
that matches Claude/Codex workflows. The existing api-proxy-health-check.sh
already validates configuration at container startup.
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* fix(cli): add api proxy status logging for debugging
Add info-level logging to show which API keys are detected when api-proxy
is enabled. Update health check message to include COPILOT_API_URL. This
helps diagnose configuration issues when API keys aren't being read.
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* fix: replace copilot_api_key with copilot_github_token
Change implementation to use COPILOT_GITHUB_TOKEN directly instead of
a separate COPILOT_API_KEY. This aligns with how Copilot authentication
actually works - there's only one GitHub token, not two separate credentials.
Changes:
- Renamed copilotApiKey to copilotGithubToken in types
- CLI now reads COPILOT_GITHUB_TOKEN from environment
- API proxy reads COPILOT_GITHUB_TOKEN and uses it for Authorization header
- Removed COPILOT_API_KEY from excluded env vars (no longer used)
- Removed COPILOT_API_KEY from AWF_ONE_SHOT_TOKENS list
- Updated tests to use COPILOT_GITHUB_TOKEN
- Updated example script
- Updated workflow to only require COPILOT_GITHUB_TOKEN secret
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>1 parent 0956330 commit 132609b
8 files changed
Lines changed: 241 additions & 22 deletions
File tree
- .github/workflows
- containers
- agent
- api-proxy
- examples
- src
- tests/integration
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
94 | 137 | | |
95 | 138 | | |
96 | 139 | | |
| |||
99 | 142 | | |
100 | 143 | | |
101 | 144 | | |
102 | | - | |
| 145 | + | |
103 | 146 | | |
104 | 147 | | |
105 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
172 | | - | |
| 176 | + | |
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
| |||
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
196 | | - | |
| 200 | + | |
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
| |||
231 | 235 | | |
232 | 236 | | |
233 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
234 | 261 | | |
235 | 262 | | |
236 | 263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
25 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
27 | 38 | | |
28 | | - | |
29 | | - | |
| 39 | + | |
| 40 | + | |
30 | 41 | | |
| 42 | + | |
31 | 43 | | |
32 | 44 | | |
33 | | - | |
34 | 45 | | |
35 | 46 | | |
36 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
37 | 50 | | |
38 | 51 | | |
39 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
269 | 270 | | |
270 | | - | |
| 271 | + | |
| 272 | + | |
271 | 273 | | |
272 | 274 | | |
273 | 275 | | |
| |||
276 | 278 | | |
277 | 279 | | |
278 | 280 | | |
279 | | - | |
| 281 | + | |
280 | 282 | | |
281 | | - | |
| 283 | + | |
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
| |||
987 | 992 | | |
988 | 993 | | |
989 | 994 | | |
| 995 | + | |
990 | 996 | | |
991 | 997 | | |
992 | 998 | | |
| |||
1025 | 1031 | | |
1026 | 1032 | | |
1027 | 1033 | | |
1028 | | - | |
| 1034 | + | |
| 1035 | + | |
1029 | 1036 | | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
1030 | 1043 | | |
1031 | 1044 | | |
1032 | 1045 | | |
| |||
1038 | 1051 | | |
1039 | 1052 | | |
1040 | 1053 | | |
1041 | | - | |
| 1054 | + | |
1042 | 1055 | | |
1043 | 1056 | | |
1044 | 1057 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
337 | 338 | | |
338 | 339 | | |
339 | 340 | | |
| |||
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
349 | 353 | | |
350 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
351 | 362 | | |
352 | 363 | | |
353 | 364 | | |
| |||
421 | 432 | | |
422 | 433 | | |
423 | 434 | | |
| 435 | + | |
424 | 436 | | |
425 | 437 | | |
426 | 438 | | |
| |||
950 | 962 | | |
951 | 963 | | |
952 | 964 | | |
| 965 | + | |
953 | 966 | | |
954 | 967 | | |
955 | 968 | | |
| |||
1013 | 1026 | | |
1014 | 1027 | | |
1015 | 1028 | | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1016 | 1041 | | |
1017 | 1042 | | |
1018 | 1043 | | |
| |||
0 commit comments