Skip to content

Prefetch Copilot reflect data before agent startup in Daily Model Inventory Checker - #32237

Merged
pelikhan merged 3 commits into
mainfrom
copilot/aw-daily-model-inventory-checker-failure
May 15, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/aw-daily-model-inventory-checker-failure

Conversation

Copilot AI commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Bug Fix

The Daily Model Inventory Checker was failing before prompt execution because the Copilot agent started with a complex shell(...) allowlist entry for fetching /reflect, then exited immediately with no output. This change moves reflect collection out of the agent permission path and keeps the agent on read-only inputs.

  • What was the bug?

    • The compiled Copilot invocation included a high-complexity shell permission that embedded curl, fallback JSON emission, redirects, and quoting in a single --allow-tool shell(...) argument.
    • The workflow failed during Copilot startup, before any model inventory analysis ran.
  • How did you fix it?

    • Added a pre-agent workflow step to fetch Copilot reflect data into /tmp/gh-aw/model-inventory/reflect.json.
    • Removed the runtime shell allowlist entry that performed the curl || printf fallback inline inside the Copilot command.
    • Updated the workflow prompt/input docs to consume the prefetched file instead of instructing the agent to fetch /reflect itself.
    • Added a regression test that asserts the compiled lock file keeps the prefetch step and does not reintroduce the risky shell permission.
  • Implementation details

    • The agent still reads the same reflect payload, but now as a prepared artifact-like input rather than an executable fetch permission.
    • This narrows the Copilot allowlist to inspection commands only.
- name: Fetch Copilot reflect inventory
  shell: bash
  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

Copilot AI linked an issue May 15, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 15, 2026 01:12
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix daily model inventory checker engine failure Prefetch Copilot reflect data before agent startup in Daily Model Inventory Checker May 15, 2026
Copilot AI requested a review from pelikhan May 15, 2026 01:18
@pelikhan
pelikhan marked this pull request as ready for review May 15, 2026 01:21
Copilot AI review requested due to automatic review settings May 15, 2026 01:21
@pelikhan
pelikhan merged commit 4e522f4 into main May 15, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/aw-daily-model-inventory-checker-failure branch May 15, 2026 01:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to move Copilot /reflect collection out of the Copilot agent shell allowlist and into a pre-agent workflow step.

Changes:

  • Adds a workflow step to write Copilot reflect data to /tmp/gh-aw/model-inventory/reflect.json.
  • Removes the complex /reflect fetch shell allow-tool from the compiled Copilot invocation.
  • Adds a regression test for the compiled workflow lock file.
Show a summary per file
File Description
.github/workflows/daily-model-inventory.md Adds reflect prefetch step and updates input guidance.
.github/workflows/daily-model-inventory.lock.yml Regenerates compiled workflow with the new step and reduced allowlist.
pkg/workflow/daily_model_inventory_workflow_test.go Adds a regression test for the prefetch step and removed shell permission.

Copilot's findings

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 6

Comment on lines +296 to +297
if ! curl -fsS http://api-proxy:10000/reflect > "$OUT"; then
printf '%s' '{"endpoints":[],"error":"reflect endpoint unavailable"}' > "$OUT"
Comment on lines +354 to +355
- Copilot live provider metadata: `/tmp/gh-aw/model-inventory/reflect.json` (filter
`.endpoints[] | select(.provider == "copilot") | .models`). If the file contains an
Comment on lines +23 to +24
if strings.Contains(lockContentStr, `shell(mkdir -p /tmp/gh-aw/model-inventory && (curl -fsS http://api-proxy:10000/reflect > /tmp/gh-aw/model-inventory/reflect.json || printf "%s" "{\"endpoints\":[],\"error\":\"reflect endpoint unavailable\"}" > /tmp/gh-aw/model-inventory/reflect.json))`) {
t.Fatalf("expected compiled workflow to avoid the complex Copilot shell allow-tool for /reflect fallback")
Comment on lines +19 to +22
if !strings.Contains(lockContentStr, "Fetch Copilot reflect inventory") {
t.Fatalf("expected compiled workflow to prefetch Copilot reflect inventory")
}

Comment on lines +421 to +429
- 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"
Comment on lines +295 to +298
mkdir -p "$(dirname "$OUT")"
if ! curl -fsS http://api-proxy:10000/reflect > "$OUT"; then
printf '%s' '{"endpoints":[],"error":"reflect endpoint unavailable"}' > "$OUT"
fi
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.

[aw] Daily Model Inventory Checker failed

3 participants