Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/server/responses/passthrough-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ import { recordCodexUpstreamOutcome } from "../../codex/routing";
import { describeUpstreamConnectFailure } from "./upstream-error";
import type { OpaqueBlobRecoveryGuard } from "./core-opaque-recovery";
import {
isOpenCodeGoDestination,
rateLimitRetryPolicyFor,
rateLimitRetryDelayMs,
transientRetryPolicyFor,
Expand Down Expand Up @@ -882,12 +881,6 @@ export async function preparePassthroughExchange(
{ abortSignal: upstream.signal, label: safeHostLabel(request.url),
attempts: remainingTransientSendBudget(transientSendAttempts()), onSendsConsumed: noteTransientSends,
claimAmbiguousResend: claimPreHeaderResend,
// The OpenCode Go destination stalls-then-drops inference sends (ambiguous
// pre-header resets surfacing as refused 429s); its subscription traffic is
// inference-only, so a bounded reset replay here absorbs the blip instead of
// failing the turn. Recovery legs keep the fail-closed refusal; only this
// initial send is replay-eligible. Attempts stay budget-bounded via attempts.
replaySafe: isOpenCodeGoDestination(route.provider),
},
);
} catch (err) {
Expand Down
10 changes: 4 additions & 6 deletions tests/responses/responses-passthrough-transient-policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ describe("a configured ladder is bounded by the request budget", () => {
});
});

const goPacked = dense(readResponsesCoreModule("passthrough-dispatch.ts"));
describe("the Go destination replays ambiguous resets on the initial send", () => {
test("replaySafe is destination-scoped to exactly one leg", () => {
expect(occurrences(goPacked, "replaySafe:isOpenCodeGoDestination(route.provider)")).toBe(1);
});
});
// The OpenCode Go replaySafe exception is gone for good: the behavioral contract is pinned
// by an execution test in responses-send-budget-counts.test.ts ("an OpenCode Go destination
// refuses an ambiguous pre-answer reset instead of replaying"), which fails if any name for
// the option ever returns.
21 changes: 21 additions & 0 deletions tests/responses/responses-send-budget-counts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,27 @@ describe("ambiguous reset safety across Responses recovery", () => {
expect((await response.json()).error.code).toBe("upstream_reset_replay_refused");
expect(sends).toBe(1);
});

test("an OpenCode Go destination refuses an ambiguous pre-answer reset instead of replaying", async () => {
// The removed replaySafe exception let the first send to this destination retry a
// dropped inference once. With it gone the destination behaves like every other:
// reset before the answer -> refusal 429, exactly one send on the wire.
const config = {
defaultProvider: "go",
providers: { go: transientChatProvider("go", { baseUrl: "https://opencode.ai/zen/go/v1" }) },
} as unknown as OcxConfig;
let sends = 0;
globalThis.fetch = (async () => {
sends += 1;
throw Object.assign(new Error("The socket connection was closed unexpectedly."), { code: "ECONNRESET" });
}) as typeof fetch;
const logCtx: RequestLogContext = { model: "", provider: "" };
takeSpendHome();
const response = await handleResponses(responsesRequest("go/model-go"), config, logCtx);
expect(response.status).toBe(429);
expect((await response.json()).error.code).toBe("upstream_reset_replay_refused");
expect(sends).toBe(1);
});
});

describe("ambiguous reset safety after outer recovery", () => {
Expand Down
Loading