Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/model-scope.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,15 @@ test("leaves models without a pinned thinking level unpinned", async () => {
assert.deepEqual(result.thinkingLevelPins, { "anthropic/claude-opus-5": "high" });
});

test("reports patterns that match nothing but keeps the models that matched", async () => {
const result = await resolveVisibleModels(runtime, ["anthropic/claude-opus-5", "ghost-gateway/*"]);
test("keeps models that matched and stays quiet about leftover unmatched globs", async () => {
const result = await resolveVisibleModels(runtime, [
"anthropic/claude-opus-5",
"retired-provider/old-model-*",
"ghost-gateway/*",
]);

assert.deepEqual(refs(result), ["anthropic/claude-opus-5"]);
assert.equal(result.warnings.length, 1);
assert.match(result.warnings[0], /ghost-gateway\/\*/);
assert.deepEqual(result.warnings, []);
});

test("falls back to all available models when nothing matches at all", async () => {
Expand Down
8 changes: 7 additions & 1 deletion lib/model-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ export async function resolveVisibleModels(
getAvailable: async () => available,
} as ModelRuntime;
const { scopedModels, diagnostics } = await resolveModelScopeWithDiagnostics(cleaned, snapshotRuntime);
const warnings = diagnostics.map((diagnostic) => diagnostic.message);
// A leftover glob after a model was removed is not a chat-level problem when
// other enabledModels entries still matched. Keep no-match warnings only for
// a total miss, where the UI falls back to every available model and the user
// needs to know the scope did not apply.
const warnings = diagnostics
.filter((diagnostic) => diagnostic.code !== "no-match" || scopedModels.length === 0)
.map((diagnostic) => diagnostic.message);
if (scopedModels.length === 0) {
return {
visible: available,
Expand Down
Loading