fix(setup): drop non-boolean activation switches from retained entries

A string such as enabled: "false" was kept and then accepted as the desired
entry, so setup could report success while doctor rejected the registration.
Those values are removed with the other managed switches.
This commit is contained in:
Cursor Agent
2026-10-12 21:35:28 -04:00
committed by xeropresence
parent 53ba7e7b31
commit ff34e7aeff
5 changed files with 40 additions and 9 deletions
@@ -1533,8 +1533,11 @@ const REGISTRATION_REMOTE_KEYS: Readonly<Record<string, true>> = {
/**
* Whether setup replaces or removes an existing entry key. Setup registers an
* active server, so entry-level switches that turn it off are removed too.
* Grok Build's entry `disabled` is kept, matching registration status, which
* reads only Grok's root `disabled_mcp_servers` list.
* Non-boolean `enabled` or `disabled` values are removed as well: registration
* status requires booleans, and retaining a string would leave doctor invalid
* after setup reports success. Grok Build's boolean entry `disabled` is kept,
* matching registration status, which reads only Grok's root
* `disabled_mcp_servers` list.
*/
const registrationManagedKey = (
dialect: ClientRegistrationDialect,
@@ -1543,6 +1546,7 @@ const registrationManagedKey = (
): boolean =>
Object.hasOwn(REGISTRATION_LAUNCHER_KEYS, key) ||
Object.hasOwn(REGISTRATION_REMOTE_KEYS, key) ||
((key === "enabled" || key === "disabled") && typeof value !== "boolean") ||
(key === "enabled" && value === false) ||
(key === "disabled" && value === true && dialect !== "grok");
+2 -2
View File
@@ -157,7 +157,7 @@ describe("setup workflow", () => {
`startup_timeout_sec, which setup sets to ${String(MCP_STARTUP_POLICY.codexStartupTimeoutSeconds)}`,
);
expect(result.plannedActions[0]?.detail).toContain(
"remote-server keys and switches that turn the server off, which are removed",
"non-boolean enabled or disabled values, which are removed",
);
expect(host.hopperInstalls).toBe(0);
expect(host.configurations).toBe(0);
@@ -214,7 +214,7 @@ describe("setup approval disclosure", () => {
`startup_timeout_sec, which setup sets to ${String(MCP_STARTUP_POLICY.codexStartupTimeoutSeconds)}`,
);
expect(result.plannedActions[0]?.detail).toContain(
"The entry disabled flag is kept.",
"A boolean entry disabled flag is kept.",
);
});
+2 -2
View File
@@ -338,8 +338,8 @@ const localEntryDisclosure = (clientName: string): string => {
: "";
const removed =
clientName === "grok_build"
? "remote-server keys and an enabled: false switch, which are removed. The entry disabled flag is kept."
: "remote-server keys and switches that turn the server off, which are removed.";
? "remote-server keys, an enabled: false switch, and non-boolean enabled or disabled values, which are removed. A boolean entry disabled flag is kept."
: "remote-server keys, switches that turn the server off, and non-boolean enabled or disabled values, which are removed.";
const exceptions = rewritten === "" ? removed : `${rewritten}and ${removed}`;
return `On an existing local command entry, user fields are kept except ${exceptions} When that entry is remote, its other fields are replaced.`;
};