diff --git a/src/shared/middleware/chatAdmissionResponses.ts b/src/shared/middleware/chatAdmissionResponses.ts index 8ae612edcc..ac1dfdce66 100644 --- a/src/shared/middleware/chatAdmissionResponses.ts +++ b/src/shared/middleware/chatAdmissionResponses.ts @@ -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", diff --git a/tests/unit/probe-10268-structural-503.test.ts b/tests/unit/probe-10268-structural-503.test.ts index 692bfaa1d6..09acaf25fa 100644 --- a/tests/unit/probe-10268-structural-503.test.ts +++ b/tests/unit/probe-10268-structural-503.test.ts @@ -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 {