Skip to content

Commit f756aab

Browse files
committed
test(e2e): settle expected display says before detaching listener (CI event race)
CI e2e-mock failed 2 !== 3 on "exactly three thinkingEffort display says": the final display say is observed on the Message channel after the TaskCompleted event resolved waitUntilCompleted (separate event channels, no cross-channel ordering guarantee; under CI load the queue lags by more than one turn). Await the expected says with a bounded settle (5s, 100ms) before detaching the listener: a genuine shortfall still fails the same assertion, the race no longer does.
1 parent 2983975 commit f756aab

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RooCodeEventName, type ClineMessage } from "@roo-code/types"
44

55
import { withOpenRouterCaptureProxy, type CapturedDteRequest } from "./thinking-effort-proxy"
66
import { setDefaultSuiteTimeout } from "./test-utils"
7-
import { waitUntilCompleted } from "./utils"
7+
import { waitUntilCompleted, waitFor } from "./utils"
88

99
/**
1010
* DTE addendum: set_thinking_effort switching within a single task.
@@ -131,7 +131,19 @@ suite("set_thinking_effort switching within a task (DTE addendum)", function ()
131131
text: SWITCH_MARKER + ": manage the thinking effort for this task",
132132
})
133133

134+
const countEffortSays = () =>
135+
messages.filter(
136+
({ say, text }) => say === "tool" && typeof text === "string" && text.includes("thinkingEffort"),
137+
).length
138+
134139
await waitUntilCompleted({ api, taskId })
140+
141+
// Event delivery race: the final display say can be observed after the
142+
// TaskCompleted event (separate event channels, no cross-channel
143+
// ordering guarantee). Settle the expected display says before
144+
// detaching the listener; a genuine shortfall still fails below.
145+
await waitFor(() => countEffortSays() >= 3, { timeout: 5_000, interval: 100 })
146+
135147
api.off(RooCodeEventName.Message, onMessage)
136148

137149
// (a) Real boundary: the task completes after the full switching sequence.

0 commit comments

Comments
 (0)