fix: fix Pi agent models.json and AWF reflect URL configurations#30011
fix: fix Pi agent models.json and AWF reflect URL configurations#30011
Conversation
…ded URL Replace buildPiModelsJSON (which embedded a hardcoded http://host.docker.internal:PORT URL via base64) with buildPiModelsJSONSetup that generates models.json at runtime using printf and the GITHUB_COPILOT_BASE_URL (or equivalent) env var. Also set the base URL env var in the Pi step environment (alongside PI_CODING_AGENT_DIR) so the printf command can read the correct gateway URL inside the AWF container. Also fix pre-existing build error: missing WorkflowData arg in compiler_experiments.go generateSetupStep call. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7be7f469-08a4-4da4-a4c3-2bbfe7d18aca Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7be7f469-08a4-4da4-a4c3-2bbfe7d18aca Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Dev completed successfully! |
|
@copilot the configuration of the api-proxy provider extension is bogus. See this log entry [gh-aw/pi-provider] 2026-05-03T21:18:54.675Z awf-reflect: fetching http://api-proxy:10000/reflect (timeout=5000ms) but http://api-proxy is incorrect. See this log that states where the copilot base api url: [health-check] COPILOT_API_URL=http://172.30.0.30:10002 The /reflect must also be in that url (different port) Review sources at github/gh-aw-firewall to details |
Replace http://api-proxy:10000 with http://172.30.0.30:10000 in AWF_API_PROXY_REFLECT_URL. The api-proxy Docker service name does not resolve in all agent container contexts (notably Pi). The fixed IP 172.30.0.30 (AWFAPIProxyContainerIP) is always reachable. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/16318405-89a5-4591-bbfe-9bb6ce063dc1 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in db3f0a3 — changed |
|
✅ Dev completed successfully! |
|
@copilot review how the other harness connect to /reflect and fix pi extension See [gh-aw/pi-provider] 2026-05-03T21:44:36.171Z awf-reflect: fetching http://172.30.0.30:10000/reflect (timeout=5000ms) it is failings Also search for api-proxy references in the in extensions and fix |
The pi_provider.cjs extension was calling fetchAWFReflect at agent_start
(very early, before any LLM turns). Copilot and Claude harnesses call it
AFTER the agent subprocess exits. Moving to process.once('beforeExit')
matches that pattern: Pi finishes all turns, the event loop drains, the
async fetch runs while the AWF container is still alive, then Pi exits.
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/377ac46f-2514-4541-9074-1cfea3ef5054
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in d2e174a. Two changes:
|
|
✅ Dev completed successfully! |
Fixes three issues in the Pi agent configuration that prevented Pi CLI from connecting to the LLM gateway inside the AWF container and from successfully fetching the AWF
/reflectendpoint.Root Causes
models.json base URL hardcoded at compile time:
buildPiModelsJSONembeddedhttp://host.docker.internal:PORTvia base64 encoding. Inside the AWF container, the correct gateway URL must come from the base URL env var configured at runtime.AWF reflect URL used unresolvable hostname:
AWF_API_PROXY_REFLECT_URLusedhttp://api-proxy:10000/reflect, but theapi-proxyDocker service name does not resolve in the Pi container context. The correct URL uses the fixed container IP172.30.0.30(AWFAPIProxyContainerIP).AWF reflect fetched too early:
pi_provider.cjscalledfetchAWFReflectatagent_start— before the api-proxy management endpoint is ready to serve a complete/reflectresponse. The copilot and claude harnesses call it after the agent subprocess exits. Calling it atprocess.once('beforeExit')matches that timing: Pi finishes all turns, the event loop drains, the fetch runs while the AWF container is still alive, then Pi exits.Changes
pkg/workflow/pi_engine.go: ReplacebuildPiModelsJSON(hardcoded base64 URL) withbuildPiModelsJSONSetupthat generatesmodels.jsonat runtime usingprintfand shell variable expansion from the backend-specific base URL env var. Also sets the env var (GITHUB_COPILOT_BASE_URL/ANTHROPIC_BASE_URL/OPENAI_BASE_URL) in the Pi step environment when firewall is enabled. Usesjson.Marshalwith a typed struct for injection-safe JSON generation.pkg/workflow/pi_engine_test.go: Add tests forbuildPiModelsJSONSetupand the firewall execution path.pkg/workflow/compiler_experiments.go: Fix pre-existing build error (missingWorkflowDataarg ingenerateSetupStepcall).actions/setup/js/awf_reflect.cjs: ChangeAWF_API_PROXY_REFLECT_URLfromhttp://api-proxy:10000/reflecttohttp://172.30.0.30:10000/reflect. The fixed container IP (AWFAPIProxyContainerIP) is always reachable from all agent container contexts; the management port (10000) is the same host asCOPILOT_API_URL=http://172.30.0.30:10002but on a different port.actions/setup/js/awf_reflect.test.cjs: Update constant expectation to match new URL.actions/setup/js/pi_provider.cjs: MovefetchAWFReflectfrom theagent_starthandler (too early) toprocess.once('beforeExit'). This fires after Pi finishes all agent turns and the event loop drains — while the AWF container is still running — matching the lifecycle point at whichcopilot_harness.cjsandclaude_harness.cjscall/reflect.Lock files: Recompiled — now shows
printf '...' "${GITHUB_COPILOT_BASE_URL}"+GITHUB_COPILOT_BASE_URL: http://host.docker.internal:10002in step env instead ofecho BASE64 | base64 -d.Before / After (models.json generation)
Before:
(hardcoded URL embedded in base64)
After:
(URL read from env var at runtime, env var set to
http://host.docker.internal:10002)Before / After (AWF reflect URL)
Before:
http://api-proxy:10000/reflect— hostname does not resolve in Pi containerAfter:
http://172.30.0.30:10000/reflect— fixed container IP, always reachableBefore / After (AWF reflect timing in Pi extension)
Before: Called at
agent_start— too early, api-proxy management endpoint not yet readyAfter: Called at
process.once('beforeExit')— after all agent turns complete, matchingcopilot_harness.cjs/claude_harness.cjspattern