Skip to content

Exclude non-agent models from automatic selection - #11749

Merged
lpcox merged 5 commits into
mainfrom
copilot/alias-wildcards-fallback-checks
Nov 17, 2026
Merged

lpcox merged 5 commits into
mainfrom
copilot/alias-wildcards-fallback-checks

Conversation

@lpcox

@lpcox lpcox commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Wildcard aliases and fallback could select utility or evaluation models that cannot serve agent requests. Existing automatic-selection paths applied inconsistent eligibility checks.

  • Shared eligibility: Exclude picker-disabled models and models advertising no Chat Completions, Responses, or Messages endpoint. Missing metadata remains eligible.
  • Consistent selection: Apply the rule across wildcard aliases, family replacement, middle-power fallback, auto selection, routing, and recovery. Refresh metadata alongside model discovery; omit excluded-only aliases from advertisement.
  • Explicit choices preserved: Direct IDs and literal alias targets remain selectable, including deliberate decisions-model aliases.
  • Consumer contract: Publish routing_models[].automatic_selection_eligible through /reflect for harnesses resolving auto before calling AWF. Document the rule and field in the configuration spec and sidecar guide.

@lpcox lpcox changed the title [WIP] Fix alias wildcards and fallback to check model capabilities Exclude non-agent models from automatic selection Nov 17, 2026
@lpcox
lpcox marked this pull request as ready for review November 17, 2026 18:57
Copilot AI adaptive review requested due to automatic review settings November 17, 2026 18:58

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.

🟡 Changes recommended

Model normalization drops supportedEndpoints, allowing WebSocket-only models with a supported reasoning effort to receive an HTTP Responses route despite being marked ineligible.

1 open issue
What changed in this PR

Adds provider-metadata eligibility checks to AWF’s API proxy so automatic selection avoids non-agent models while preserving explicit model choices.

Changes:

  • Introduces shared eligibility checks across aliases, fallback, auto selection, routing, and recovery.
  • Refreshes eligibility metadata during discovery and publishes the decision through /reflect.
  • Adds regression coverage, documents the consumer contract, and packages the helper in the container.
File Description
docs/​awf-config-spec.md Specifies automatic-selection eligibility and explicit-choice exceptions.
docs/​api-proxy-sidecar.md Documents the new /reflect eligibility field.
containers/​api-proxy/​server.model-recovery.test.js Adds utility-only and empty-endpoint recovery cases.
containers/​api-proxy/​scoped-auto-model.js Applies shared eligibility to provider-scoped auto selection.
containers/​api-proxy/​routing-candidates.js Adds an eligibility check to routing choices.
containers/​api-proxy/​model-resolver.js Filters wildcard and family-replacement candidates.
containers/​api-proxy/​model-recovery.js Applies shared eligibility to recovery candidates.
containers/​api-proxy/​model-fallback.js Filters middle-power fallback using runtime metadata.
containers/​api-proxy/​model-config.js Refreshes resolution metadata alongside model discovery.
containers/​api-proxy/​model-body-rewriter.js Applies shared eligibility to Copilot Responses auto selection.
containers/​api-proxy/​management.test.js Updates expected reflection metadata.
containers/​api-proxy/​management.js Publishes per-model automatic-selection eligibility.
containers/​api-proxy/​Dockerfile Includes the new helper in the sidecar image.
containers/​api-proxy/​automatic-model-eligibility.test.js Covers eligibility, selection, reflection, and metadata refresh.
containers/​api-proxy/​automatic-model-eligibility.js Defines the shared provider-metadata eligibility rule.

Review effort: Max (adaptive)


function getModelRoutingChoices(providerModel, provider) {
if (provider === 'copilot' && providerModel.modelPickerEnabled === false) return [];
if (!isAutomaticModelEligible(providerModel)) return [];
@lpcox

lpcox commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

Copilot AI commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in d4325a5. Routing now preserves provider eligibility and excludes WebSocket endpoints from HTTP protocol choices; added regression coverage.

@lpcox

lpcox commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot merge main and resolve conflicts then make sure all review feedback has been addressed

…ds-fallback-checks

# Conflicts:
#	containers/api-proxy/Dockerfile
#	containers/api-proxy/management.js
#	containers/api-proxy/model-body-rewriter.js
#	containers/api-proxy/model-recovery.js
#	containers/api-proxy/model-resolver.js
#	containers/api-proxy/scoped-auto-model.js
#	docs/api-proxy-sidecar.md
#	docs/awf-config-spec.md

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main and resolve conflicts then make sure all review feedback has been addressed

Merged main and resolved the conflicts in two-parent merge commit 1a3532b. The WebSocket-only routing review feedback remains addressed and covered by the regression test. Focused API-proxy tests were blocked because npm could not resolve the package feed (ENOTFOUND); syntax and direct eligibility checks passed.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11749 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 657264e

expect(buildRoutingModelMetadata('openai', ['gpt-5.4', 'o3'], [])).toEqual([
{
model_id: 'gpt-5.4',
automatic_selection_eligible: true,
},
{
model_id: 'o3',
automatic_selection_eligible: true,
capabilities: { limits: { max_context_window_tokens: 900_000 } },
}])).toEqual([{
model_id: 'claude-opus-5-5',
automatic_selection_eligible: true,
@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 94.19% 94.19% ➡️ +0.00%
Statements 92.80% 92.81% 📈 +0.01%
Functions 93.37% 93.37% ➡️ +0.00%
Branches 87.16% 87.17% 📈 +0.01%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/host-executor-socket.ts 95.9% → 95.9% (+0.00%) 90.2% → 91.5% (+1.22%)
src/nvx/one-shot-process.ts 81.5% → 84.0% (+2.47%) 74.7% → 76.8% (+2.11%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox
lpcox merged commit bf1a71c into main Nov 17, 2026
44 of 46 checks passed
@lpcox
lpcox deleted the copilot/alias-wildcards-fallback-checks branch November 17, 2026 21:54
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.

Alias wildcards and fallback can choose models that can't serve an agent

4 participants