Disable router fallbacks for local reviews

This commit is contained in:
Claude
2026-08-21 19:55:50 -04:00
parent 6478ce2bfa
commit 0dec11b5ed
2 changed files with 38 additions and 1 deletions
+4 -1
View File
@@ -13,7 +13,10 @@ export async function chat({ routerUrl, model, messages, agentId, sessionId, ten
// and return non-review text. The domain preflight (agent_mismatch 400)
// still applies per agent tier; the pipeline's attempt-2 fallback agent
// covers that.
body: JSON.stringify({ model, messages, agentId, sessionId, tenantId, stream: false, tools: false, raw: true }),
body: JSON.stringify({
model, messages, agentId, sessionId, tenantId,
stream: false, tools: false, raw: true, fallbackModels: []
}),
signal: AbortSignal.timeout(timeoutMs)
});
if (!res.ok) {
+34
View File
@@ -0,0 +1,34 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { chat } from '../src/lib/router.js';
test('review router client disables model fallbacks explicitly', async () => {
const originalFetch = globalThis.fetch;
let body;
globalThis.fetch = async (_url, init) => {
body = JSON.parse(init.body);
return Response.json({
message: { content: '{"axes":{},"overall":90,"grade":"A","findings":[]}' },
_shre: { model: 'ollama-remote/qwen2.5-coder:7b' }
});
};
try {
await chat({
routerUrl: 'http://router.test',
model: 'ollama-remote/qwen2.5-coder:7b',
messages: [{ role: 'user', content: 'review' }],
agentId: 'code-reviewer',
sessionId: 'review-test',
tenantId: 'nirlab',
timeoutMs: 1000
});
} finally {
globalThis.fetch = originalFetch;
}
assert.deepEqual(body.fallbackModels, []);
assert.equal(body.tools, false);
assert.equal(body.raw, true);
assert.equal(body.stream, false);
});