fix(sse): re-align stream-readiness-policy tests with minimax's openai format

PR #9463 switched minimax/minimax-cn from claude to openai format so images
work. The stream-readiness bump for Claude-format replicas is keyed off the
registry's format field (single source of truth), so minimax legitimately
falls out of that group now. Swap the "Claude-format replica" test fixtures
to agentrouter (still format: "claude") and add explicit coverage that
minimax no longer gets the claude_format_heavy_reasoning bump.
This commit is contained in:
diegosouzapw
2026-08-05 19:59:32 -03:00
parent aebd481607
commit f52b60d846

View File

@@ -145,14 +145,14 @@ test("preserves zero timeout so readiness checks can be disabled", () => {
assert.deepEqual(result.reasons, ["disabled"]);
});
test("bumps small requests to third-party Claude-format replicas (Minimax M3, ZAI, bailian, agentrouter) — guards against #3825-class false 504s on long reasoning warm-ups", () => {
// Provider registry lists Minimax with `format: "claude"` — the readiness budget
test("bumps small requests to third-party Claude-format replicas (agentrouter, ZAI, bailian) — guards against #3825-class false 504s on long reasoning warm-ups", () => {
// Provider registry lists agentrouter with `format: "claude"` — the readiness budget
// must fire UNCONDITIONALLY for those replicas, like the codex_gpt_5_5_high
// bump, because their reasoning warm-ups routinely exceed the default 80s window.
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
provider: "minimax",
model: "MiniMax-M3",
provider: "agentrouter",
model: "claude-opus-4-8",
body: { messages: items(3), tools: tools(2) },
});
@@ -163,6 +163,23 @@ test("bumps small requests to third-party Claude-format replicas (Minimax M3, ZA
);
});
test("does NOT bump Minimax (M3) — #3110 moved it from claude to openai format so images work, and the readiness bump is keyed off the registry's `format: \"claude\"` field", () => {
// Minimax's replica quirk (long reasoning warm-up) hasn't changed, but this
// policy intentionally keys off the translator format, not the provider
// name — the registry is the single source of truth (see isClaudeFormatReasoningProvider
// doc comment). Now that minimax routes through the OpenAI translator, it no
// longer matches, mirroring the OpenAI/non-Claude exclusion below.
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
provider: "minimax",
model: "MiniMax-M3",
body: { messages: items(3), tools: tools(2) },
});
assert.equal(result.timeoutMs, 80_000);
assert.ok(!result.reasons.includes("claude_format_heavy_reasoning"));
});
test("bumps ZAI (claude-format replica) readiness budget the same way", () => {
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
@@ -213,13 +230,13 @@ test("does NOT double-bump when codex-high reasoning and Claude-format replica b
// Claude-format providers later, the readiness bump must not stack.
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
provider: "minimax",
model: "MiniMax-M3-high",
provider: "agentrouter",
model: "claude-opus-4-8-high",
body: { messages: items(3), tools: tools(2), reasoning_effort: "high" },
});
// Should be bumped by exactly one reason — claude_format_heavy_reasoning —
// because minimax is not a codex provider, the codex_* path never fires.
// because agentrouter is not a codex provider, the codex_* path never fires.
assert.equal(result.timeoutMs, 110_000);
assert.ok(result.reasons.includes("claude_format_heavy_reasoning"));
assert.ok(!result.reasons.includes("codex_gpt_5_5_high_reasoning"));
@@ -229,8 +246,8 @@ test("caps Claude-format replica bump at the configured maxTimeoutMs", () => {
const result = resolveStreamReadinessTimeout({
baseTimeoutMs: 80_000,
maxTimeoutMs: 100_000,
provider: "minimax",
model: "MiniMax-M3",
provider: "agentrouter",
model: "claude-opus-4-8",
body: { messages: items(500), tools: tools(20), instructions: "x".repeat(800_000) },
});