Skip to content

Commit 506bc9a

Browse files
committed
test(e2e): add Bedrock smoke test for Claude Opus 4.8
Addresses @edelauna's review request on #386 to cover 4.8 in the new Bedrock e2e harness. Mirrors the existing user-agent smoke test but re-points the provider at us.anthropic.claude-opus-4-8. Since 4.8 is an adaptive-thinking model, this exercises the request path that omits temperature (and sends thinking.type "adaptive" when reasoning is enabled), proving a Bedrock round-trip completes without a 400. Runs against the binary-event-stream mock server in CI and against real AWS when BEDROCK_LIVE_E2E=true. The original 4.7-era test is left untouched; model id is overridable via BEDROCK_OPUS_48_MODEL_ID. check-types clean (tsconfig.esm.json).
1 parent 8618f84 commit 506bc9a

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

apps/vscode-e2e/src/suite/providers/bedrock.test.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ const AWS_BEARER_TOKEN_BEDROCK = process.env.AWS_BEARER_TOKEN_BEDROCK
88
const BEDROCK_REGION = process.env.BEDROCK_REGION ?? "us-east-1"
99
// Use a cross-region inference profile so the token works without per-region model access.
1010
const BEDROCK_MODEL_ID = process.env.BEDROCK_MODEL_ID ?? "us.anthropic.claude-haiku-4-5-20251001-v1:0"
11+
// Claude Opus 4.8 routed through a cross-region inference profile. 4.8 is an
12+
// adaptive-thinking model, so this exercises the request path that omits
13+
// temperature and (when reasoning is enabled) sends thinking.type "adaptive".
14+
const BEDROCK_OPUS_48_MODEL_ID = process.env.BEDROCK_OPUS_48_MODEL_ID ?? "us.anthropic.claude-opus-4-8"
1115
const BEDROCK_LIVE_E2E = process.env.BEDROCK_LIVE_E2E === "true"
1216

1317
suite("Bedrock provider", function () {
@@ -91,4 +95,53 @@ suite("Bedrock provider", function () {
9195
assert.ok(true, "Task completed successfully via Bedrock with ZooCode# userAgentAppId")
9296
}
9397
})
98+
99+
test("Should complete a task end-to-end via AWS Bedrock using Claude Opus 4.8", async () => {
100+
const api = globalThis.api
101+
102+
// Re-point the provider at Claude Opus 4.8 while keeping the same transport
103+
// (mock server in CI, real AWS in live mode). Parity smoke test: it proves the
104+
// 4.8 request path — model resolution, adaptive-thinking payload, and the
105+
// temperature omission required by 4.7+ — completes a Bedrock round-trip
106+
// without a 400. The mock server replies with the same attempt_completion("4")
107+
// tool call regardless of model, so a successful completion exercises request
108+
// formation end-to-end.
109+
if (!process.env.AIMOCK_URL && BEDROCK_LIVE_E2E && AWS_BEARER_TOKEN_BEDROCK) {
110+
await api.setConfiguration({
111+
apiProvider: "bedrock" as const,
112+
awsUseApiKey: true,
113+
awsApiKey: AWS_BEARER_TOKEN_BEDROCK,
114+
awsRegion: BEDROCK_REGION,
115+
apiModelId: BEDROCK_OPUS_48_MODEL_ID,
116+
})
117+
} else {
118+
await api.setConfiguration({
119+
apiProvider: "bedrock" as const,
120+
awsUseApiKey: true,
121+
awsApiKey: "mock-key",
122+
awsRegion: BEDROCK_REGION,
123+
apiModelId: BEDROCK_OPUS_48_MODEL_ID,
124+
awsBedrockEndpoint: mockServer!.url,
125+
awsBedrockEndpointEnabled: true,
126+
})
127+
}
128+
129+
const taskId = await api.startNewTask({
130+
configuration: { mode: "ask", autoApprovalEnabled: true },
131+
text: "bedrock-opus-48-smoke: what is 2+2? Reply with only the number.",
132+
})
133+
134+
await waitUntilCompleted({ api, taskId })
135+
136+
if (mockServer) {
137+
// The request reached the Bedrock endpoint (no 400 from temperature/thinking).
138+
const userAgent = mockServer.lastRequestHeaders?.["user-agent"] as string | undefined
139+
assert.ok(userAgent, "Bedrock request should include user-agent header")
140+
assert.ok(userAgent.includes("ZooCode#"), `user-agent should contain "ZooCode#" — got: ${userAgent}`)
141+
} else {
142+
// Live mode: a successful round-trip proves 4.8 request formation works
143+
// against real AWS Bedrock (adaptive thinking, no rejected sampling params).
144+
assert.ok(true, "Task completed successfully via Bedrock with Claude Opus 4.8")
145+
}
146+
})
94147
})

0 commit comments

Comments
 (0)