Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/server/management/native-integration-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 011 (Claude Code), 012 (Grok).
*/
import { loadConfig, readRuntimePort, saveConfigPreservingClaudeCode } from "../../config";
import { filterCatalogVisibleModels, nativeOpenAiContextWindow, visibleNativeSlugs } from "../../codex/catalog";
import { desktopVisibleNativeSlugs, filterCatalogVisibleModels, nativeOpenAiContextWindow, visibleNativeSlugs } from "../../codex/catalog";
import { inspectDesktop3pConfigLibrary, removeDesktop3pStandardPivot, writeDesktop3pConfig } from "../../claude/desktop-3p";
import { injectGrokConfig, stripGrokConfig, type GrokInjectModel } from "../../grok/inject";
import { inspectGrokConfig } from "../../grok/inspect";
Expand Down Expand Up @@ -656,7 +656,7 @@ async function handleClaudeDesktopToggle(ctx: ManagementContext): Promise<Respon
const runtime = (ctx.deps.readRuntimePort ?? readRuntimePort)(process.pid);
const result = (ctx.deps.writeDesktop3pConfig ?? writeDesktop3pConfig)(
runtime?.port ?? latest.port,
[...visibleNativeSlugs(latest)],
[...desktopVisibleNativeSlugs(latest)],
routed,
latest.apiKeys?.[0]?.key,
"static",
Expand Down
17 changes: 17 additions & 0 deletions tests/native-claude-desktop-toggle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,23 @@ test("explicit enable re-reads desired state after catalog fetch and skips a con
expect(writes).toBe(0);
});

test("explicit enable honors the Claude Desktop native-model opt-out", async () => {
const persisted = { ...config(), claudeCode: { desktopNativeModels: false } };
writeFileSync(join(root, "config.json"), JSON.stringify(persisted));
let nativeSlugs: string[] | undefined;

const result = await toggle(true, {
fetchAllModels: async () => [],
writeDesktop3pConfig: (_port, slugs) => {
nativeSlugs = slugs;
return { written: true, path: join(library, "new.json"), fingerprint: "fingerprint" };
},
});

expect(result.status).toBe(200);
expect(nativeSlugs).toEqual([]);
});

test("POST /apply enables from a stale OFF server snapshot instead of cancelling itself", async () => {
// The regression: /apply persisted ON, then saved the WHOLE long-lived server
// config — whose snapshot still said OFF — over that write, so its own
Expand Down
Loading