fix(update): preserve disabled client registrations

This commit is contained in:
morluto 2026-10-10 04:58:26 +08:00
parent 5aa200285a
commit abf5e243c4
2 changed files with 25 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import { isOwnedClientRegistrationCommand } from "./ClientRegistrationIdentity.j
import { readClientRegistrationStatuses } from "./ClientRegistrationStatus.js";
import {
clientServerForcedEnabled,
clientServerListedDisabled,
effectiveClientServer,
parseClientConfiguration,
} from "./ClientConfigurationDocument.js";
@ -77,11 +78,12 @@ export const existingMaintenanceScope = async (
disabled: z.boolean().optional(),
})
.parse(effectiveClientServer(parsed, PRODUCT_IDENTITY.mcpServerKey));
// OMP's enabledServers allowlist runs an entry marked `enabled: false`.
// Root disable lists override enabled entries and OMP's force-on allowlist.
if (
(enabled.enabled !== false ||
clientServerForcedEnabled(parsed, PRODUCT_IDENTITY.mcpServerKey)) &&
enabled.disabled !== true
enabled.disabled !== true &&
!clientServerListedDisabled(parsed, PRODUCT_IDENTITY.mcpServerKey)
)
clients.push(client.name);
}

View File

@ -100,6 +100,27 @@ describe("OMP integration maintenance", () => {
existingMaintenanceScope(home, entryPoint, process.env),
).resolves.toMatchObject({ clients: ["omp"] });
});
it("preserves Grok Build disabled_mcp_servers during maintenance planning", async () => {
const registration = `[mcp_servers.rea]\ncommand = ${JSON.stringify(process.execPath)}\nargs = [${JSON.stringify(entryPoint)}, "mcp"]\nstartup_timeout_sec = 30\n`;
const configPath = await writeClient(
"grok_build",
`disabled_mcp_servers = ["rea", "other"]\n${registration}`,
);
await expect(
existingMaintenanceScope(home, entryPoint, process.env),
).resolves.toMatchObject({ clients: [] });
expect(await readFile(configPath, "utf8")).toContain(
'disabled_mcp_servers = ["rea", "other"]',
);
await writeFile(
configPath,
`disabled_mcp_servers = ["other"]\n${registration}`,
);
await expect(
existingMaintenanceScope(home, entryPoint, process.env),
).resolves.toMatchObject({ clients: ["grok_build"] });
});
});
describe("existing REA integration maintenance", () => {