Skip to content

Commit ba2bbd3

Browse files
committed
test(e2e): mock + real-endpoint mode for anthropic-tool-results-repro
1 parent 9b3736e commit ba2bbd3

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

apps/vscode-e2e/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ TEST_FILE=<your-test>.test.js pnpm --filter @roo-code/vscode-e2e test:ci
273273
that is what flips the test into real-endpoint mode. `TEST_FILE` is required so unrelated suites
274274
don't burn through the real API.
275275
276+
**Self-skip conditions** — the test skips (rather than fails) in two situations: (1) neither
277+
`ANTHROPIC_API_KEY` nor `AIMOCK_URL` is set (the test has no API to talk to); (2) real-endpoint
278+
mode only: the model used fewer than two parallel tool calls, which means the codepath under test
279+
was never exercised and a green result would be inconclusive.
280+
276281
## Programmatic fixtures (regex matching)
277282
278283
For requests that can't be matched by a stable substring (e.g. "starts with `<environment_details>` but not preceded by a user message"), add a programmatic fixture in `src/runTest.ts` using `mock.addFixture()` with a `RegExp` match. These are only available in replay mode and are not recorded.

apps/vscode-e2e/src/suite/anthropic-tool-results-repro.test.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ANTHROPIC_API_ORIGIN = "https://api.anthropic.com"
2424
// across API wording tweaks.
2525
const TOOL_RESULT_CONTRACT_ERROR = "tool_use ids were found without tool_result blocks"
2626

27-
// IDs the matching fixture (apps/vscode-e2e/fixtures/anthropic-tool-results-repro.json)
27+
// IDs the matching fixture (apps/vscode-e2e/fixtures/claude-tool-results-repro.json)
2828
// emits for the four parallel read_file tool calls on turn 1. Kept in sync with that file.
2929
const FIXTURE_TOOL_USE_IDS = [
3030
"toolu_repro_190_read_1",
@@ -358,17 +358,12 @@ suite("Anthropic tool_result repro", function () {
358358
}
359359

360360
// Mock mode: aimock serves the fixture (4 parallel read_file toolCalls on turn 1,
361-
// attempt_completion on turn 2). Wait for the second /v1/messages and assert it
362-
// carries 4 matching tool_result IDs.
363-
await waitFor(() => taskCompleted || requests.length >= 2, {
361+
// attempt_completion on turn 2). Wait for both the second /v1/messages request
362+
// and task completion before asserting.
363+
await waitFor(() => taskCompleted && requests.length >= 2, {
364364
timeout: 120_000,
365365
interval: 250,
366366
})
367-
await waitFor(() => requests.length >= 2, { timeout: 30_000, interval: 250 })
368-
369-
if (!taskCompleted) {
370-
await waitFor(() => taskCompleted, { timeout: 30_000, interval: 250 })
371-
}
372367

373368
const secondRequest = requests[1]
374369
assert.ok(secondRequest, "Expected Anthropic repro to issue a second /v1/messages request")

0 commit comments

Comments
 (0)