Skip to content

Commit b745aef

Browse files
author
Zoo (VP)
committed
fix(vscode-e2e): capture ask tool messages and complete Turn 2 in mimo-parallel test
1 parent 8d52e02 commit b745aef

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

‎apps/vscode-e2e/src/suite/mimo-parallel.test.ts‎

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,45 @@ function buildToolCallSseBody(model: string, behavior: MockBehavior): string {
172172
return chunks.join("")
173173
}
174174

175+
function buildCompletionSseBody(model: string): string {
176+
const chunks: string[] = []
177+
178+
const first = baseChunk(model)
179+
first.choices[0]!.delta = {
180+
role: "assistant",
181+
tool_calls: [
182+
toolCallDelta(0, {
183+
id: "call_completion_ccc",
184+
type: "function",
185+
function: { name: "attempt_completion", arguments: "" },
186+
}),
187+
],
188+
}
189+
chunks.push(sseChunk(first))
190+
191+
const firstArgs = baseChunk(model)
192+
firstArgs.choices[0]!.delta = {
193+
tool_calls: [
194+
toolCallDelta(0, {
195+
function: {
196+
arguments: JSON.stringify({
197+
result: "MIMO_PARALLEL_TEST_COMPLETE",
198+
}),
199+
},
200+
}),
201+
],
202+
}
203+
chunks.push(sseChunk(firstArgs))
204+
205+
const finish = baseChunk(model)
206+
finish.choices[0]!.delta = {}
207+
;(finish.choices[0]! as { finish_reason: string | null }).finish_reason = "tool_calls"
208+
chunks.push(sseChunk(finish))
209+
chunks.push("data: [DONE]\n\n")
210+
211+
return chunks.join("")
212+
}
213+
175214
async function withMimoMockServer<T>(
176215
behavior: MockBehavior,
177216
run: (args: { baseUrl: string; requests: CapturedMimoRequest[] }) => Promise<T>,
@@ -209,7 +248,10 @@ async function withMimoMockServer<T>(
209248
rawBody: bodyText,
210249
})
211250

212-
const sse = buildToolCallSseBody(body.model ?? MIMO_MODEL_ID, behavior)
251+
const sse =
252+
requests.length >= 2
253+
? buildCompletionSseBody(body.model ?? MIMO_MODEL_ID)
254+
: buildToolCallSseBody(body.model ?? MIMO_MODEL_ID, behavior)
213255
res.writeHead(200, {
214256
"Content-Type": "text/event-stream",
215257
"Cache-Control": "no-cache",
@@ -268,7 +310,7 @@ suite("MiMo Parallel Tool Call Enforcement", function () {
268310

269311
const messages: ClineMessage[] = []
270312
const messageHandler = ({ message }: { message: ClineMessage }) => {
271-
if (message.type === "say" && message.partial !== true) {
313+
if (message && message.partial !== true) {
272314
messages.push(message)
273315
}
274316
}
@@ -301,6 +343,7 @@ suite("MiMo Parallel Tool Call Enforcement", function () {
301343
const sawToolMessage = messages.some(
302344
(m) =>
303345
m.say === "tool" ||
346+
m.ask === "tool" ||
304347
m.say === "error" ||
305348
m.say === "completion_result" ||
306349
m.ask === "api_req_failed",

0 commit comments

Comments
 (0)