Skip to content

fix(model-inventory): enrich /reflect null models via models_url fallback#32939

Merged
pelikhan merged 2 commits into
mainfrom
copilot/model-inventory-update-2026-05-18
May 18, 2026
Merged

fix(model-inventory): enrich /reflect null models via models_url fallback#32939
pelikhan merged 2 commits into
mainfrom
copilot/model-inventory-update-2026-05-18

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

The daily model inventory workflow reported Copilot as unavailable because the /reflect endpoint returns models: null for Copilot when the api-proxy hasn't completed its startup model fetch — there was no fallback to retrieve them.

Changes

Pre-step enrichment (Fetch Copilot reflect inventory)

  • After fetching /reflect, iterates over configured endpoints where models == null and fetches model IDs directly from each endpoint's models_url — mirrors the enrichReflectModels() pattern in awf_reflect.cjs as documented in .github/aw/llms.md
  • Adds diagnostic logging so fallback fetch failures surface in step output rather than silently producing empty results
while IFS= read -r entry; do
  provider=$(printf '%s' "$entry" | jq -r '.provider')
  models_url=$(printf '%s' "$entry" | jq -r '.models_url')
  if raw=$(curl -fsS "$models_url" 2>&1); then
    ids=$(printf '%s' "$raw" | jq -c '[.data[].id] // empty' 2>&1) || { echo "Warning: ..."; ids=""; }
    # inject ids back into reflect.json for the provider
  fi
done < <(jq -c '.endpoints[]? | select(.configured == true and .models == null and .models_url != null)' "$OUT")

Agent instruction consistency

  • Step 1, Step 2, and Step 3 all previously told the agent to query http://api-proxy:10000/reflect directly — redundant since the pre-step already fetches and enriches the data. Updated all three to read from the pre-fetched /tmp/gh-aw/model-inventory/reflect.json
  • Updated the Copilot data note to explain the pre-fetch + models_url enrichment flow and reference llms.md

Lock file recompiled.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update model alias inventory for 2026-05-18 fix(model-inventory): enrich /reflect null models via models_url fallback May 18, 2026
Copilot AI requested a review from pelikhan May 18, 2026 03:46
@pelikhan pelikhan marked this pull request as ready for review May 18, 2026 03:47
Copilot AI review requested due to automatic review settings May 18, 2026 03:47
@pelikhan pelikhan merged commit 361cf62 into main May 18, 2026
@pelikhan pelikhan deleted the copilot/model-inventory-update-2026-05-18 branch May 18, 2026 03:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the daily model inventory workflow’s handling of Copilot /reflect responses where models: null by adding a best-effort enrichment step that fetches model IDs from each endpoint’s models_url, and updates agent instructions to consume the pre-fetched reflect payload from disk.

Changes:

  • Add a /reflect enrichment loop that fetches model IDs from models_url for configured endpoints with models == null, with warning-level logging on failures.
  • Update Steps 1–3 instructions to read Copilot reflect data from /tmp/gh-aw/model-inventory/reflect.json instead of querying the api-proxy directly.
  • Recompile the workflow lockfile.
Show a summary per file
File Description
.github/workflows/daily-model-inventory.md Adds models_url fallback enrichment + updates instructions to use the enriched reflect.json artifact.
.github/workflows/daily-model-inventory.lock.yml Regenerates the locked workflow with the updated pre-step script content.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

.github/workflows/daily-model-inventory.md:315

  • if [ -n "$ids" ] treats [] as a successful enrichment, so this can overwrite models: null with an empty array even when the upstream returned no models (or parsing produced an empty list). awf_reflect.cjs keeps models as null when the extracted ID list is empty. Consider checking length > 0 before updating reflect.json (otherwise leave models null and warn) to preserve the “unavailable vs empty” distinction.
          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)"
  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines +306 to +310
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=""
}
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.

[model-inventory] Model alias inventory update - 2026-05-18

3 participants