From d8f2deb0ab0e8208fcb94c409e6041aecf7d2860 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 02:50:20 +0000 Subject: [PATCH 1/4] Initial plan From 14d462615cc85eaac77faf4cdedfa44fc248903b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 02:55:53 +0000 Subject: [PATCH 2/4] chore: outline plan for ambient context optimizer fix Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/skills/agentic-workflows/SKILL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/skills/agentic-workflows/SKILL.md b/.github/skills/agentic-workflows/SKILL.md index 84c905c3877..0e5802ec146 100644 --- a/.github/skills/agentic-workflows/SKILL.md +++ b/.github/skills/agentic-workflows/SKILL.md @@ -12,6 +12,7 @@ This skill is a dispatcher: identify the task type, load the matching `.github/a Read only the files you need: Load these files from `github/gh-aw` (they are not available locally). - `.github/aw/agentic-chat.md` +- `.github/aw/agentic-workflows-mcp.md` - `.github/aw/asciicharts.md` - `.github/aw/campaign.md` - `.github/aw/charts-trending.md` From 8cb94b271f0ce14c8dff6543bfa328d12490c1e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 02:59:30 +0000 Subject: [PATCH 3/4] fix: verify gh-aw CLI readiness in ambient context optimizer Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../daily-ambient-context-optimizer.lock.yml | 36 ++++++++++++------- .../daily-ambient-context-optimizer.md | 21 +++++++++++ 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/.github/workflows/daily-ambient-context-optimizer.lock.yml b/.github/workflows/daily-ambient-context-optimizer.lock.yml index fd3bd9579a1..b6b737297bd 100644 --- a/.github/workflows/daily-ambient-context-optimizer.lock.yml +++ b/.github/workflows/daily-ambient-context-optimizer.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"857e889ecb932fc82f103f3ed44d17fcc5ab4829ca299ae7919ab2b32c711873","body_hash":"aefeb0bd2f12e5356d6a32d769824e6c77d8db30c9568fee5a335ce255fcb615","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"444b09a1531804c62cab89e0c7756e97425f1172915103197458188f97f0bcc2","body_hash":"9f9c5791647378a2b152d559a11b428cdcb364b1f905e54a70f27c18eb9409d0","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-go","sha":"4a3601121dd01d1626a1e23e37211e3254c1c06c","version":"v6.4.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/setup-python","sha":"a309ff8b426b58ec0e2a45f0f869d46889d02405","version":"v6.2.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"docker/build-push-action","sha":"f9f3042f7e2789586610d6e8b85c8f03e5195baf","version":"v7.2.0"},{"repo":"docker/setup-buildx-action","sha":"d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5","version":"v4.1.0"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.58"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.22"},{"image":"ghcr.io/github/github-mcp-server:v1.1.2"},{"image":"node:lts-alpine","digest":"sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]} # ___ _ _ # / _ \ | | (_) @@ -232,20 +232,20 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_fe109bb5f3621866_EOF' + cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' - GH_AW_PROMPT_fe109bb5f3621866_EOF + GH_AW_PROMPT_05106de873687c4d_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_fe109bb5f3621866_EOF' + cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' Tools: create_issue, missing_tool, missing_data, noop - GH_AW_PROMPT_fe109bb5f3621866_EOF + GH_AW_PROMPT_05106de873687c4d_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" - cat << 'GH_AW_PROMPT_fe109bb5f3621866_EOF' + cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' The following GitHub context information is available for this workflow: {{#if github.actor}} @@ -274,13 +274,13 @@ jobs: {{/if}} - GH_AW_PROMPT_fe109bb5f3621866_EOF + GH_AW_PROMPT_05106de873687c4d_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/cli_proxy_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_fe109bb5f3621866_EOF' + cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' {{#runtime-import .github/workflows/shared/otlp.md}} {{#runtime-import .github/workflows/daily-ambient-context-optimizer.md}} - GH_AW_PROMPT_fe109bb5f3621866_EOF + GH_AW_PROMPT_05106de873687c4d_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -468,6 +468,16 @@ jobs: uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: "3.12" + - env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + name: Install gh-aw CLI + run: | + if gh extension list | grep -q "github/gh-aw"; then + gh extension upgrade gh-aw || true + else + gh extension install github/gh-aw + fi + gh aw --version - name: Prepare analysis workspace run: mkdir -p /tmp/gh-aw/ambient-context @@ -573,9 +583,9 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_a2405c059f2d03af_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_b89aee4fce20a4dd_EOF' {"create_issue":{"close_older_issues":true,"expires":168,"labels":["automation","report","workflow-optimization","analysis"],"max":1,"title_prefix":"[ambient-context] "},"create_report_incomplete_issue":{},"mentions":{"enabled":false},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_a2405c059f2d03af_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_b89aee4fce20a4dd_EOF - name: Generate Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -783,7 +793,7 @@ jobs: mkdir -p /home/runner/.copilot GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) - cat << GH_AW_MCP_CONFIG_2b3e968756e926fb_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + cat << GH_AW_MCP_CONFIG_65d253da7f75369c_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" { "mcpServers": { "agenticworkflows": { @@ -832,7 +842,7 @@ jobs: } } } - GH_AW_MCP_CONFIG_2b3e968756e926fb_EOF + GH_AW_MCP_CONFIG_65d253da7f75369c_EOF - name: Mount MCP servers as CLIs id: mount-mcp-clis continue-on-error: true diff --git a/.github/workflows/daily-ambient-context-optimizer.md b/.github/workflows/daily-ambient-context-optimizer.md index 6abef03503d..837dce0c101 100644 --- a/.github/workflows/daily-ambient-context-optimizer.md +++ b/.github/workflows/daily-ambient-context-optimizer.md @@ -30,12 +30,23 @@ safe-outputs: close-older-issues: true expires: 7d max: 1 + noop: timeout-minutes: 45 steps: - name: Setup Python runtime uses: actions/setup-python@v6.2.0 with: python-version: "3.12" + - name: Install gh-aw CLI + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if gh extension list | grep -q "github/gh-aw"; then + gh extension upgrade gh-aw || true + else + gh extension install github/gh-aw + fi + gh aw --version - name: Prepare analysis workspace run: | mkdir -p /tmp/gh-aw/ambient-context @@ -49,6 +60,16 @@ You are a cost-optimization analyst for `${{ github.repository }}`. Your job is to inspect the **first request sent to the DLLM** for several recent workflow runs, identify avoidable ambient context, and publish exactly one issue with concrete workflow improvements. +## MCP CLI Preflight + +Before downloading any logs, verify MCP CLI readiness: + +- run `gh --version` +- run `gh aw --version` +- run `gh aw logs --help` + +If any preflight command fails, stop and call `noop` with a short error summary that includes the failed command. + ## Goals 1. Sample a small but representative set of agentic workflow runs from the last 24 hours. From a9a1bd8c3190c6dbb4572d13632e4de4e63e5b0f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 03:03:13 +0000 Subject: [PATCH 4/4] fix: add noop config details for ambient optimizer preflight failures Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../daily-ambient-context-optimizer.lock.yml | 26 +++++++++---------- .../daily-ambient-context-optimizer.md | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/daily-ambient-context-optimizer.lock.yml b/.github/workflows/daily-ambient-context-optimizer.lock.yml index b6b737297bd..9af76804446 100644 --- a/.github/workflows/daily-ambient-context-optimizer.lock.yml +++ b/.github/workflows/daily-ambient-context-optimizer.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"444b09a1531804c62cab89e0c7756e97425f1172915103197458188f97f0bcc2","body_hash":"9f9c5791647378a2b152d559a11b428cdcb364b1f905e54a70f27c18eb9409d0","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"6e60a20397e8ba7b8547db399c2eba6c287b6b87fcf017fec356cc91e19c1dd6","body_hash":"9f9c5791647378a2b152d559a11b428cdcb364b1f905e54a70f27c18eb9409d0","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-go","sha":"4a3601121dd01d1626a1e23e37211e3254c1c06c","version":"v6.4.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/setup-python","sha":"a309ff8b426b58ec0e2a45f0f869d46889d02405","version":"v6.2.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"docker/build-push-action","sha":"f9f3042f7e2789586610d6e8b85c8f03e5195baf","version":"v7.2.0"},{"repo":"docker/setup-buildx-action","sha":"d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5","version":"v4.1.0"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.58"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.22"},{"image":"ghcr.io/github/github-mcp-server:v1.1.2"},{"image":"node:lts-alpine","digest":"sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]} # ___ _ _ # / _ \ | | (_) @@ -232,20 +232,20 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' + cat << 'GH_AW_PROMPT_9e4ca401a41bf508_EOF' - GH_AW_PROMPT_05106de873687c4d_EOF + GH_AW_PROMPT_9e4ca401a41bf508_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' + cat << 'GH_AW_PROMPT_9e4ca401a41bf508_EOF' Tools: create_issue, missing_tool, missing_data, noop - GH_AW_PROMPT_05106de873687c4d_EOF + GH_AW_PROMPT_9e4ca401a41bf508_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" - cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' + cat << 'GH_AW_PROMPT_9e4ca401a41bf508_EOF' The following GitHub context information is available for this workflow: {{#if github.actor}} @@ -274,13 +274,13 @@ jobs: {{/if}} - GH_AW_PROMPT_05106de873687c4d_EOF + GH_AW_PROMPT_9e4ca401a41bf508_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/cli_proxy_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_05106de873687c4d_EOF' + cat << 'GH_AW_PROMPT_9e4ca401a41bf508_EOF' {{#runtime-import .github/workflows/shared/otlp.md}} {{#runtime-import .github/workflows/daily-ambient-context-optimizer.md}} - GH_AW_PROMPT_05106de873687c4d_EOF + GH_AW_PROMPT_9e4ca401a41bf508_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -583,9 +583,9 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_b89aee4fce20a4dd_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_238b2fc7f69cbce9_EOF' {"create_issue":{"close_older_issues":true,"expires":168,"labels":["automation","report","workflow-optimization","analysis"],"max":1,"title_prefix":"[ambient-context] "},"create_report_incomplete_issue":{},"mentions":{"enabled":false},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_b89aee4fce20a4dd_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_238b2fc7f69cbce9_EOF - name: Generate Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -793,7 +793,7 @@ jobs: mkdir -p /home/runner/.copilot GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) - cat << GH_AW_MCP_CONFIG_65d253da7f75369c_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + cat << GH_AW_MCP_CONFIG_117d646110c31d94_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" { "mcpServers": { "agenticworkflows": { @@ -842,7 +842,7 @@ jobs: } } } - GH_AW_MCP_CONFIG_65d253da7f75369c_EOF + GH_AW_MCP_CONFIG_117d646110c31d94_EOF - name: Mount MCP servers as CLIs id: mount-mcp-clis continue-on-error: true diff --git a/.github/workflows/daily-ambient-context-optimizer.md b/.github/workflows/daily-ambient-context-optimizer.md index 837dce0c101..0f38b4abc9e 100644 --- a/.github/workflows/daily-ambient-context-optimizer.md +++ b/.github/workflows/daily-ambient-context-optimizer.md @@ -31,6 +31,8 @@ safe-outputs: expires: 7d max: 1 noop: + max: 1 + report-as-issue: true timeout-minutes: 45 steps: - name: Setup Python runtime