Repository navigation
fix: restrict automatic model selection to models that can serve an agent - #11740
Conversation
Alias wildcards, family-version replacement, and middle-power fallback chose from every discovered model, so a pattern such as copilot/gpt-6* could pick a Decisions-only evaluation model or a utility model that is not enabled in the Copilot picker, and every agent turn then failed (github/gh-aw#76961, github/gh-aw#72353). automatic-selection.js now defines, in one place, when AWF may choose a model the caller did not name: the provider's model list must not mark it as picker-disabled or advertise only non-agent endpoints. Models without that metadata stay selectable, and explicit IDs and exact alias entries are kept. The resolver applies the rule to wildcard matches and fallbacks, scoped auto, Copilot Responses auto, and recovery share it, and /reflect publishes it per model as automatic_selection_eligible so harness-side resolvers can match. Co-authored-by: Copilot <[email protected]>
|
🚀 Security Guard has started processing this pull request |
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit c252b2f |
There was a problem hiding this comment.
🟡 Changes recommended
An explicitly empty supportedEndpoints array is treated as missing metadata, allowing models that advertise no supported endpoints to be selected and reported as eligible.
1 open issue
What changed in this PR
This PR centralizes provider-metadata checks so AWF avoids automatically selecting models that cannot serve an agent, while preserving explicit model choices.
Changes:
- Applies shared eligibility checks to wildcard aliases, fallback selection, scoped auto, and recovery.
- Exposes automatic-selection eligibility and exclusion reasons through
/reflect. - Adds regression coverage, documentation, and Docker packaging for the shared helper.
| File | Description |
|---|---|
docs/awf-config-spec.md |
Defines automatic-selection rules and explicit-choice exceptions. |
docs/api-proxy-sidecar.md |
Documents selection filtering and reflection fields. |
containers/api-proxy/scoped-auto-model.js |
Uses the shared predicate for scoped auto. |
containers/api-proxy/model-resolver.js |
Filters wildcard and fallback candidates. |
containers/api-proxy/model-resolver-resolution.test.js |
Tests exclusions, explicit choices, and fallback behavior. |
containers/api-proxy/model-recovery.js |
Uses the shared predicate for recovery candidates. |
containers/api-proxy/model-body-rewriter.js |
Applies shared eligibility checks to Copilot Responses auto. |
containers/api-proxy/management.test.js |
Tests reflected eligibility and exclusion reasons. |
containers/api-proxy/management.js |
Publishes per-model automatic-selection metadata. |
containers/api-proxy/Dockerfile |
Includes the new helper in the container image. |
containers/api-proxy/automatic-selection.js |
Implements shared provider-metadata eligibility checks. |
Review effort: Balanced (adaptive)
An explicit empty list is provider evidence, not missing metadata, and the routing catalogue already treats it that way. Only an absent list keeps a model selectable. Co-authored-by: Copilot <[email protected]>
|
✅ Copilot review passed with no inline comments. @rabeckett Add the |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅
|
|
✅ Security Guard completed successfully! Security GuardOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓
|
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 Smoke CopilotOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅
|
|
🔌 Smoke Services — All services reachable! ✅
|
|
🔮 The ancient spirits stir... Smoke Codex awakens to divine this pull request... |
|
✅ Build Test Suite completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "169.254.169.254"See Network Configuration for more information.
|
|
✅ Smoke Claude passed
|
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. Smoke ChrootOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
Smoke Cloud Hypervisor completed. Cloud Hypervisor + Copilot passed.
|
Smoke Test: Copilot Network Isolation ✅Result: PASS Both egress checks completed successfully:
EGRESS_RESULT allow=pass deny=pass The firewall correctly:
|
|
Smoke services: ✅ Redis PONG · ✅ pg_isready · ✅ SELECT 1. Overall: PASS
|
Chroot Version Comparison
Result:
|
Smoke OTel Tracing results
No unexpected failures, so no issue was filed.
|
Smoke Test: Claude Engine
Overall result: PASS
|
|
🔥 Smoke Test: Copilot (@rabeckett)
Assignees: none Overall: PASS
|
|
Cloud Hypervisor + Copilot smoke test
Overall: PASS
|
Smoke Test
|
Smoke Test: Copilot BYOK (Direct Mode) ✅ PASS
Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — PASS Environment workarounds (runner setup, not project failures):
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "169.254.169.254"See Network Configuration for more information.
|
I traced the failure to the dependency audit, not this PR’s code: both the main-package and docs-site audit jobs fail the high/critical vulnerability gate. The same two jobs also fail on |
Accept three current docs advisories that cannot affect the static deployment. Keep all other high or critical findings fail-closed. Expire the exceptions on December 1. Co-authored-by: Copilot App <[email protected]>
Apply the expiring picomatch acceptance to the root package audit. Keep all unrelated high and critical findings fail-closed. Co-authored-by: Copilot App <[email protected]>
Ignore low and moderate causes when evaluating a high or critical transitive finding. Continue requiring every high or critical path to match an unexpired acceptance. Co-authored-by: Copilot App <[email protected]>
Update the workflow contract test for the expiring npm audit allowlists. Keep assertions for fail-closed advisory-service handling and pinned execution. Co-authored-by: Copilot App <[email protected]>

Fixes #11741
When AWF picks a model the caller didn't name (an alias wildcard, family-version replacement, or middle-power fallback), it currently chooses from every model the provider lists. That includes models the provider itself says can't run an agent. In github/gh-aw#76961,
copilot/gpt-6*matchedgpt-6-luna-decisions, an evaluation model that only serves/v1/decisions, and every agent turn failed before producing output. The earlier github/gh-aw#72353 was the same problem withgpt-5.6-luna-utility, which isn't enabled in the Copilot picker. Excluding models by name would keep missing the next variant, so this PR makes the decision from the provider's own metadata instead.AWF already applied this kind of check in a few places (provider-scoped
auto, Copilotautoon Responses, automatic recovery), each with its own inline copy, but alias resolution and fallback never used it. The newautomatic-selection.jsdefines it once. A model can't be selected automatically when the provider's model list for the run marks itmodel_picker_enabled: false, or listssupported_endpointsthat include none of Chat Completions, Responses, or Messages. A model without that metadata stays selectable, so incomplete metadata never empties a catalogue. Explicit choices are untouched: a model ID requested directly, or an alias entry written without*(such as gh-aw'sevals: ["copilot/gpt-6-luna-decisions"]), still resolves as written.The resolver applies the rule to wildcard matches, family-version replacement and both middle-power fallback paths, and logs which matches it skipped. The three existing call sites now use the shared predicate. Because
filterResolvableAliasesgoes through the same resolver, an alias whose only matches are excluded is no longer advertised in/reflectormodels.json./reflectalso publishes the decision per model asrouting_models[].automatic_selection_eligible, withautomatic_selection_reason(model_picker_disabledorno_agent_endpoint) when it's false. The rule is specified indocs/awf-config-spec.md§12.8 and summarized indocs/api-proxy-sidecar.md.Using the Copilot catalogue from the failed run's
/reflectsnapshot and gh-aw's built-in alias table:largegpt-6-luna-decisionsgpt-5.3-codexgpt-5gpt-5.6-luna-utilitygpt-5.3-codexagent,copilotgpt-41-copilot(picker-disabled)gpt-5.3-codexgpt-6gpt-6-luna-decisionsevals, orgpt-6-luna-decisionsby IDgpt-6-luna-decisionsThis change alone isn't enough for github/gh-aw#76961. For the Copilot engine, gh-aw resolves
autoin its harness before AWF sees the request, so gh-aw's resolver needs to readautomatic_selection_eligibleand pick up an AWF release containing this change. That follow-up is github/gh-aw#78800.Testing
model-resolver-resolution.test.jsuse the real catalogue from the issue. They cover each exclusion reason on its own, explicit IDs and exact entries being kept, missing metadata staying selectable, and fallback candidates.management.test.jscovers the new/reflectfields. The behaviour tests fail without the change.npm packsmoke incatalogue-proxy.test.js, timed out in my local environment and fails the same way onmain.npm run test:reflect-smokepasses (28/28), and markdownlint passes on both changed docs.automatic-selection.jsis added to the api-proxy Dockerfile's explicitCOPYlist, and the Docker-staged loading test passes.