From 03465c64490f98e06c54f6d0ca2808323e67d3c1 Mon Sep 17 00:00:00 2001 From: luvs01 <27862058+luvs01@users.noreply.github.com> Date: Mon, 10 Aug 2026 00:23:11 +0900 Subject: [PATCH] fix(claude): honor Desktop native model opt-out --- .../management/native-integration-routes.ts | 4 ++-- tests/native-claude-desktop-toggle.test.ts | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/server/management/native-integration-routes.ts b/src/server/management/native-integration-routes.ts index 2a30ade29..7a4247509 100644 --- a/src/server/management/native-integration-routes.ts +++ b/src/server/management/native-integration-routes.ts @@ -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"; @@ -656,7 +656,7 @@ async function handleClaudeDesktopToggle(ctx: ManagementContext): Promise { + 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