diff --git a/src/server/responses/passthrough-dispatch.ts b/src/server/responses/passthrough-dispatch.ts index 7bd9b64253c..abce5dbf406 100644 --- a/src/server/responses/passthrough-dispatch.ts +++ b/src/server/responses/passthrough-dispatch.ts @@ -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, @@ -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) { diff --git a/tests/responses/responses-passthrough-transient-policy.test.ts b/tests/responses/responses-passthrough-transient-policy.test.ts index 211d30d1ed7..c2ccf954785 100644 --- a/tests/responses/responses-passthrough-transient-policy.test.ts +++ b/tests/responses/responses-passthrough-transient-policy.test.ts @@ -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. diff --git a/tests/responses/responses-send-budget-counts.test.ts b/tests/responses/responses-send-budget-counts.test.ts index b97e6f57832..b741792ed3c 100644 --- a/tests/responses/responses-send-budget-counts.test.ts +++ b/tests/responses/responses-send-budget-counts.test.ts @@ -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", () => {