From b0fe431e61bbded58945394d9c021eef123959fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Mon, 22 Jun 2026 22:12:24 +0300 Subject: [PATCH] =?UTF-8?q?fix(router):=20=D0=B2=D1=8B=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=BD=D1=8F=D1=82=D1=8C=20max=5Ftokens=20=D0=BF=D0=BE=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=BB=D0=BA=D1=83=20=D0=BC=D0=BE=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B8=20(65536)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 66000 был на 464 токена выше предела вывода deepseek-v4-flash (65 536) → запрос отбивался ошибкой 400. Выставлено ровно 65536 в обоих форматах запроса; тесты обновлены. Совпадает и с потолком Claude-моделей судьи/ наставника, идущих через тот же транспорт. Co-Authored-By: Claude Opus 4.8 --- tools/router-classifier.mjs | 4 ++-- tools/router-classifier.test.mjs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/router-classifier.mjs b/tools/router-classifier.mjs index 4e7343d..f2e0874 100644 --- a/tools/router-classifier.mjs +++ b/tools/router-classifier.mjs @@ -501,14 +501,14 @@ export async function callAnthropicAPI(promptOrMessages, { if (typeof promptOrMessages === 'string') { body = JSON.stringify({ model, - max_tokens: 66000, + max_tokens: 65536, messages: [{ role: 'user', content: promptOrMessages }], }); } else { const { system, user } = promptOrMessages; body = JSON.stringify({ model, - max_tokens: 66000, + max_tokens: 65536, system: [{ type: 'text', text: system, cache_control: { type: 'ephemeral' } }], messages: [{ role: 'user', content: user }], }); diff --git a/tools/router-classifier.test.mjs b/tools/router-classifier.test.mjs index 1f034c9..4f90ffa 100644 --- a/tools/router-classifier.test.mjs +++ b/tools/router-classifier.test.mjs @@ -608,24 +608,24 @@ describe('PAMYATKA extensions (Phase 3 brain-retro #9)', () => { // plus max_tokens 1500 too low for future long skill chains (silent truncation). describe('callAnthropicAPI — max_tokens budget for long chains', () => { - it('sends max_tokens 66000 for the structured {system,user} form', async () => { + it('sends max_tokens 65536 for the structured {system,user} form', async () => { let body; const fetchImpl = async (url, opts) => { body = JSON.parse(opts.body); return { ok: true, json: async () => ({ content: [{ text: '{"task_type":"question"}' }] }) }; }; await callAnthropicAPI({ system: 'S', user: 'U' }, { apiKey: 'k', fetchImpl }); - expect(body.max_tokens).toBe(66000); + expect(body.max_tokens).toBe(65536); }); - it('sends max_tokens 66000 for the legacy string form', async () => { + it('sends max_tokens 65536 for the legacy string form', async () => { let body; const fetchImpl = async (url, opts) => { body = JSON.parse(opts.body); return { ok: true, json: async () => ({ content: [{ text: '{"task_type":"question"}' }] }) }; }; await callAnthropicAPI('hi', { apiKey: 'k', fetchImpl }); - expect(body.max_tokens).toBe(66000); + expect(body.max_tokens).toBe(65536); }); });