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 apps/server/src/provider/ModelManifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ describe("ModelManifest service", () => {
),
);

it.live("does not fetch when provider update checks are disabled", () =>
it.live("fetches the remote manifest when provider update checks are disabled", () =>
Effect.gen(function* () {
let fetchCount = 0;
const service = yield* make.pipe(
Expand All @@ -558,9 +558,12 @@ describe("ModelManifest service", () => {
}),
),
);
assert.deepStrictEqual(yield* service.refresh, BUNDLED_MODEL_MANIFEST);
assert.deepStrictEqual(yield* service.forceRefresh, BUNDLED_MODEL_MANIFEST);
assert.strictEqual(fetchCount, 0);
assert.deepStrictEqual(yield* service.refresh, REMOTE_MANIFEST);
assert.strictEqual(fetchCount, 1);
// Explicit refresh (Settings → Providers → Refresh provider status)
// uses the same path and must stay independent of the CLI check switch.
assert.deepStrictEqual(yield* service.forceRefresh, REMOTE_MANIFEST);
assert.strictEqual(fetchCount, 2);
}).pipe(
Effect.scoped,
Effect.provide(
Expand Down
13 changes: 2 additions & 11 deletions apps/server/src/provider/ModelManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import * as Semaphore from "effect/Semaphore";
import { HttpClient, HttpClientResponse } from "effect/unstable/http";

import { ServerConfig } from "../config.ts";
import * as ServerSettings from "../serverSettings.ts";
import { hasValidClaudeManifestAdapters } from "./ClaudeModelManifest.ts";
import bundledManifestJson from "./model-manifest.json" with { type: "json" };
import { ProviderCompatibilityPolicy } from "./providerCompatibility.ts";
Expand Down Expand Up @@ -340,7 +339,6 @@ export const make = Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const config = yield* ServerConfig;
const settingsService = yield* ServerSettings.ServerSettingsService;
const httpClient = yield* HttpClient.HttpClient;
const serviceScope = yield* Effect.scope;

Expand Down Expand Up @@ -385,15 +383,8 @@ export const make = Effect.gen(function* () {
if (!force && isWithin(fetchedAtMs, MANIFEST_TTL_MS)) return manifest;
if (!force && isWithin(lastAttemptMs, MANIFEST_RETRY_MS)) return manifest;

// The same switch that gates provider CLI update checks. It stops network
// fetches only: a manifest already cached on disk from an earlier fetch
// stays in effect, since the setting is about phoning home, not about
// discarding data the server already holds.
const settings = yield* settingsService.getSettings.pipe(
Effect.catchCause(() => Effect.succeed(null)),
);
if (settings !== null && !settings.enableProviderUpdateChecks) return manifest;

// Catalog refresh is independent of Settings → Provider update checks.
// That switch only gates CLI version lookups.
lastAttemptMs = now;
const fetched = yield* httpClient.get(MODEL_MANIFEST_URL).pipe(
Effect.flatMap(HttpClientResponse.filterStatusOk),
Expand Down
Loading