fix(chat-admission): clarify local 503 source (#12223)

This commit is contained in:
KeelTrace
2026-08-31 20:47:07 -07:00
committed by GitHub
parent 978f32984c
commit ba200b8d2b
2 changed files with 9 additions and 3 deletions

View File

@@ -61,7 +61,7 @@ export function structuralRejectionResponse(status: 413 | 503, maxMessages: numb
status,
historyLimit
? `Chat history exceeds the ${maxMessages}-message limit; compact the conversation and retry.`
: "Structurally heavy chat request capacity is busy; retry shortly.",
: "Local chat admission capacity is busy for this structurally heavy request; upstream provider routing was not attempted. Retry shortly.",
undefined,
{
type: historyLimit ? "payload_too_large" : "server_error",

View File

@@ -14,7 +14,10 @@ import {
} from "../../src/shared/middleware/chatBodyAdmission.ts";
function heavyBody() {
const messages = Array.from({ length: 201 }, (_, i) => ({ role: "user", content: `prompt ${i}` }));
const messages = Array.from({ length: 201 }, (_, i) => ({
role: "user",
content: `prompt ${i}`,
}));
const tools = Array.from({ length: 32 }, (_, i) => ({
type: "function",
function: { name: `tool_${i}`, description: "a".repeat(64), parameters: { type: "object" } },
@@ -40,7 +43,10 @@ test("#10268: 2nd structurally-heavy agent request is rejected 503 (chat_admissi
const res = (second as { admit: false; response: Response }).response;
assert.equal(res.status, 503); // client is shown HTTP 503
const body = await res.json();
assert.equal(body.error?.message, "Structurally heavy chat request capacity is busy; retry shortly.");
assert.equal(
body.error?.message,
"Local chat admission capacity is busy for this structurally heavy request; upstream provider routing was not attempted. Retry shortly."
);
assert.equal(body.error?.code, "chat_admission_busy");
assert.equal(body.error?.reason, "structure_limit");
} finally {