fix: local .github/agents imports now use snippet-style runtime-import path for Claude/Codex#19614
Draft
fix: local .github/agents imports now use snippet-style runtime-import path for Claude/Codex#19614
Conversation
…h for Claude/Codex Local agent file imports (same repo) no longer trigger the AGENT_CONTENT+PROMPT_TEXT shell variable path in Claude/Codex engines. They now use the runtime-import macro (snippet-style) which is robust and avoids the AWF variable inheritance bug. Also fix awk command in both engines: it was extracting frontmatter instead of the body. Extract shared AgentFileBodyExtractCmd helper to avoid duplication between engines. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix .github/agents imports for better compatibility
fix: local .github/agents imports now use snippet-style runtime-import path for Claude/Codex
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Importing from
.github/agents/*.mdin the same repo triggered a fragileAGENT_CONTENT+PROMPT_TEXTshell variable assembly path in Claude/Codex engines, plus a spuriousmerge_remote_agent_github_folderstep — neither of which was needed for local files. TheAGENT_CONTENTpath is broken when AWF (firewall) is enabled: the variables are set as unexported shell vars on the host, so they're invisible inside the AWF container, causing Claude to fail withError: Input must be provided either through stdin or as a prompt argument when using --print. Switching the same import to.github/snippets/avoided the issue entirely.Changes
pkg/parser/import_bfs.goremoteOrigin == nil) no longer setagentFile/agentImportSpecon the accumulator — they go straight intoimportPaths(runtime-import macro), identical to snippet importsagentFile/agentImportSpecfor the AGENT_CONTENT pathfirstAgentPathfield to preserve the one-agent-per-workflow restriction for both local and remote importspkg/workflow/engine_helpers.goAgentFileBodyExtractCmdhelper with corrected awk: the old patternBEGIN{skip=1} /^---$/{if(skip){skip=0;next}else{skip=1;next}} !skipwas printing the frontmatter instead of the markdown body; replaced with/^---$/ && n<2{n++;next} n!=1which correctly skips frontmatter and handles files without itpkg/workflow/claude_engine.go+pkg/workflow/codex_engine.goAgentFileBodyExtractCmd; both carry a note thatAgentFileis only set for remote importsTest updates
agent_import_integration_test.go: local agent imports now produce emptyAgentFileinImportsResultinline_imports_test.go:inlined-imports: true+ local agent import now succeeds (treated as snippet); test renamed accordinglyResult
The compiled lockfiles for
.github/agents/and.github/snippets/imports are now structurally identical — both use{{#runtime-import ...}}; neither emitsAGENT_CONTENT,GH_AW_AGENT_FILE, ormerge_remote_agent.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/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 0133938/b289/vet/tmp/gh-aw/aw-feature-branch.patch ules/.bin/sh git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linuTest User /usr/bin/git hub/workflows 0133938/b196/vetrev-parse 64/bin/sh git(http block)/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 bash /usr/bin/git node /tmp�� /tmp/TestHashConsistency_KeyOrdering1289841841/001/test2.md git /usr/bin/git --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git git(http block)/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 GOMOD GOMODCACHE rtcfg env g/envutil/envutiGOINSECURE g/envutil/envutiGOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE(http block)https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha user.email test@example.com /usr/bin/git w/js/**/*.json' git(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha 4217820/b359/parser.test git 4217820/b359/importcfg.link --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git YOv6OzmNRmwXU/if4s_j6J_nH7wUw7OLuL/FD4G_iBncVChYaLAFaTG/UG2hklzYOv6OzmNRmwXU rev-�� ry=1 git ache/node/24.13.1/x64/bin/node --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha 1438847/b359/parser.test GO111MODULE 1438847/b359/importcfg.link GOINSECURE GOMOD GOMODCACHE W4YWdmBbjcx6c/r7C_6_STzREH3pJdzReA/FD4G_iBncVChYaLAFaTG/anXHC_2W4YWdmBbjcx6c env ry=1 GO111MODULE 1438847/b359/_pkg_.a GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v3/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha NtQl/xhVqh7QChbBs18WVNtQl l /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/.bin-lang=go1.25 tierignore --local k/_temp/ghcca-no--show-toplevel node 6284�� --write 6284510/b402/_testmain.go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link --ignore-path ../../../.prettirev-parse x_amd64/vet /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-current git 64/pkg/tool/linux_amd64/compile --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git 64/pkg/tool/linux_amd64/compile rev-�� g_.a git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v5/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha */*.ts' '**/*.json' --ignore-path ../../../.prettierignore 0133938/b239/vet.cfg ules/.bin/sh(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/brave.md 64/pkg/tool/linuconfig /usr/bin/git 27 .cfg 64/pkg/tool/linu--show-toplevel git rev-�� --git-dir 64/pkg/tool/linu-importcfg /usr/bin/infocmp e=false(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel /opt/hostedtoolcache/go/1.25.0/x-test.v=true /usr/bin/git 19/001/test-emptgit rsion=505a751-direv-parse 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/infocmp 0826/001/stabiligit -buildtags /opt/hostedtoolc--show-toplevel infocmp(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v6/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --get remote.origin.url /usr/bin/git ath g/workflow/copilrev-parse x_amd64/vet git conf�� user.email test@example.com /usr/bin/git --noprofile(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha /tmp/gh-aw-test-runs/20260304-152130-13942/test-736174050 config .cfg remote.origin.urgit .go 64/pkg/tool/linu--show-toplevel git init��(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git -v origin de_modules/.bin/--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu-buildtags /usr/bin/git *.json' '!../../git /tmp/go-build155rev-parse 64/pkg/tool/linu--show-toplevel git(http block)https://api.github.com/repos/actions/download-artifact/git/ref/tags/v8/usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha -unreachable=false /tmp/go-build1550133938/b117/vet.cfg in/sh nore(http block)/usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha -bool -buildtags .cfg -errorsas -ifaceassert erignore /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu-goversion -V=f�� te '../../../**/*.json' '!../../../pkg/workflow/-c=4 -tests 1/x64/bin/node ./cmd/gh-aw(http block)/usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq .object.sha -t security /home/REDACTED/.local/bin/node OUTPUT -d 168.63.129.16 node /opt�� 2130-13942/test-3887640242 --write(http block)https://api.github.com/repos/actions/github-script/git/ref/tags/v8/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha --verify main x_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ath ../../../.pr**/*.json(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha go1.25.0 -c=4 -nolocalimports -importcfg /tmp/go-build1516284510/b395/importcfg -pack /tmp/go-build1516284510/b395/_testmain.go er o actions/setup-cli/install.sh..."(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha k/gh-aw/gh-aw/.github/workflows/brave.md x_amd64/vet /usr/bin/git(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha ithub/workflows/agent-performance-analyzer.md git rgo/bin/bash --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git v1.0.0 ache/go/1.25.0/xrev-parse /usr/bin/git git(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha -json GO111MODULE 1/x64/bin/node GOINSECURE GOMOD GOMODCACHE 1/x64/bin/node env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE rop.prop.prop.prop.prop.prop.prop.prop.prop.pro(http block)https://api.github.com/repos/actions/setup-node/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha /tmp/gh-aw-test-runs/20260304-152130-13942/test-3851666655 config /usr/bin/git remote.origin.urgit(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git cal/bin/bash --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git git rev-�� --show-toplevel git 1/x64/bin/node image:v1.0.0 ache/go/1.25.0/xrev-parse /usr/bin/git rop.prop.prop.prop.prop.prop.prop.prop.prop.pro(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha -json GO111MODULE cal/bin/bash GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha /ref/tags/v8 -goversion 6284510/b374=> -c=4 b/gh-aw/pkg/cli -importcfg node /hom�� JRDm/a9D2svtRZPWCW1DWJRDm **/*.cjs ache/node/24.13.1/x64/bin/node **/*.json --ignore-path ../../../.pretti--show-toplevel 6284510/b374/importcfg(http block)/usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha --show-toplevel docker /usr/bin/grep rhysd/actionlintgit x_amd64/link /usr/bin/git grep ^Fro�� /tmp/gh-aw/aw-master.patch git 86_64/bash --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git(http block)/usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v7/usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha */*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path(http block)/usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha */*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path c 64/pkg/tool/linux_amd64/vet -(http block)/usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha 19/001/test-simple-frontmatter.m-errorsas /tmp/go-build1550133938/b007/vet-ifaceassert 64/pkg/tool/linux_amd64/vet son(http block)https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b/usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha f9dd00c75c79c7baGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 349759/b409/_pkgGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts/usr/bin/gh gh run download 1 --dir test-logs/run-1(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 0133938/b139/vet-c=4 1/x64/bin/npm(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts/usr/bin/gh gh run download 12346 --dir test-logs/run-12346(http block)https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts/usr/bin/gh gh run download 2 --dir test-logs/run-2(http block)https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts/usr/bin/gh gh run download 3 --dir test-logs/run-3 0133938/b289/vet.cfg ules/.bin/sh(http block)https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts/usr/bin/gh gh run download 4 --dir test-logs/run-4(http block)https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts/usr/bin/gh gh run download 5 --dir test-logs/run-5(http block)https://api.github.com/repos/github/gh-aw/actions/workflows/usr/bin/gh gh workflow list --json name,state,path origin REDACTED**/*.json x_amd64/vet(http block)/usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100(http block)/usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD erignore go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --noprofile(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel bash /usr/bin/git rite '../../../*git(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.2.3/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha --noprofile(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha --noprofile(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha re --log-level=e!../../../pkg/workflow/js/**/*.json(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha re --log-level=error(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v3.0.0/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha re --log-level=e!../../../pkg/workflow/js/**/*.json(http block)https://api.github.com/repos/githubnext/agentics/git/ref/tags//usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node(http block)https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha se 0133938/b077/vet.cfg 86_64/sh(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel ortcfg /usr/bin/git p/smoke_test_225git(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/nonexistent/repo/actions/runs/12345/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion(http block)https://api.github.com/repos/owner/repo/actions/workflows/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /prettier(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo de(http block)https://api.github.com/repos/owner/repo/contents/file.md/tmp/go-build1516284510/b383/cli.test /tmp/go-build1516284510/b383/cli.test -test.testlogfile=/tmp/go-build1516284510/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true(http block)https://api.github.com/repos/test-owner/test-repo/actions/secrets/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name origin main x_amd64/vet |TestBuildInitia/bin/sh(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.