feat: portable GH_AW_HOME for self-hosted runner support#19744
feat: portable GH_AW_HOME for self-hosted runner support#19744
Conversation
Add OpenCode as a new agentic engine supporting provider-agnostic AI coding with BYOK (Bring Your Own Key) and full MCP Gateway + API proxy support. New engine features: - Provider-agnostic: supports Anthropic, OpenAI, Google, Groq, etc. - Dynamic domain allowlists based on model provider prefix - API proxy on port 10004 (default: Anthropic routing) - MCP Gateway integration with opencode.jsonc converter - Headless CI mode via `opencode run -q` - Auto-configured permissions to prevent CI hanging - 22 unit tests covering all engine methods - Smoke test workflow (5 tests) Files: opencode_engine.go, opencode_mcp.go, opencode_engine_test.go, convert_gateway_config_opencode.sh, smoke-opencode.md/.lock.yml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add comprehensive external-facing documentation for the OpenCode engine: - New guide: docs/src/content/docs/guides/opencode.md (460 lines) - Quick start, auth/providers, network security, MCP support - Example workflows, engine comparison, known limitations - Update engines.md: add OpenCode to available agents list - Update auth.mdx: add OpenCode authentication reference - Update network.md: add OpenCode domain config + dynamic provider docs - Update astro.config.mjs: add sidebar link Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix BaseEngine struct changes (llmGatewayPort field, remove supportsFirewall, remove UsesAPIProxy from AWFCommandConfig) - Bump DefaultFirewallVersion to v0.23.1 which includes port 10004 for OpenCode API proxy (gh-aw-firewall#1055) - Recompile smoke-opencode.lock.yml with v0.23.1 - Fix test: use constants.OpenCodeLLMGatewayPort assertion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
OpenCode v1.2.14 does not support -q/--quiet flag. The `run` subcommand accepts the message as a positional argument directly. Discovered from smoke test failure where the CLI printed usage and exited with code 1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
❌ Tool validation failed! Agent Container Smoke Test detected missing tools: failed |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
OpenCode phones home to opencode.ai during initialization (telemetry/ config). Without this domain in the allowlist, Squid blocks the request and OpenCode fails silently with exit code 0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…xpansion
Re-applies all GH_AW_HOME portable path changes that were silently reverted
during the merge with main. Also fixes a critical bug where job-level env
vars using shell expansion syntax were not expanded by GitHub Actions
${{ env.X }} expressions (used by upload-artifact).
Key fixes:
- Move GH_AW_SAFE_OUTPUTS/CONFIG_PATH/TOOLS_PATH from job-level env to
$GITHUB_ENV (set in "Create gh-aw temp directory" step after setup.sh
sets GH_AW_HOME)
- Re-apply JsRequireGhAw() for all require() patterns
- Re-apply GhAwHome shell expansion for all bash run: blocks
- Re-apply DefaultGhAwMount with shell expansion
- Update golden files and test expectations
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
192debf to
42c1f84
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot recompile, review code and simplify if possible (by compile resolved value and avoid repeating magic string) |
…constants (#19793) * Initial plan * Initial plan: use GhAwHome/GhAwHomeJS/JsRequireGhAw constants everywhere Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * refactor: replace magic GH_AW_HOME path strings with constants/helpers Replace all raw occurrences of `(process.env.GH_AW_HOME || '/opt/gh-aw')` and `${GH_AW_HOME:-/opt/gh-aw}` in non-test Go source files with the constants and helper defined in setup_action_paths.go: - `GhAwHomeJS` for JavaScript expressions - `GhAwHome` for shell expressions - `JsRequireGhAw(relativePath)` for JS require() calls 22 source files updated. Generated output is byte-for-byte identical. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot fix build wasm |
|
Hey @Mossaka 👋 — thanks for this ambitious PR! The work on self-hosted runner support ( That said, there are a couple of things to address before this is ready:
|
| PR | Scope |
|---|---|
| PR A | GH_AW_HOME portability — setup_action_paths.go, prompt_constants.go, shell/JS constants, recompiled lock files |
| PR B | OpenCode engine — opencode_engine.go, opencode_mcp.go, tests, domains.go allowlists, changeset |
If you'd like a hand splitting and validating this, you can assign the prompt below to your coding agent:
Split PR #19744 in the github/gh-aw repo into two focused PRs:
**PR A — GH_AW_HOME portability (self-hosted runner support)**
Cherry-pick only the changes related to replacing hardcoded /opt/gh-aw paths:
- pkg/workflow/setup_action_paths.go (GhAwHome / GhAwHomeJS constants)
- pkg/workflow/prompt_constants.go (promptsDir change)
- All .github/workflows/*.lock.yml files (path pattern updates)
- actions/setup/sh/*.sh scripts that export GH_AW_HOME
- Any GH_AW_HOME-related test changes
- Rerun `make recompile` to regenerate lock files from the updated source
**PR B — OpenCode engine integration**
Cherry-pick only the changes related to the new OpenCode engine:
- pkg/workflow/opencode_engine.go (new file)
- pkg/workflow/opencode_mcp.go (new file)
- pkg/workflow/opencode_engine_test.go (new file)
- pkg/workflow/domains.go (allowlist additions)
- pkg/workflow/agentic_engine.go (engine registration, if any)
- .changeset/patch-add-opencode-engine.md
- Any OpenCode-specific documentation under docs/src/
For each PR:
1. Create a new branch from main
2. Cherry-pick the relevant commits or selectively stage the files
3. Run `make agent-finish` to verify build, tests, lint, and recompile pass
4. Ensure the PR description includes a complete test plan with all items checked
5. For PR A, confirm backward-compat smoke test on a GitHub-hosted runner passes before marking ready
Generated by Contribution Check · ◷
|
@copilot merge main and recompile |
Summary
/opt/gh-aw/paths with aGH_AW_HOMEenvironment variable (defaults to/opt/gh-aw, falls back to$RUNNER_TEMP/gh-awon self-hosted runners)setup.shauto-detects a writable path and exportsGH_AW_HOMEto$GITHUB_ENVfor all subsequent steps${GH_AW_HOME:-/opt/gh-aw}/..., JSrequire()uses(process.env.GH_AW_HOME || '/opt/gh-aw') + '/...'Why: GitHub-hosted runners allow writing to
/opt/, but self-hosted runners typically don't — requiring admins tosudo mkdir -p /opt/gh-aw && sudo chmod 777 /opt/gh-aw. This change makes gh-aw work out of the box on both.Security:
$RUNNER_TEMP/gh-awis NOT mounted into the AWF agent container (only$GITHUB_WORKSPACEand/tmpare writable to the agent), so the security model is preserved.Test plan
make buildsucceedsmake test-unit— all tests pass (updated 36 test files + 3 golden fixtures)make test-js— all 209 JS test files pass (4928 tests)make golint-incremental BASE_REF=HEAD— 0 issuesmake recompile— all 165 lock files regenerated.lock.ymlfiles use$GH_AW_HOMEpatterns correctly/opt/gh-awstill works)🤖 Generated with Claude Code