Disable router fallbacks for local reviews
This commit is contained in:
+4
-1
@@ -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)
|
// and return non-review text. The domain preflight (agent_mismatch 400)
|
||||||
// still applies per agent tier; the pipeline's attempt-2 fallback agent
|
// still applies per agent tier; the pipeline's attempt-2 fallback agent
|
||||||
// covers that.
|
// 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)
|
signal: AbortSignal.timeout(timeoutMs)
|
||||||
});
|
});
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
|
|||||||
@@ -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);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user