Problem
The AWF api-proxy sidecar (containers/api-proxy/) does not have a handler for the OpenCode engine. The OpenCode port (10004) is referenced in AGENTS.md as already supported, but the integration described in the original PR needs to be fully implemented or verified in the firewall repo.
Context
Original report: github/gh-aw#25830
The OpenCode engine integration PR (#18403) needs to be applied to current HEAD. OpenCode is a provider-agnostic AI coding agent supporting 75+ models. Key requirements for the AWF firewall:
- API proxy on port 10004 (already documented in
AGENTS.md as OpenCodeLLMGatewayPort = 10004)
- Dynamic domain allowlists based on model provider prefix (
copilot/, anthropic/, openai/, google/, groq/, etc.)
- Credential protection:
umask 077 + chmod 600 for opencode.jsonc config file
OPENAI_API_KEY sourced from Copilot token for OpenAI-compatible API access
Root Cause
The containers/api-proxy/server.js file has handlers for OpenAI (10000), Anthropic (10001), Copilot (10002) but the OpenCode handler on port 10004 needs to implement the dynamic provider routing described in resolveOpenCodeRoute() (already present per stored memory at containers/api-proxy/server.js:291-316). The integration with the AWF CLI (src/docker-manager.ts) needs to:
- Expose port 10004 in the api-proxy container config
- Set
OPENCODE_API_BASE_URL or equivalent env var in the agent container
- Add OpenCode-specific domain allowlists to Squid config generation (
src/squid-config.ts)
Proposed Solution
- Verify/complete
resolveOpenCodeRoute() in containers/api-proxy/server.js: Confirm the dynamic routing logic handles all provider prefixes (copilot/, anthropic/, openai/, google/, groq/) and routes through the correct upstream with proper auth injection.
- Expose port 10004 in
src/docker-manager.ts: In generateDockerCompose(), ensure the api-proxy service exposes port 10004 when --enable-api-proxy is active.
- Add OpenCode env vars in
src/docker-manager.ts: Set OPENCODE_ANTHROPIC_API_BASE_URL, OPENCODE_OPENAI_API_BASE_URL etc. to `(172.30.0.30/redacted) in the agent container environment.
- Dynamic domain allowlists in
src/squid-config.ts: Add getDefaultDomainsForEngine() support for OpenCode that includes provider-specific domains based on OPENCODE_MODEL prefix.
- Add
.opencode/ to whitelisted home subdirs in src/docker-manager.ts agent volume config.
- Write
opencode.jsonc with umask 077 in the agent entrypoint or via a pre-run script to set all permissions to allow and prevent CI hanging.
Generated by Firewall Issue Dispatcher · ● 2.1M · ◷
Problem
The AWF api-proxy sidecar (
containers/api-proxy/) does not have a handler for the OpenCode engine. The OpenCode port (10004) is referenced inAGENTS.mdas already supported, but the integration described in the original PR needs to be fully implemented or verified in the firewall repo.Context
Original report: github/gh-aw#25830
The OpenCode engine integration PR (#18403) needs to be applied to current HEAD. OpenCode is a provider-agnostic AI coding agent supporting 75+ models. Key requirements for the AWF firewall:
AGENTS.mdasOpenCodeLLMGatewayPort = 10004)copilot/,anthropic/,openai/,google/,groq/, etc.)umask 077+chmod 600foropencode.jsoncconfig fileOPENAI_API_KEYsourced from Copilot token for OpenAI-compatible API accessRoot Cause
The
containers/api-proxy/server.jsfile has handlers for OpenAI (10000), Anthropic (10001), Copilot (10002) but the OpenCode handler on port 10004 needs to implement the dynamic provider routing described inresolveOpenCodeRoute()(already present per stored memory atcontainers/api-proxy/server.js:291-316). The integration with the AWF CLI (src/docker-manager.ts) needs to:OPENCODE_API_BASE_URLor equivalent env var in the agent containersrc/squid-config.ts)Proposed Solution
resolveOpenCodeRoute()incontainers/api-proxy/server.js: Confirm the dynamic routing logic handles all provider prefixes (copilot/,anthropic/,openai/,google/,groq/) and routes through the correct upstream with proper auth injection.src/docker-manager.ts: IngenerateDockerCompose(), ensure the api-proxy service exposes port 10004 when--enable-api-proxyis active.src/docker-manager.ts: SetOPENCODE_ANTHROPIC_API_BASE_URL,OPENCODE_OPENAI_API_BASE_URLetc. to `(172.30.0.30/redacted) in the agent container environment.src/squid-config.ts: AddgetDefaultDomainsForEngine()support for OpenCode that includes provider-specific domains based onOPENCODE_MODELprefix..opencode/to whitelisted home subdirs insrc/docker-manager.tsagent volume config.opencode.jsoncwithumask 077in the agent entrypoint or via a pre-run script to set all permissions toallowand prevent CI hanging.