From baca144c5f7f62b4ec6a7cc8216343d0765fb713 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 May 2026 03:33:17 +0000 Subject: [PATCH 1/2] Initial plan From c1b247fd60f1eb44173ab20f1d2e2701c3faa0c1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 May 2026 03:46:04 +0000 Subject: [PATCH 2/2] fix: use models_url fallback in Fetch Copilot reflect inventory step Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../workflows/daily-model-inventory.lock.yml | 35 ++++++-------- .github/workflows/daily-model-inventory.md | 48 +++++++++++++++---- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/.github/workflows/daily-model-inventory.lock.yml b/.github/workflows/daily-model-inventory.lock.yml index ed53c4a3885..82dab2ab6ce 100644 --- a/.github/workflows/daily-model-inventory.lock.yml +++ b/.github/workflows/daily-model-inventory.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"86bc74622e9cf4ef29203d2fa67c97ca1458156986572fd9e731cfce9ea8d5ac","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"8892b7e9f4e2b4f5b1f450112b6e8f125cd987510c2a4f0013471b0fb320ac19","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["ANTHROPIC_API_KEY","COPILOT_GITHUB_TOKEN","GEMINI_API_KEY","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","OPENAI_API_KEY"],"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-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.48"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.48"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.48"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.11"},{"image":"ghcr.io/github/github-mcp-server:v1.0.4"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]} # ___ _ _ # / _ \ | | (_) @@ -203,21 +203,21 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_24dbdc61d282b6fd_EOF' + cat << 'GH_AW_PROMPT_8ea0485ba94a9284_EOF' - GH_AW_PROMPT_24dbdc61d282b6fd_EOF + GH_AW_PROMPT_8ea0485ba94a9284_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/playwright_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_24dbdc61d282b6fd_EOF' + cat << 'GH_AW_PROMPT_8ea0485ba94a9284_EOF' Tools: create_issue, missing_tool, missing_data, noop - GH_AW_PROMPT_24dbdc61d282b6fd_EOF + GH_AW_PROMPT_8ea0485ba94a9284_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" - cat << 'GH_AW_PROMPT_24dbdc61d282b6fd_EOF' + cat << 'GH_AW_PROMPT_8ea0485ba94a9284_EOF' The following GitHub context information is available for this workflow: {{#if github.actor}} @@ -246,14 +246,14 @@ jobs: {{/if}} - GH_AW_PROMPT_24dbdc61d282b6fd_EOF + GH_AW_PROMPT_8ea0485ba94a9284_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_24dbdc61d282b6fd_EOF' + cat << 'GH_AW_PROMPT_8ea0485ba94a9284_EOF' {{#runtime-import .github/workflows/shared/otlp.md}} {{#runtime-import .github/workflows/shared/noop-reminder.md}} {{#runtime-import .github/workflows/daily-model-inventory.md}} - GH_AW_PROMPT_24dbdc61d282b6fd_EOF + GH_AW_PROMPT_8ea0485ba94a9284_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -418,14 +418,7 @@ jobs: cat "$INVENTORY" shell: bash - name: Fetch Copilot reflect inventory - run: | - set -euo pipefail - OUT="/tmp/gh-aw/model-inventory/reflect.json" - mkdir -p "$(dirname "$OUT")" - if ! curl -fsS http://api-proxy:10000/reflect > "$OUT"; then - printf '%s' '{"endpoints":[],"error":"reflect endpoint unavailable"}' > "$OUT" - fi - echo "Copilot reflect metadata written to $OUT" + run: "set -euo pipefail\nOUT=\"/tmp/gh-aw/model-inventory/reflect.json\"\nmkdir -p \"$(dirname \"$OUT\")\"\nif ! curl -fsS http://api-proxy:10000/reflect > \"$OUT\"; then\n printf '%s' '{\"endpoints\":[],\"error\":\"reflect endpoint unavailable\"}' > \"$OUT\"\nfi\n# For configured endpoints where /reflect returned null models, fetch directly from\n# models_url (the api-proxy injects auth headers). Mirrors enrichReflectModels() in\n# awf_reflect.cjs — see .github/aw/llms.md for endpoint port/URL reference.\nwhile IFS= read -r entry; do\n provider=$(printf '%s' \"$entry\" | jq -r '.provider')\n models_url=$(printf '%s' \"$entry\" | jq -r '.models_url')\n echo \"Fetching models for $provider from $models_url\"\n if raw=$(curl -fsS \"$models_url\" 2>&1); then\n ids=$(printf '%s' \"$raw\" | jq -c '[.data[].id] // empty' 2>&1) || {\n echo \"Warning: failed to parse models response for $provider: $ids\"\n ids=\"\"\n }\n if [ -n \"$ids\" ]; then\n jq --arg p \"$provider\" --argjson m \"$ids\" \\\n '(.endpoints[] | select(.provider == $p) | .models) |= $m' \\\n \"$OUT\" > \"${OUT}.tmp\" && mv \"${OUT}.tmp\" \"$OUT\"\n echo \"Enriched $provider with $(printf '%s' \"$ids\" | jq 'length') model(s)\"\n else\n echo \"Warning: no model IDs extracted for $provider\"\n fi\n else\n echo \"Warning: failed to fetch models_url for $provider ($models_url): $raw\"\n fi\ndone < <(jq -c '.endpoints[]? | select(.configured == true and .models == null and .models_url != null)' \"$OUT\" 2>/dev/null || true)\necho \"Copilot reflect metadata written to $OUT\"\n" shell: bash - name: Configure Git credentials @@ -498,9 +491,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_d9b1903456114c3a_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_30fcb32f141b2104_EOF' {"create_issue":{"close_older_issues":true,"expires":168,"labels":["automation","models"],"max":1,"title_prefix":"[model-inventory] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_d9b1903456114c3a_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_30fcb32f141b2104_EOF - name: Generate Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -710,7 +703,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_5e815a7b31f15648_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + cat << GH_AW_MCP_CONFIG_fa19eb90e7419782_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" { "mcpServers": { "github": { @@ -756,7 +749,7 @@ jobs: } } } - GH_AW_MCP_CONFIG_5e815a7b31f15648_EOF + GH_AW_MCP_CONFIG_fa19eb90e7419782_EOF - name: Mount MCP servers as CLIs id: mount-mcp-clis continue-on-error: true diff --git a/.github/workflows/daily-model-inventory.md b/.github/workflows/daily-model-inventory.md index 62ecb6b6954..0c0d32b066f 100644 --- a/.github/workflows/daily-model-inventory.md +++ b/.github/workflows/daily-model-inventory.md @@ -296,6 +296,30 @@ steps: if ! curl -fsS http://api-proxy:10000/reflect > "$OUT"; then printf '%s' '{"endpoints":[],"error":"reflect endpoint unavailable"}' > "$OUT" fi + # For configured endpoints where /reflect returned null models, fetch directly from + # models_url (the api-proxy injects auth headers). Mirrors enrichReflectModels() in + # awf_reflect.cjs — see .github/aw/llms.md for endpoint port/URL reference. + while IFS= read -r entry; do + provider=$(printf '%s' "$entry" | jq -r '.provider') + models_url=$(printf '%s' "$entry" | jq -r '.models_url') + echo "Fetching models for $provider from $models_url" + if raw=$(curl -fsS "$models_url" 2>&1); then + ids=$(printf '%s' "$raw" | jq -c '[.data[].id] // empty' 2>&1) || { + echo "Warning: failed to parse models response for $provider: $ids" + ids="" + } + if [ -n "$ids" ]; then + jq --arg p "$provider" --argjson m "$ids" \ + '(.endpoints[] | select(.provider == $p) | .models) |= $m' \ + "$OUT" > "${OUT}.tmp" && mv "${OUT}.tmp" "$OUT" + echo "Enriched $provider with $(printf '%s' "$ids" | jq 'length') model(s)" + else + echo "Warning: no model IDs extracted for $provider" + fi + else + echo "Warning: failed to fetch models_url for $provider ($models_url): $raw" + fi + done < <(jq -c '.endpoints[]? | select(.configured == true and .models == null and .models_url != null)' "$OUT" 2>/dev/null || true) echo "Copilot reflect metadata written to $OUT" tools: @@ -355,8 +379,10 @@ Each enriched `models.json` entry has the form (fields vary by provider): ] } ``` -Note: Copilot model data must be read from the AWF `/reflect` endpoint. Copilot serves models from -multiple vendors (Anthropic, OpenAI, Google), and those models may include `vendor` metadata. +Note: Copilot model data is pre-fetched into `/tmp/gh-aw/model-inventory/reflect.json` by the +"Fetch Copilot reflect inventory" pre-step, which enriches null models via `models_url` where +possible (see `.github/aw/llms.md`). Copilot serves models from multiple vendors (Anthropic, +OpenAI, Google), and those models may include `vendor` metadata. If a provider's API key was not configured, the entry will have `"error": "... not set"` and an empty `models` array. Skip providers with errors or empty model lists. @@ -388,21 +414,22 @@ The alias pattern syntax is: ### Step 1: Load and Validate the Inventory -Read the combined inventory from `/tmp/gh-aw/model-inventory/inventory.json`. Then query -`http://api-proxy:10000/reflect` and extract the configured `copilot` endpoint. +Read the combined inventory from `/tmp/gh-aw/model-inventory/inventory.json`. Then read +the pre-fetched `/tmp/gh-aw/model-inventory/reflect.json` and extract the configured +`copilot` endpoint (`.endpoints[] | select(.provider == "copilot" and .configured)`). List the providers that returned data and the count of models available from each, including -Copilot from `/reflect`. +Copilot from the reflect file. -If `/reflect` returns no `copilot` endpoint (or reports an error), note Copilot as unavailable and -continue. +If the reflect file has an `error` field, or contains no `copilot` endpoint, note Copilot as +unavailable and continue. ### Step 2: Explore Raw API Fields For each provider that returned data, examine the raw response to identify all available fields: - OpenAI / Anthropic / Gemini: `/tmp/gh-aw/model-inventory/artifacts/-models/raw.json` -- Copilot: `http://api-proxy:10000/reflect` filtered to the `copilot` endpoint object +- Copilot: `/tmp/gh-aw/model-inventory/reflect.json` filtered to the `copilot` endpoint object Specifically look for: @@ -436,8 +463,9 @@ failed or returned an empty model list, fall back to the heuristics below. For each provider's enriched data, attempt to infer or validate the ET multiplier for each model: -1. **Copilot `/reflect` endpoint** — use the `copilot` endpoint's `models` list as the live model - source, then match model names/IDs against the official docs table first. If a match is found, +1. **Copilot reflect data** — use the `copilot` endpoint's `models` list from + `/tmp/gh-aw/model-inventory/reflect.json` as the live model source, then match model + names/IDs against the official docs table first. If a match is found, use the `New multiplier` as the authoritative value. Compare against the matching entry in `model_multipliers.json`, and list discrepancies or missing models.