Skip to content

Commit bbec2f9

Browse files
committed
fix(e2e): match post-tool DTE request by model + tool result
The aimock toolCallId matcher only inspects the LAST message of the request. The post-tool request ends with a role:user message (fresh environment details appended after the tool result), so the second fixture could never match and every request returned 404 No fixture matched. Match the follow-up on the DTE-only model (openai/gpt-5) plus hasToolResult, with turnIndex 1 tie-breaking the two requests, and remove the temporary DTE-DEBUG capture.
1 parent 42b423d commit bbec2f9

2 files changed

Lines changed: 9 additions & 60 deletions

File tree

‎apps/vscode-e2e/fixtures/thinking-effort-tool.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@
1616
}
1717
},
1818
{
19+
// The post-tool request ends with a role:user message (fresh environment details
20+
// appended after the tool result), so aimock's toolCallId matcher — which only
21+
// inspects the LAST message — can never match it. Scope by the DTE-only model plus
22+
// the presence of a tool-result message (turnIndex 1 tie-breaks the two requests).
1923
"match": {
20-
"toolCallId": "call_dte_e2e_001"
24+
"model": "openai/gpt-5",
25+
"hasToolResult": true,
26+
"turnIndex": 1
2127
},
2228
"response": {
2329
"toolCalls": [

‎apps/vscode-e2e/src/suite/thinking-effort-tool.test.ts‎

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ async function withOpenRouterCaptureProxy<T>(
152152
const requestUrl = req.url ?? "/"
153153

154154
if (!isChatCompletionsUrl("http://127.0.0.1" + requestUrl)) {
155-
// DTE-DEBUG (temporary): log non-chat requests (e.g. model catalog) the proxy sees.
156-
console.error("DTE-DEBUG non-chat", req.method, requestUrl)
157155
res.writeHead(404)
158156
res.end("Not found")
159157
return
@@ -172,18 +170,6 @@ async function withOpenRouterCaptureProxy<T>(
172170
lastUserMessage,
173171
})
174172

175-
// DTE-DEBUG (temporary): log every chat request the proxy sees.
176-
console.error(
177-
"DTE-DEBUG chat",
178-
JSON.stringify({
179-
url: requestUrl,
180-
model: body.model,
181-
reasoning: body.reasoning,
182-
roles: (body.messages ?? []).map((message) => message.role),
183-
lastUserMessage: lastUserMessage.slice(0, 200),
184-
}),
185-
)
186-
187173
const forwardHeaders: Record<string, string> = {}
188174
for (const [key, value] of Object.entries(req.headers)) {
189175
if (!HOP_BY_HOP.has(key.toLowerCase()) && value !== undefined) {
@@ -285,51 +271,8 @@ suite("set_thinking_effort mid-task workflow (DTE addendum)", function () {
285271
text: APPLY_MARKER + ": answer the math question",
286272
})
287273

288-
try {
289-
await waitUntilCompleted({ api, taskId })
290-
} finally {
291-
api.off(RooCodeEventName.Message, onMessage)
292-
293-
// DTE-DEBUG (temporary): dump aimock's request journal and the proxy's
294-
// captured requests so a failure reveals the exact request shapes that
295-
// the aimock matcher saw.
296-
try {
297-
const journalResponse = await fetch(aimockUrl + "/v1/_requests?limit=20")
298-
const journal = (await journalResponse.json()) as Array<{
299-
method?: string
300-
path?: string
301-
body?: { model?: string; messages?: Array<{ role?: string; content?: unknown }> }
302-
response?: { status?: number }
303-
}>
304-
for (const entry of journal.slice(-10)) {
305-
const entries = entry.body?.messages ?? []
306-
const lastUser = [...entries].reverse().find((message) => message.role === "user")
307-
const text =
308-
typeof lastUser?.content === "string"
309-
? lastUser.content
310-
: JSON.stringify(lastUser?.content ?? "")
311-
console.error(
312-
"DTE-DEBUG aimock-journal",
313-
entry.method,
314-
entry.path,
315-
"model=" + String(entry.body?.model ?? "?"),
316-
"status=" + String(entry.response?.status ?? "?"),
317-
"lastUserMessage=" + text.slice(0, 200),
318-
)
319-
}
320-
console.error(
321-
"DTE-DEBUG captured",
322-
JSON.stringify(
323-
requests.map((request) => ({
324-
model: request.model,
325-
lastUserMessage: request.lastUserMessage.slice(0, 200),
326-
})),
327-
),
328-
)
329-
} catch (error) {
330-
console.error("DTE-DEBUG journal fetch failed", error)
331-
}
332-
}
274+
await waitUntilCompleted({ api, taskId })
275+
api.off(RooCodeEventName.Message, onMessage)
333276

334277
// (a) Real boundary: the task completes with the math answer after the
335278
// mid-task tool round trip.

0 commit comments

Comments
 (0)