GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge remote-tracking branch 'origin/dev' into codex/service-manager-… · lidge-jun/opencodex@7119f66

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/server
    • management
      • route-registry.ts
    • responses
      • core.ts
  • tests/responses
    • responses-context-overflow.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/server/management/route-registry.ts‎

Copy file name to clipboardExpand all lines: src/server/management/route-registry.ts
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ export const MANAGEMENT_ROUTES: readonly ManagementRoute[] = [
149149
{ method: "GET", path: "/api/client-integrations/aside/profiles/{profileId}", module: "server/management/aside-profile-routes", mutates: false, mechanism: "prefix-decode" },
150150
{ method: "PUT", path: "/api/client-integrations/aside/profiles/{profileId}", module: "server/management/aside-profile-routes", mutates: true, mechanism: "prefix-decode" },
151151
{ method: "GET", path: "/api/client-integrations/aside/profiles/journal", module: "server/management/aside-profile-routes", mutates: false, mechanism: "prefix-decode" },
152-
{ method: "DELETE", path: "/api/client-integrations/aside/profiles/journal", module: "server/management/aside-profile-routes", mutates: true, mechanism: "prefix-decode", exempt: { reason: "deferred-verb", why: "Aside history deletion uses the dashboard journal cleanup; the CLI has history and restore but no deletion verb yet.", owner: "260904_priority65_closeout WP7", ownerDoc: "devlog/_plan/260904_priority65_closeout/060_wp7_rollback_journal_crud.md" } },
152+
{ method: "DELETE", path: "/api/client-integrations/aside/profiles/journal", module: "server/management/aside-profile-routes", mutates: true, mechanism: "prefix-decode", exempt: { reason: "deferred-verb", why: "Aside history deletion uses the dashboard journal cleanup; the CLI has history and restore but no deletion verb yet.", owner: "260904_priority65_closeout WP7", ownerDoc: "devlog/_fin/260904_priority65_closeout/060_wp7_rollback_journal_crud.md" } },
153153
{ method: "GET", path: "/api/client-integrations/aside/profiles/{profileId}/journal", module: "server/management/aside-profile-routes", mutates: false, mechanism: "prefix-decode" },
154-
{ method: "DELETE", path: "/api/client-integrations/aside/profiles/{profileId}/journal", module: "server/management/aside-profile-routes", mutates: true, mechanism: "prefix-decode", exempt: { reason: "deferred-verb", why: "Aside profile history deletion uses the dashboard journal cleanup; the CLI has scoped history and restore but no deletion verb yet.", owner: "260904_priority65_closeout WP7", ownerDoc: "devlog/_plan/260904_priority65_closeout/060_wp7_rollback_journal_crud.md" } },
154+
{ method: "DELETE", path: "/api/client-integrations/aside/profiles/{profileId}/journal", module: "server/management/aside-profile-routes", mutates: true, mechanism: "prefix-decode", exempt: { reason: "deferred-verb", why: "Aside profile history deletion uses the dashboard journal cleanup; the CLI has scoped history and restore but no deletion verb yet.", owner: "260904_priority65_closeout WP7", ownerDoc: "devlog/_fin/260904_priority65_closeout/060_wp7_rollback_journal_crud.md" } },
155155
{ method: "POST", path: "/api/client-integrations/aside/profiles/{profileId}/restore", module: "server/management/aside-profile-routes", mutates: true, mechanism: "prefix-decode" },
156156
// server/management/codex-prompt-routes
157157
{ method: "GET", path: "/api/codex-prompt", module: "server/management/codex-prompt-routes", mutates: false },
@@ -187,7 +187,7 @@ export const MANAGEMENT_ROUTES: readonly ManagementRoute[] = [
187187
// server/management/integration-routes
188188
{ method: "GET", path: "/api/client-integrations", module: "server/management/integration-routes", mutates: false },
189189
{ method: "GET", path: "/api/client-integrations/journal", module: "server/management/integration-routes", mutates: false },
190-
{ method: "DELETE", path: "/api/client-integrations/journal", module: "server/management/integration-routes", mutates: true, exempt: { reason: "deferred-verb", why: "Retiring one rollback row is a dashboard-local cleanup; the CLI verb that would drive it is owed by a later work-phase and is not implemented here.", owner: "260904_priority65_closeout WP7", ownerDoc: "devlog/_plan/260904_priority65_closeout/060_wp7_rollback_journal_crud.md" } },
190+
{ method: "DELETE", path: "/api/client-integrations/journal", module: "server/management/integration-routes", mutates: true, exempt: { reason: "deferred-verb", why: "Retiring one rollback row is a dashboard-local cleanup; the CLI verb that would drive it is owed by a later work-phase and is not implemented here.", owner: "260904_priority65_closeout WP7", ownerDoc: "devlog/_fin/260904_priority65_closeout/060_wp7_rollback_journal_crud.md" } },
191191
{ method: "POST", path: "/api/client-integrations/restore", module: "server/management/integration-routes", mutates: true },
192192
// server/management/lab-automation-routes
193193
{ method: "GET", path: "/api/lab/automation", module: "server/management/lab-automation-routes", mutates: false, exempt: { reason: "local-transport", why: "ocx lab reads the same rows from the local SQLite projection; src/cli/lab.ts imports ../lab/query directly and never fetches /api/lab." } },
@@ -293,7 +293,7 @@ export const MANAGEMENT_ROUTES: readonly ManagementRoute[] = [
293293
{ method: "PATCH", path: "/api/providers", module: "server/management/provider-routes", mutates: true },
294294
{ method: "POST", path: "/api/providers", module: "server/management/provider-routes", mutates: true },
295295
{ method: "POST", path: "/api/providers/test", module: "server/management/provider-routes", mutates: true },
296-
{ method: "PUT", path: "/api/providers", module: "server/management/provider-routes", mutates: true, exempt: { reason: "deferred-verb", why: "Issue #3280 scopes this atomic batch endpoint to the GUI JSON editor; a matching CLI verb is outside wp5 and remains owed.", owner: "wp5-followup", ownerDoc: "devlog/_plan/260903_bug_drawdown_bcda/050_phase5.md" } },
296+
{ method: "PUT", path: "/api/providers", module: "server/management/provider-routes", mutates: true, exempt: { reason: "deferred-verb", why: "Issue #3280 scopes this atomic batch endpoint to the GUI JSON editor; a matching CLI verb is outside wp5 and remains owed.", owner: "wp5-followup", ownerDoc: "devlog/_fin/260903_bug_drawdown_bcda/050_phase5.md" } },
297297
{ method: "PUT", path: "/api/provider-context-caps", module: "server/management/provider-routes", mutates: true },
298298
// server/management/quota-reset-routes
299299
{ method: "GET", path: "/api/quota-resets", module: "server/management/quota-reset-routes", mutates: false, mechanism: "negated-guard" },
Collapse file

‎src/server/responses/core.ts‎

Copy file name to clipboardExpand all lines: src/server/responses/core.ts
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,6 +2791,10 @@ export async function handleComboResponses(
27912791
logCtx.routeDecision = comboRouteDecisionTrace(config, comboId, pick, requestedModel);
27922792

27932793
let lastFailure: Response | null = null;
2794+
// The exhausted-combo mapping below runs outside the loop, where `failure.upstreamCode`
2795+
// is gone, so carry the loop's own classification decision instead of re-deriving a
2796+
// weaker one from the status alone (#4149).
2797+
let lastFailureClassifiesOverflow = false;
27942798
while (pick) {
27952799
if (options.abortSignal?.aborted) return clientCancelledResponse();
27962800
const childLog: RequestLogContext = {
@@ -3003,6 +3007,7 @@ export async function handleComboResponses(
30033007
const classifyOverflow = failure.response.status === 413
30043008
&& (wantsStream || (failure.upstreamCode !== "outbound_body_too_large"
30053009
&& failure.upstreamCode !== "translation_buffer_limit"));
3010+
lastFailureClassifiesOverflow = classifyOverflow;
30063011
if (storedPool401ReplayDispatched) {
30073012
if (failureDecision === "hop" && unreadableEncryptedAgentTask && !comboPayloadReadable) {
30083013
const recoveredTarget = await pickWithWait({
@@ -3089,9 +3094,11 @@ export async function handleComboResponses(
30893094
}
30903095
if (
30913096
lastFailure?.status === 413
3092-
&& (rawBody as { stream?: unknown } | null)?.stream === true
3097+
&& lastFailureClassifiesOverflow
30933098
) {
3094-
return streamingContextOverflowResponse(requestedModel, options.translatorBudget);
3099+
return (rawBody as { stream?: unknown } | null)?.stream === true
3100+
? streamingContextOverflowResponse(requestedModel, options.translatorBudget)
3101+
: jsonContextOverflowResponse();
30953102
}
30963103
return lastFailure!;
30973104
}
Collapse file

‎tests/responses/responses-context-overflow.test.ts‎

Copy file name to clipboardExpand all lines: tests/responses/responses-context-overflow.test.ts
+65Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ function upstream413(onHit?: () => void): ReturnType<typeof Bun.serve> {
4444
return upstreamStatus(413, onHit);
4545
}
4646

47+
/**
48+
* A 413 whose body carries a per-request free-tier cap. `comboFailureDecision` reads that
49+
* as target-local and hops, so a combo tries every target and then exhausts, which is the
50+
* mapping site this fixture exercises.
51+
*/
52+
function freePromptCap413(onHit?: () => void): ReturnType<typeof Bun.serve> {
53+
const upstream = Bun.serve({
54+
hostname: "127.0.0.1",
55+
port: 0,
56+
fetch() {
57+
onHit?.();
58+
return Response.json({
59+
detail: "err_free_prompt_cap: prompt exceeds this tier; echoed private request marker should-not-reach-client",
60+
}, { status: 413 });
61+
},
62+
});
63+
upstreams.push(upstream);
64+
return upstream;
65+
}
66+
4767
function provider(
4868
adapter: "openai-responses" | "openai-chat" | "anthropic",
4969
upstream: ReturnType<typeof Bun.serve>,
@@ -268,4 +288,49 @@ describe("Responses provider input overflow", () => {
268288
await server.stop(true);
269289
}
270290
});
291+
// A 413 carrying `err_free_prompt_cap` is a per-request free-tier cap, so
292+
// `comboFailureDecision` hops instead of stopping. Every target then refuses and the
293+
// combo falls out of its loop, which is a different mapping site from the "stop" case
294+
// above and was still gated on `stream === true` after #4127 (#4149).
295+
test.each([true, false])("an exhausted combo classifies a hopping 413 (stream=%s)", async stream => {
296+
let firstHits = 0;
297+
let secondHits = 0;
298+
const first = freePromptCap413(() => { firstHits += 1; });
299+
const second = freePromptCap413(() => { secondHits += 1; });
300+
const next = config({
301+
first: provider("openai-chat", first),
302+
second: provider("openai-chat", second),
303+
});
304+
next.combos = {
305+
fallback: {
306+
strategy: "failover",
307+
targets: [
308+
{ provider: "first", model: "kimi-k3" },
309+
{ provider: "second", model: "kimi-k3" },
310+
],
311+
},
312+
};
313+
saveConfig(next);
314+
const server = startServer(0);
315+
try {
316+
const response = await request(String(server.url), "combo/fallback", stream);
317+
if (stream) {
318+
const failed = await responseFailed(response);
319+
expect((failed.error as { code?: string }).code).toBe("context_length_exceeded");
320+
} else {
321+
expect(response.status).toBe(413);
322+
expect(response.headers.get("content-type")).toContain("application/json");
323+
expect(await response.json()).toEqual({ error: {
324+
message: PROVIDER_INPUT_TOO_LARGE_MESSAGE,
325+
type: "invalid_request_error",
326+
code: "context_length_exceeded",
327+
} });
328+
}
329+
// Both targets were tried: this is the exhausted path, not the stop path.
330+
expect(firstHits).toBe(1);
331+
expect(secondHits).toBe(1);
332+
} finally {
333+
await server.stop(true);
334+
}
335+
});
271336
});

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.