kimi-desktop: a model that can't turn thinking off is declared always_thinking (#350)
A model whose catalog lists every reasoning level magpie knows, none of them "none", is declared always_thinking to Kimi desktop, in its runtime entry and its menu. Kimi then stops sending an old Off choice to a model that can't turn thinking off. A model that offers none, lists no levels or lists an unknown one keeps its old declaration. Run at the reviewed head fa08b22: bun test packages/kimi-desktop packages/kimi-work, 65 pass. catalog-thinking.test.mjs against main's catalog.mjs: 4 of 9 fail (the always_thinking cases), so the test holds the change. The author's real Kimi 3.2.18.13 runs on Windows are in the PR; not tried on macOS here.
This commit is contained in:
@@ -1,4 +1,34 @@
|
|||||||
# macOS compatibility record
|
# Compatibility record
|
||||||
|
|
||||||
|
## Kimi 3.2.18 isolated compatibility check
|
||||||
|
|
||||||
|
On 2026-10-24, Windows Kimi desktop 3.2.18.13 shipped Daimon 0.6.8. An independent source copy of that installed bundle was used to exercise its unchanged model schema, thinking resolver, request builder and streamed/non-streamed response parser. Test-only exports exposed those internal functions; no installed application file was changed.
|
||||||
|
|
||||||
|
The catalog regression failed before the fix for mandatory-thinking models and passed afterward. The fix writes `always_thinking` only when the advertised thinking levels are complete, recognized and omit `none`; native entries, unknown metadata and switchable models retain their behavior. The actual 0.6.8 resolver maps a mandatory model's stale `off` to `high` with the existing default policy, while a switchable model keeps `off`.
|
||||||
|
|
||||||
|
The two packages passed 65 tests. Another 80 synthetic cases used the installed core's request builder across mandatory, switchable, unknown and non-thinking models, five requested effort choices, both response modes and Library instructions on/off. Ten additional cases checked raw thinking controls and approximately 2 MiB histories. The desktop adapter and Work provider preserved original system/developer messages, image parts, assistant progress and reasoning, tool declarations, IDs and results. The Work provider retains its existing intentional tool-schema normalization; it does not modify history or thinking fields. Synthetic tool responses were parsed, never executed.
|
||||||
|
|
||||||
|
The real Work `/models` endpoint discovered `k3-agent` and `k2d8-preview` with low/high/max efforts. Both models then completed real streamed and non-streamed requests with matching synthetic markers and nonempty reasoning. A real model also returned a declared read-fixture tool call and accepted its synthetic result together with the assistant's reasoning. Six direct inference calls succeeded. Two additional constraint probes received the upstream HTTP 400 `tool_choice 'specified' is incompatible with thinking enabled`; using normal automatic tool selection completed the loop without a provider-code change.
|
||||||
|
|
||||||
|
Four further requests exercised the candidate desktop adapter and unchanged Work provider through a task-created loopback gateway: both models at high/max, with the actual upstream model ID checked in every case. An initial test-client mistake omitted the menu alias and exercised the selected-model fallback; those four earlier calls are excluded from this two-model coverage claim. The client was corrected before the four verified requests.
|
||||||
|
|
||||||
|
The unchanged official Kimi executable was also launched with a separate temporary profile and workspace. Its real authenticated control API accepted the candidate's catalog through `conversations.updateKimiModelList`; both runtime/menu aliases declared `always_thinking`. The profile used a synthetic local Web identity and an isolated offline model cache. Only the existing Work service API key was temporarily borrowed; no real Web sign-in token or refresh token was copied, no login/refresh operation was requested, and temporary service-key copies were removed afterward. This did not verify a real account's online menu refresh.
|
||||||
|
|
||||||
|
Four user turns were submitted through that desktop instance's background control API with `activate:false` on conversation creation. Both models executed the native `Read` tool against the same task-owned fixture, returned its exact marker, and replayed matching tool IDs, results and assistant reasoning. The entire preceding request history prefix was unchanged across each tool continuation. A later low-effort turn recalled markers from earlier turns without another tool call. A stale `off` request on a mandatory model remained enabled in the actual runtime (`max` in this profile); the adapter did not rewrite those thinking fields. Six main-conversation inference requests completed with HTTP 200 and full SSE termination. These are real desktop-runtime turns, not mouse/keyboard submissions from the UI.
|
||||||
|
|
||||||
|
After disconnecting, only the task-created desktop and gateway were stopped. All 25 protected original files matched their before-test hashes: the two installed plugins, original Kimi login/configuration, Magpie prompt/binding and sync settings, and official application files. No installed package or official program was patched or upgraded.
|
||||||
|
|
||||||
|
Limits of that background run: desktop input was paused, and the observed UI model menu used the isolated offline cache. The live route used a task-created gateway, not an official Magpie `serve` host. No current macOS runtime, sleep/wake, natural token rotation, search/fetch or non-read tool execution was tested. These results do not supersede the separate real macOS record below.
|
||||||
|
|
||||||
|
### Signed-in Windows desktop UI follow-up
|
||||||
|
|
||||||
|
The synthetic profile could display models and run background control turns, but the UI's send entry required a real Web sign-in. Both saved Web access tokens available locally had expired; no model request was emitted by those rejected UI attempts. The user then completed the official sign-in flow in the temporary profile. The original profile and its login files were not refreshed or changed.
|
||||||
|
|
||||||
|
Three actual UI submissions completed against real models. The first two each executed native `Read` against the task-owned fixture and returned its exact marker; the isolated adapter selected `k3-agent` and then `k2d8-preview`, and the recorded upstream IDs matched. Thinking stayed enabled at high effort. All four streamed requests in those two tool loops completed with HTTP 200; tool IDs, results and assistant reasoning matched, and each entire request history prefix survived its continuation. A third UI-submitted turn on `k2d8-preview` recalled both prior UI markers and the file marker without a tool call. Its streamed request also completed with HTTP 200, and retained the initial UI request's entire history prefix. All original conversation message parts were unchanged.
|
||||||
|
|
||||||
|
The signed-in UI retained Kimi's native model labels, while the isolated adapter's selection determined the actual upstream model. This UI check therefore verifies real sending through the bridge; it does not claim that the online native menu displays Magpie's custom aliases. No UI code, application resources or installed plugin was patched to obtain this result.
|
||||||
|
|
||||||
|
The adapter was disconnected and only the test-created processes were stopped. The whole temporary signed-in profile, including its cookies and tokens, was removed. All 25 protected original files still matched the independent before-UI hashes, including original login/configuration, the installed plugins, prompt/binding and sync settings, and official program files. A credential-free verification summary was retained outside the repository; no credentials, private prompts or local execution artifacts are included in this change.
|
||||||
|
|
||||||
## Library upgrade 0.1.1
|
## Library upgrade 0.1.1
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ bun test packages/kimi-desktop/kimi-desktop.test.mjs
|
|||||||
|
|
||||||
The model catalog is fetched from Magpie's `/v1/models` with this agent's credential and registered User-Agent. Magpie owns its visibility, picked/hidden models, disables and ordering. The adapter never opens Magpie's `providers.json` or `settings.json`. It rechecks the gateway catalog before every inference; removed selections are refused even during a running turn, and an unavailable catalog returns a fixed error instead of falling back to an unrestricted list. This package includes no Electron injection hook or model-menu patch. The icon is Kimi's desktop application icon.
|
The model catalog is fetched from Magpie's `/v1/models` with this agent's credential and registered User-Agent. Magpie owns its visibility, picked/hidden models, disables and ordering. The adapter never opens Magpie's `providers.json` or `settings.json`. It rechecks the gateway catalog before every inference; removed selections are refused even during a running turn, and an unavailable catalog returns a fixed error instead of falling back to an unrestricted list. This package includes no Electron injection hook or model-menu patch. The icon is Kimi's desktop application icon.
|
||||||
|
|
||||||
|
Thinking models with a complete, recognized effort list that omits `none` also declare `always_thinking` in both the runtime and menu model configurations. Kimi can then resolve an old Off selection using that model's thinking defaults. A list containing `none` remains switchable; missing or unrecognized effort metadata does not imply mandatory thinking. The adapter does not rewrite the inference request's thinking fields. See the [3.2.18 compatibility check](COMPATIBILITY.md#kimi-3218-isolated-compatibility-check).
|
||||||
|
|
||||||
|
The 3.2.18 check includes real model requests, four background-control turns, and three signed-in UI submissions in a separate official desktop profile. Both real models completed native read-tool loops, and the final UI turn recalled the earlier history without a tool call. The signed-in UI retained native model labels; this does not verify custom Magpie aliases in the online menu. The full record distinguishes these checks from the synthetic core tests.
|
||||||
|
|
||||||
## Shutdown and manual recovery
|
## Shutdown and manual recovery
|
||||||
|
|
||||||
The shared plugin host owns process shutdown. This plugin installs no SIGTERM/SIGINT handler and never calls `process.exit`. On the host's normal exit event it synchronously restores the original address if the current address is still its own; restart Kimi to reload its runtime. An explicit disconnect while both apps are running additionally restores model selection/list through the control API.
|
The shared plugin host owns process shutdown. This plugin installs no SIGTERM/SIGINT handler and never calls `process.exit`. On the host's normal exit event it synchronously restores the original address if the current address is still its own; restart Kimi to reload its runtime. An explicit disconnect while both apps are running additionally restores model selection/list through the control API.
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import {test, expect} from 'bun:test';
|
||||||
|
import {normalizeModels, mergeRuntimeModels} from './catalog.mjs';
|
||||||
|
|
||||||
|
const row = (id, reasoning, efforts) => ({id: 'fixture/' + id, reasoning,
|
||||||
|
supported_reasoning_levels: efforts.map(effort => ({effort}))});
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
['required', true, ['low', 'high', 'max'], true],
|
||||||
|
['single-required-level', true, ['high'], true],
|
||||||
|
['duplicate-required-level', true, ['high', 'high'], true],
|
||||||
|
['toggle', true, ['none', 'low', 'high'], false],
|
||||||
|
['unknown-levels', true, [], false],
|
||||||
|
['unrecognized-off', true, ['off', 'high'], false],
|
||||||
|
['future-level', true, ['future', 'high'], false],
|
||||||
|
['no-thinking', false, ['high'], false],
|
||||||
|
])('thinking capability: %s', (id, reasoning, efforts, always) => {
|
||||||
|
const model = normalizeModels({data: [row(id, reasoning, efforts)]})[0];
|
||||||
|
expect(model.runtime.capabilities.includes('thinking')).toBe(reasoning);
|
||||||
|
expect(model.runtime.capabilities.includes('always_thinking')).toBe(always);
|
||||||
|
expect(model.menu.daimonModelConfig.capabilities).toEqual(model.runtime.capabilities);
|
||||||
|
expect(model.menu.daimonModelConfig.supportEfforts).toEqual(model.runtime.supportEfforts ?? []);
|
||||||
|
if (efforts.includes('none')) {
|
||||||
|
expect(model.runtime.supportEfforts).toContain('none');
|
||||||
|
expect(model.menu.reasoningEffortOptions.some(e => e.reasoningEffort === 'none')).toBe(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('capability refresh replaces only adapter models and retains native thinking settings', () => {
|
||||||
|
const required = normalizeModels({data: [row('required', true, ['low', 'high', 'max'])]});
|
||||||
|
const native = {model: 'native-model', capabilities: ['thinking'], defaultEffort: 'max', user: true};
|
||||||
|
const obsolete = {...required[0].runtime, capabilities: ['thinking']};
|
||||||
|
const merged = mergeRuntimeModels([native, obsolete], required);
|
||||||
|
expect(merged[0]).toBe(native);
|
||||||
|
expect(merged[1].capabilities).toContain('always_thinking');
|
||||||
|
expect(merged).toHaveLength(2);
|
||||||
|
const toggle = normalizeModels({data: [row('required', true, ['none', 'high'])]});
|
||||||
|
expect(mergeRuntimeModels(merged, toggle)[1].capabilities).not.toContain('always_thinking');
|
||||||
|
});
|
||||||
@@ -12,11 +12,19 @@ export function normalizeModels(payload, {allowEmpty=false}={}) {
|
|||||||
const id = clean(row.id);
|
const id = clean(row.id);
|
||||||
if (!id || !id.includes('/')) continue;
|
if (!id || !id.includes('/')) continue;
|
||||||
const alias = 'magpie-local-' + crypto.createHash('sha256').update(id).digest('hex').slice(0, 24);
|
const alias = 'magpie-local-' + crypto.createHash('sha256').update(id).digest('hex').slice(0, 24);
|
||||||
const efforts = [...new Set((row.supported_reasoning_levels || []).map(x => clean(x.effort)).filter(x => x in effortNames))];
|
const advertised = [...new Set((row.supported_reasoning_levels || []).map(x => clean(x.effort)))];
|
||||||
|
const efforts = advertised.filter(x => Object.hasOwn(effortNames, x));
|
||||||
const thinking = efforts.includes('high') ? 'high' : efforts.includes('medium') ? 'medium' : efforts[0] || '';
|
const thinking = efforts.includes('high') ? 'high' : efforts.includes('medium') ? 'medium' : efforts[0] || '';
|
||||||
const capabilities = ['dynamically_loaded_tools'];
|
const capabilities = ['dynamically_loaded_tools'];
|
||||||
if (row.modalities?.input?.includes('image')) capabilities.push('image_in');
|
if (row.modalities?.input?.includes('image')) capabilities.push('image_in');
|
||||||
if (row.reasoning) capabilities.push('thinking');
|
if (row.reasoning) {
|
||||||
|
capabilities.push('thinking');
|
||||||
|
// A complete, known list without none cannot turn thinking off. An
|
||||||
|
// absent/unknown list says nothing about this; keep its prior behavior.
|
||||||
|
if (advertised.length && advertised.every(x => Object.hasOwn(effortNames, x) && x !== 'none')) {
|
||||||
|
capabilities.push('always_thinking');
|
||||||
|
}
|
||||||
|
}
|
||||||
const runtime = { model: alias, maxContextSize: positive(row.context_window || row.context_length, 131072),
|
const runtime = { model: alias, maxContextSize: positive(row.context_window || row.context_length, 131072),
|
||||||
capabilities, ...(row.max_output_tokens ? {maxOutputSize: positive(row.max_output_tokens, 8192)} : {}),
|
capabilities, ...(row.max_output_tokens ? {maxOutputSize: positive(row.max_output_tokens, 8192)} : {}),
|
||||||
...(efforts.length ? {supportEfforts: efforts, defaultEffort: thinking} : {}) };
|
...(efforts.length ? {supportEfforts: efforts, defaultEffort: thinking} : {}) };
|
||||||
|
|||||||
@@ -147,6 +147,43 @@ test('Work inference uses selected model and gateway auth; SSE tools survive; of
|
|||||||
} finally { await f.cleanup(); }
|
} finally { await f.cleanup(); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('thinking controls and complete tool histories survive the desktop bridge with and without Library instructions', async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
try {
|
||||||
|
await f.controller.tick();
|
||||||
|
for (const shared of [false, true]) for (const controls of [
|
||||||
|
{}, {thinking: {type: 'disabled'}, reasoning_effort: 'none'},
|
||||||
|
{thinking: {type: 'enabled', effort: 'max', keep: 'all'}, reasoning_effort: 'max'},
|
||||||
|
{thinking: {type: 'adaptive', budget_tokens: 16384}, reasoning: {effort: 'high', summary: 'auto'}},
|
||||||
|
{thinking: null, reasoning_effort: null, reasoning: null},
|
||||||
|
]) {
|
||||||
|
fs.writeFileSync(f.controller.instructionsFile, shared ? 'synthetic shared instruction' : '');
|
||||||
|
const original = {model: 'k2d8-preview', stream: true, tools: [
|
||||||
|
{type: 'function', function: {name: 'Read', description: 'synthetic', parameters: {
|
||||||
|
type: 'object', properties: {path: {type: 'string'}}, required: ['path']}}},
|
||||||
|
], messages: [
|
||||||
|
{role: 'system', content: 'synthetic native instruction'},
|
||||||
|
{role: 'developer', content: 'synthetic developer instruction'},
|
||||||
|
{role: 'user', content: [{type: 'text', text: 'synthetic 中文'},
|
||||||
|
{type: 'image_url', image_url: {url: 'data:image/png;base64,AAAA'}}]},
|
||||||
|
{role: 'assistant', content: 'synthetic progress', reasoning_content: 'synthetic reasoning',
|
||||||
|
tool_calls: [{id: 'call_read', type: 'function', function: {name: 'Read', arguments: '{}'}}]},
|
||||||
|
{role: 'tool', tool_call_id: 'call_read', content: 'synthetic tool result'},
|
||||||
|
{role: 'user', content: 'synthetic continuation'},
|
||||||
|
], ...controls};
|
||||||
|
const expected = structuredClone(original);
|
||||||
|
expected.model = 'original-provider/test-model';
|
||||||
|
if (shared) expected.messages.splice(2, 0, {role: 'system',
|
||||||
|
content: '<magpie-kimi-shared-instructions>\nsynthetic shared instruction\n</magpie-kimi-shared-instructions>'});
|
||||||
|
const response = await fetch(f.controller.bridgeURL + '/chat/completions', {method: 'POST',
|
||||||
|
headers: {Authorization: 'Bearer synthetic-kimi-key'}, body: JSON.stringify(original)});
|
||||||
|
expect(response.status).toBe(200);
|
||||||
|
expect(await response.text()).toContain('"name":"Read"');
|
||||||
|
expect(f.requests.at(-1).body).toEqual(expected);
|
||||||
|
}
|
||||||
|
} finally {await f.cleanup();}
|
||||||
|
});
|
||||||
|
|
||||||
test('Kimi menu aliases route independently and removed models fail closed', async () => {
|
test('Kimi menu aliases route independently and removed models fail closed', async () => {
|
||||||
const f = await fixture();
|
const f = await fixture();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import {test, expect} from 'bun:test';
|
||||||
|
import {_internal as I} from '../index.mjs';
|
||||||
|
|
||||||
|
const controls = [
|
||||||
|
{}, {thinking: {type: 'disabled'}, reasoning_effort: 'none'},
|
||||||
|
{thinking: {type: 'enabled', effort: 'max', keep: 'all'}, reasoning_effort: 'max'},
|
||||||
|
{thinking: {type: 'adaptive', budget_tokens: 16384}, reasoning: {effort: 'high', summary: 'auto'}},
|
||||||
|
{thinking: null, reasoning_effort: null, reasoning: null},
|
||||||
|
];
|
||||||
|
const history = [
|
||||||
|
{role: 'system', content: 'synthetic original system'},
|
||||||
|
{role: 'developer', content: 'synthetic original developer'},
|
||||||
|
{role: 'user', content: [{type: 'text', text: 'synthetic 中文'},
|
||||||
|
{type: 'image_url', image_url: {url: 'data:image/png;base64,AAAA'}}]},
|
||||||
|
{role: 'assistant', content: 'synthetic progress', reasoning_content: 'synthetic reasoning',
|
||||||
|
tool_calls: [{id: 'call_read', type: 'function', function: {name: 'Read', arguments: '{}'}}]},
|
||||||
|
{role: 'tool', tool_call_id: 'call_read', content: 'synthetic result'},
|
||||||
|
{role: 'user', content: 'synthetic continuation'},
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const [index, control] of controls.entries()) for (const form of ['string', 'request', 'bytes']) {
|
||||||
|
test(`thinking and history survive Work provider: controls ${index}, ${form}`, async () => {
|
||||||
|
const calls = [];
|
||||||
|
const session = {uid: 'synthetic', workToken: 'synthetic-work', webToken: 'synthetic-web'};
|
||||||
|
const reply = new Response('data: [DONE]\n\n', {headers: {'Content-Type': 'text/event-stream'}});
|
||||||
|
const p = I.createPlugin({readSession: () => session, fetchImpl: async (_url, init) => {
|
||||||
|
calls.push(JSON.parse(init.body)); return reply;
|
||||||
|
}});
|
||||||
|
const loader = await p.auth.loader(async () => ({source: 'kimi-work-desktop', uid: session.uid}));
|
||||||
|
const payload = {model: 'synthetic-model', stream: true, messages: history, tools: [
|
||||||
|
{type: 'function', function: {name: 'Read', parameters: {type: 'object', properties: {path: {type: 'string'}}}}},
|
||||||
|
], ...control};
|
||||||
|
const body = JSON.stringify(payload), url = I.BASE + '/chat/completions';
|
||||||
|
const result = form === 'request' ? await loader.fetch(new Request(url, {method: 'POST', body}))
|
||||||
|
: await loader.fetch(url, {method: 'POST', body: form === 'bytes' ? new TextEncoder().encode(body) : body});
|
||||||
|
expect(result).toBe(reply);
|
||||||
|
expect(calls).toEqual([payload]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
test('a required tool-schema rewrite preserves thinking, tool identity and the entire large history', async () => {
|
||||||
|
const session = {uid: 'synthetic', workToken: 'synthetic-work', webToken: 'synthetic-web'};
|
||||||
|
let sent;
|
||||||
|
const p = I.createPlugin({readSession: () => session, fetchImpl: async (_url, init) => {
|
||||||
|
sent = JSON.parse(init.body); return new Response('{}');
|
||||||
|
}});
|
||||||
|
const loader = await p.auth.loader(async () => ({source: 'kimi-work-desktop', uid: session.uid}));
|
||||||
|
const payload = {model: 'synthetic-model', thinking: {type: 'enabled', effort: 'max', keep: 'all'},
|
||||||
|
messages: [...history, {role: 'user', content: 'history '.repeat(270000)}], tools: [
|
||||||
|
{type: 'function', function: {name: 'Read', description: 'synthetic declaration', parameters: {
|
||||||
|
type: 'object', properties: {mode: {enum: ['text', 'bytes']}}}}},
|
||||||
|
]};
|
||||||
|
await loader.fetch(I.BASE + '/chat/completions', {method: 'POST', body: JSON.stringify(payload)});
|
||||||
|
expect(sent.messages).toEqual(payload.messages);
|
||||||
|
expect(sent.thinking).toEqual(payload.thinking);
|
||||||
|
expect(sent.tools[0].function.name).toBe('Read');
|
||||||
|
expect(sent.tools[0].function.description).toBe('synthetic declaration');
|
||||||
|
expect(sent.tools[0].function.parameters.properties.mode).toEqual({type: 'string', enum: ['text', 'bytes']});
|
||||||
|
expect({...sent, tools: undefined}).toEqual({...payload, tools: undefined});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user