Skip to content

Fix: gh-aw binary unavailable in workspace for agentic-workflows custom steps#18940

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-gh-aw-binary-issue
Closed

Fix: gh-aw binary unavailable in workspace for agentic-workflows custom steps#18940
Copilot wants to merge 3 commits intomainfrom
copilot/fix-gh-aw-binary-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

In production mode, workflows using agentic-workflows with custom steps that call ./gh-aw would fail — the binary only existed in dev mode (built from source before custom steps) or after MCP setup (too late, after custom steps already ran).

Changes

  • generateGhAwWorkspaceBinaryStep — new function that extracts the gh-aw binary from the published release container (ghcr.io/github/gh-aw:<version>) using docker create/cp, placing it at ./gh-aw in the workspace before custom steps run
  • workflowHasGhAwImport — helper to skip early install when shared/mcp/gh-aw.md import already handles it
  • Early install step is only emitted when: non-dev mode + agentic-workflows tool configured + custom steps exist + no gh-aw import

Step ordering (production mode, before → after)

Create gh-aw temp directory
+ Install gh-aw CLI          ← new: pulls ghcr.io/github/gh-aw:<version>, extracts binary to ./gh-aw
  Download logs from last 30 days  ← ./gh-aw now available ✓
  ...
  Install gh-aw extension    ← existing MCP setup: copies to /opt/gh-aw/gh-aw for containerization

The generated step looks like:

- name: Install gh-aw CLI
  run: |
    docker pull ghcr.io/github/gh-aw:0.50.7
    CONTAINER=$(docker create ghcr.io/github/gh-aw:0.50.7)
    docker cp "${CONTAINER}:/usr/local/bin/gh-aw" ./gh-aw
    docker rm "${CONTAINER}" > /dev/null
    chmod +x ./gh-aw

Dev mode is unchanged — the binary is still built from source via generateDevModeCLIBuildSteps.

Original prompt

This section details on the original issue you should resolve

<issue_title>gh-aw binary not present in runner working directory for portfolio-analyst</issue_title>
<issue_description>gh-aw binary is not present in the runner's working directory. The setup action installs scripts to /opt/gh-aw/actions/ but doesn't place a gh-aw CLI binary in the workspace.

Environment

  • gh-aw version: 0.50.7 (upgraded from 0.47.4)
  • Engine: claude
  • Repository: private

Steps to reproduce

  1. gh aw add-wizard https://github.com/github/gh-aw/blob/v0.45.5/.github/workflows/portfolio-analyst.md
  2. Workflow installs and triggers automatically
  3. Workflow run fails

Errors

Run 1 (v0.47.4)

The activation job fails during "Interpolate variables and render templates":

Runtime import file not found:
aw/imports/github/gh-aw/852cb06ad52958b402ed982b69957ffc57ca0619/.github_workflows_shared_reporting.md

The import files referenced in the workflow were not committed to the repo during add-wizard.

Run 2 (v0.50.7, after manually adding import files)

Import issue resolved, but the agent job fails at the "Download logs" step:

./gh-aw: No such file or directory

The workflow step runs ./gh-aw logs --start-date -30d ... but the gh-aw binary is not present in the
runner's working directory. The setup action installs scripts to /opt/gh-aw/actions/ but doesn't place a
gh-aw CLI binary in the workspace.

Expected behavior

The add-wizard command should:

  1. Include all required import files in the PR it creates
  2. The workflow should have access to the gh-aw CLI during execution</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…m steps

When a workflow configures the `agentic-workflows` tool and has custom steps
that use `./gh-aw` (e.g. `./gh-aw logs`), the binary was not available in
the workspace in production (non-dev) mode. This is because:

- Dev mode: `generateDevModeCLIBuildSteps` builds binary from source and
  places it at `./gh-aw` BEFORE custom steps run.
- Production mode: `Install gh-aw extension` (in MCP setup) runs AFTER
  custom steps, copying the binary only to `/opt/gh-aw/gh-aw`.

The fix adds `generateGhAwWorkspaceBinaryStep` which installs the gh-aw
extension and copies the binary to `./gh-aw` in the workspace. This step
is generated BEFORE custom steps when:
- NOT in dev mode
- `agentic-workflows` tool is configured
- Custom steps exist
- The workflow doesn't import `shared/mcp/gh-aw.md` (which handles it)

Also adds `workflowHasGhAwImport` helper and tests for the new behavior.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing gh-aw binary in runner working directory Fix: gh-aw binary unavailable in workspace for agentic-workflows custom steps Feb 28, 2026
@pelikhan
Copy link
Contributor

pelikhan commented Mar 1, 2026

@copilot do not install gh-aw , you should be using the container that is published along with the release.

