Filter unresolvable model aliases from /reflect and models.json#3803
Filter unresolvable model aliases from /reflect and models.json#3803Copilot wants to merge 2 commits into
Conversation
…output Add filterResolvableAliases() to model-resolver.js which dynamically removes aliases that cannot be resolved to any available model for any provider that has reported models via the /models endpoint. - Only keeps aliases whose patterns match at least one known model - Keeps all aliases when no provider has fetched models yet (unknown state) - Disables middle-power fallback during filtering so only genuine alias→model matches count; fallback selections would keep aliases alive even after all their targets have been retired - Applied in server.js buildModelsJson(), writeModelsJson(), and the getModelAliases getter passed to the management /reflect handler Fixes: "Ignore unknown model aliases" issue
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Smoke Test: Claude Engine
Result: PASS
|
🔍 Smoke Test: API Proxy OpenTelemetry Tracing
All 5 scenarios pass. OTEL tracing integration is fully operational.
|
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Overall: PASS (core BYOK path confirmed; pre-step data missing due to unexpanded template vars) PR by
|
🔬 Smoke Test Results
PR: Filter unresolvable model aliases from /reflect and models.json Overall: PASS ✅
|
There was a problem hiding this comment.
Pull request overview
This pull request ensures /reflect and models.json no longer expose model aliases that cannot resolve to any currently-known provider model, preventing agents from selecting aliases that will fail or unexpectedly fall back after models are retired/disabled.
Changes:
- Added
filterResolvableAliases(aliases, availableModels)to drop aliases that don’t resolve against any provider with cached model data (with fallback intentionally disabled during filtering). - Applied alias filtering to all external exposure points in
server.js(/reflectviagetModelAliases, plusbuildModelsJson()andwriteModelsJson()). - Added unit tests covering both the resolver-level filtering behavior and the
buildModelsJson()integration behavior.
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/model-resolver.js | Adds filterResolvableAliases that keeps only aliases resolvable against providers with non-empty cached model lists, with fallback disabled for filtering decisions. |
| containers/api-proxy/server.js | Ensures /reflect and models snapshot generation serve filtered aliases instead of the raw configured alias map. |
| containers/api-proxy/model-resolver.test.js | Adds dedicated test coverage for filterResolvableAliases, including multi-provider, recursion, and extended alias syntax cases. |
| containers/api-proxy/server.models.test.js | Adds integration tests validating buildModelsJson() emits filtered aliases when cached model data is present, and preserves aliases when no model data exists yet. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
Chroot Version Comparison Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
Smoke test results failed. Check logs. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
Smoke Test Results
Overall: FAIL —
|
When a provider retires or disables a model, any configured alias whose patterns only resolve to that retired model would remain visible in
/reflectandmodels.json— misleading agents into using aliases that silently fail or fall back unexpectedly.Changes
model-resolver.js— newfilterResolvableAliases(aliases, availableModels)/modelsendpointserver.js— apply filter at all external exposure pointsbuildModelsJson(),writeModelsJson(), and thegetModelAliasesgetter (used by/reflect) all now serve filtered aliasesBehaviour
Fallback is intentionally disabled during filtering so that an alias whose target models have all been retired is removed rather than kept alive via a fallback selection.