Skip to content

Commit dae4374

Browse files
myk1ytedelauna
authored andcommitted
test(e2e): poll restart task-history presence before asserting
What: runVerify now gates the Task should be present after restart assertion on a bounded waitForTaskInHistory poll that uses the same api.isTaskInHistory read as the assertion, instead of a single unguarded read immediately after isReady. Why: the e2e-mock lane failed on da8d752 with exactly this assertion (false !== true) while the same commit passed 6/6 local runs and the changed production paths cannot execute during the scenario (watchdog tick 60s vs ~2s phases; the sidebar dispose scoping is behavior-identical for the single watched view). The read races the persisted state becoming observable on a fresh host, the same swap-window failure class documented in Zoo-Code-Org#1641 for this scenario, which Zoo-Code-Org#1663 fixed for the conversation-history reads but left the isTaskInHistory read single-shot. Polling with the same read removes the false negative without touching production code, keeping the CodeRabbit-requested recovery and dispose guarantees intact.
1 parent 13f8ef0 commit dae4374

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎apps/vscode-e2e/src/suite/restart-persistence.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ async function waitForMarkedCompletion(api: RooCodeAPI, taskId: string): Promise
3535
)
3636
}
3737

38+
async function waitForTaskInHistory(api: RooCodeAPI, taskId: string): Promise<void> {
39+
// Poll the same read the assertion uses. A single read can observe the
40+
// persisted state before it is visible on a fresh host (the atomic-rename
41+
// swap window documented in #1641), so gate the assertion on a bounded
42+
// wait instead of failing on the first miss.
43+
await waitFor(() => api.isTaskInHistory(taskId))
44+
}
45+
3846
async function runCreate(api: RooCodeAPI): Promise<void> {
3947
let taskId: string | undefined
4048
let createPhasePassed = false
@@ -99,6 +107,7 @@ async function runVerify(api: RooCodeAPI): Promise<void> {
99107
api.on(RooCodeEventName.Message, messageHandler)
100108

101109
await waitFor(() => api.isReady())
110+
await waitForTaskInHistory(api, taskId)
102111
assert.strictEqual(await api.isTaskInHistory(taskId), true, "Task should be present after restart")
103112
const historyItem = await api.getTaskHistoryItem(taskId)
104113
assert.ok(historyItem, "Task history item should be available after restart")

0 commit comments

Comments
 (0)