Repository navigation
Prefetch Copilot reflect data before agent startup in Daily Model Inventory Checker - #32237
Merged
Merged
Conversation
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
pelikhan
approved these changes
May 15, 2026
Contributor
There was a problem hiding this comment.
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
/reflectfetch 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 |
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.
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?
curl, fallback JSON emission, redirects, and quoting in a single--allow-tool shell(...)argument.How did you fix it?
/tmp/gh-aw/model-inventory/reflect.json.curl || printffallback inline inside the Copilot command./reflectitself.Implementation details