…orkspace

Instead of installing the gh-aw extension (via gh extension install), use
the published release container (ghcr.io/github/gh-aw:<version>) to extract
the binary using docker create/cp. This places the native statically-compiled
binary at ./gh-aw in the workspace, making it available for custom steps
(e.g. ./gh-aw logs) before the MCP setup phase runs.

For a release binary v0.50.7, the container image is
ghcr.io/github/gh-aw:0.50.7 (semver without 'v' prefix, matching the
container registry tags).

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot do not install gh-aw , you should be using the container that is published along with the release.

Updated in e9cf548. The Install gh-aw CLI step now uses docker create/cp to extract the binary from ghcr.io/github/gh-aw:<version> (the container published with each release) instead of installing the extension:

- name: Install gh-aw CLI
  run: |
    docker pull ghcr.io/github/gh-aw:0.50.7
    CONTAINER=$(docker create ghcr.io/github/gh-aw:0.50.7)
    docker cp "${CONTAINER}:/usr/local/bin/gh-aw" ./gh-aw
    docker rm "${CONTAINER}" > /dev/null
    chmod +x ./gh-aw

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw -ifaceassert -nilfunc /opt/hostedtoolc/tmp/gh-aw/aw-feature-branch.patch -o /tmp/go-build3991779839/b001/workflow.test -importcfg /usr/bin/git -s -w -buildmode=exe git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw pkg/workflow/actjs/fuzz_mentions_harness.cjs x_amd64/vet git ch --show-toplevel x_amd64/vet /usr/bin/git race .cfg 64/pkg/tool/linux_amd64/vet git (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha se 1849878/b199/vet.cfg ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet --ignore-path .prettierignore --log-level=erro--show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -c &#34;prettier&#34; --write &#39;../../../**/*.json&#39; &#39;!../../../pkg/workflow/js/**/*.json&#39; --ignore-path ../.git pkg/cli/actions_build_command_test.go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --noprofile ine_helpers_test.go 64/pkg/tool/linux_amd64/vet ine_output.go ine_parsing_simprev-parse ine_test.go 64/pkg/tool/linux_amd64/vet ache�� .go .cfg 64/pkg/tool/linux_amd64/vet or_aggregation.ggit or_aggregation_trev-parse r 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha get --local /home/REDACTED/go/bin/git http.https://git/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -unreachable=false /tmp/go-build3861849878/b039/vet.cfg 1849878/b276/vet.cfg commit} (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel git /usr/bin/git on&#39; --ignore-patgit --local sh git rev-�� --show-toplevel git /usr/bin/git ./../pkg/workflogit pull.rebase ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha se 1849878/b041/vet.cfg .cfg (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha se 1849878/b107/vet.cfg .cfg -n1 --format=format:rev-parse 22e19fced672f5bc--show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel git /usr/bin/git get --global rgo/bin/bash git rev-�� --show-toplevel git /usr/bin/git on&#39; --ignore-patgit --local node git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha se 1849878/b045/vet.cfg .cfg (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha se 1849878/b140/vet.cfg .cfg -n1 --format=format:rev-parse 22e19fced672 ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha --show-toplevel git /usr/bin/git get --global p/bin/bash git rev-�� --show-toplevel git /usr/bin/git on&#39; --ignore-patgit --local 86_64/bash git (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha se 1849878/b043/vet.cfg ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha 1849878/b075/_pkg_.a (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha ge\|containerForVersion\|releasedImage\|ghcr.io/github/gh-aw: nstants.go 64/pkg/tool/linux_amd64/vet son ion_mode.go ion_pins.go 64/pkg/tool/linux_amd64/vet ion_�� ion_pins_test.go .cfg 64/pkg/tool/linux_amd64/vet nore ion_resolver_tesrev-parse ion_sha_checker.--show-toplevel 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/22e19fc-dirty
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/22e19fc-dirty --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/sed se 1849878/b231/vet-C ache/go/1.25.0/x/home/REDACTED/work/gh-aw/gh-aw/.github/workflows sed s/-$�� (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha --show-toplevel x_amd64/cgo cal/bin/node g_.a (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha .egg (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git rite &#39;**/*.cjs&#39; git .cfg 64/pkg/tool/linulog.showsignature=false git rev-�� --show-toplevel 64/pkg/tool/linu--format=format:%H %ct %D /usr/bin/git te &#39;scripts/**/*git .cfg 64/pkg/tool/linu/home/REDACTED/work/gh-aw/gh-aw/.github/workflows git (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha w-binary-issue^{commit} (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh-aw binary not present in runner working directory for portfolio-analyst

2 participants