From 42f41aa78a5a24b9e2d9925b5f8c1f3a30efed11 Mon Sep 17 00:00:00 2001 From: Eric Litman Date: Sat, 3 Oct 2026 14:53:22 -0400 Subject: [PATCH] test(e2e): native Messages on Sonnet now passes; drop the OSWE-278 known failure (MASTRA-768) OSWE-278 is fixed. In a controlled A/B on studio2 a few minutes apart, native non-streaming POST /v1/messages on claude-sonnet-4-6 returned 429 {"type":"error","error":{"type":"rate_limit_error","message":"Error"}} on CLIProxyAPI 7.3.17 and 200 with a normal message on v8.0.13-mob.1. The live test now asserts 200, the trace header and a completed message. The isOswe278 predicate and the optional known-failure parameter of live() existed only for this test and are deleted. Co-Authored-By: Claude Opus 5.5 --- e2e/lib/live.ts | 21 ++++++------------- e2e/tests/live.e2e.ts | 48 ++++++++++++++----------------------------- 2 files changed, 21 insertions(+), 48 deletions(-) diff --git a/e2e/lib/live.ts b/e2e/lib/live.ts index a4cd0918..6fb44f67 100644 --- a/e2e/lib/live.ts +++ b/e2e/lib/live.ts @@ -1,8 +1,7 @@ import { AgentError, expect } from 'e2e'; -// Tiny input at the lowest effort answers in seconds; OSWE-278's 429 takes about 10.5 s (one -// proxy retry). 60 s leaves headroom and stays under the runner's 120 s test timeout, so a -// stall surfaces as this request's error, not as TEST_TIMEOUT. +// Tiny input at the lowest effort answers in seconds. 60 s leaves headroom and stays under the +// runner's 120 s test timeout, so a stall surfaces as this request's error, not as TEST_TIMEOUT. const BOUND_MS = 60_000; type Request = { body?: unknown; headers?: Record; keyless?: boolean }; @@ -10,14 +9,9 @@ type Request = { body?: unknown; headers?: Record; keyless?: boo /** * Sends one request to CLIPROXY_LIVE_URL and classifies failures that are not the product's: * missing inputs and a rejected key are configuration (exit 2); an unreachable proxy and a - * provider 429 or 5xx are infrastructure (exit 3). `known` accepts a failure the test asserts - * itself, matched on status and body. + * provider 429 or 5xx are infrastructure (exit 3). */ -export async function live( - path: string, - request: Request = {}, - known?: (status: number, body: string) => boolean, -) { +export async function live(path: string, request: Request = {}) { const base = process.env.CLIPROXY_LIVE_URL; if (!base) throw new AgentError('TEST_SETUP_FAILED', 'CLIPROXY_LIVE_URL is not set'); const key = process.env.CLIPROXY_CLIENT_KEY; @@ -48,11 +42,8 @@ export async function live( throw new AgentError('AUTH_CREDENTIAL_INVALID', `${path} rejected CLIPROXY_CLIENT_KEY (401)`); } if (status === 429 || status >= 500) { - const text = await response.clone().text(); - if (!known?.(status, text)) { - const excerpt = text.slice(0, 300); - throw new AgentError('ENVIRONMENT_UNAVAILABLE', `${path} answered ${status}: ${excerpt}`); - } + const excerpt = (await response.text()).slice(0, 300); + throw new AgentError('ENVIRONMENT_UNAVAILABLE', `${path} answered ${status}: ${excerpt}`); } return { response, signal }; } diff --git a/e2e/tests/live.e2e.ts b/e2e/tests/live.e2e.ts index 6950f947..f24107e8 100644 --- a/e2e/tests/live.e2e.ts +++ b/e2e/tests/live.e2e.ts @@ -108,36 +108,18 @@ test('live: Responses on claude-sonnet-4-6 completes', onLive, async () => { expect((await response.json()).status).toBe('completed'); }); -// OSWE-278's response as captured from studio2. A genuine rate limit carries a descriptive -// message, so it stays an infrastructure failure (exit 3). -const isOswe278 = (status: number, body: string) => { - try { - const { error } = JSON.parse(body); - return status === 429 && error?.type === 'rate_limit_error' && error?.message === 'Error'; - } catch { - return false; - } -}; - -// Known failure: this asserts the bug. When OSWE-278 is fixed the status changes and the test -// fails visibly; then assert 200 here instead. -test( - 'live: OSWE-278 known failure, native Messages on claude-sonnet-4-6 returns 429', - onLive, - async () => { - const { response } = await live( - '/v1/messages', - { - body: { - model: 'claude-sonnet-4-6', - max_tokens: 16, - messages: [{ role: 'user', content: say }], - }, - headers: anthropic, - }, - isOswe278, - ); - expect(response.status).toBe(429); - expect((await response.json()).error).toEqual({ type: 'rate_limit_error', message: 'Error' }); - }, -); +test('live: native Messages on claude-sonnet-4-6 completes', onLive, async () => { + const { response } = await live('/v1/messages', { + body: { + model: 'claude-sonnet-4-6', + max_tokens: 16, + messages: [{ role: 'user', content: say }], + }, + headers: anthropic, + }); + expect(response.status).toBe(200); + expectTrace(response); + const message = await response.json(); + expect(message.type).toBe('message'); + expect(message.stop_reason).toBe('end_turn'); +});