@@ -5,6 +5,7 @@ import { type ClineMessage, type ExtensionState, RooCodeEventName } from "@roo-c
55import * as autoApprovalModule from "../../auto-approval"
66import { createRateLimitClock } from "../RateLimitClock"
77import { Task } from "../Task"
8+ import { setAbortLatch } from "../../../test-utils/run-state"
89
910// The streaming-loop drive below never asserts on environment details; the
1011// real collector reaches into the VS Code window API, which this file's
@@ -31,7 +32,7 @@ type ProviderStub = {
3132
3233function buildTask ( provider : ProviderStub , taskCwd : string ) {
3334 const task = Object . create ( Task . prototype ) as Task
34- task [ "abort" ] = false
35+ setAbortLatch ( task , false )
3536 task [ "clineMessages" ] = [ ]
3637 task [ "askResponse" ] = undefined
3738 task [ "askResponseText" ] = undefined
@@ -743,7 +744,7 @@ describe("Task.ask queue path cannot bypass blanket deny", () => {
743744 await vi . waitFor ( ( ) => expect ( getStateCalls ) . toBe ( 2 ) )
744745 expect ( queue . hasUnclaimed ( ) ) . toBe ( false )
745746
746- task [ "abort" ] = true
747+ setAbortLatch ( task , true )
747748
748749 // `ask()` must reject on abort; racing a deadline distinguishes a wrong
749750 // settle from a hang on the pending read.
@@ -830,7 +831,7 @@ describe("Task.ask queue path cannot bypass blanket deny", () => {
830831 // longer this wait runs, the less event-loop-stall slack is left before
831832 // the 2 s timer could legitimately fire while the task is still live.
832833 await vi . waitFor ( ( ) => expect ( Date . now ( ) - armedAt ) . toBeGreaterThanOrEqual ( 300 ) , { timeout : 2_000 } )
833- task [ "abort" ] = true
834+ setAbortLatch ( task , true )
834835
835836 const outcome = await toolAsk . then (
836837 ( ) => "resolved" ,
@@ -931,7 +932,7 @@ describe("Task.ask queue path cannot bypass blanket deny", () => {
931932 await vi . waitFor ( ( ) => expect ( getStateCalls ) . toBe ( 2 ) )
932933 expect ( queue . hasUnclaimed ( ) ) . toBe ( false )
933934
934- task [ "abort" ] = true
935+ setAbortLatch ( task , true )
935936
936937 // `ask()` must reject on abort; racing a deadline distinguishes a wrong
937938 // settle from a hang on the pending read.
@@ -993,7 +994,7 @@ describe("Task.ask queue path cannot bypass blanket deny", () => {
993994 await vi . waitFor ( ( ) => expect ( getStateCalls ) . toBe ( 2 ) )
994995 expect ( queue . hasUnclaimed ( ) ) . toBe ( false )
995996
996- task [ "abort" ] = true
997+ setAbortLatch ( task , true )
997998
998999 // `ask()` must reject on abort; racing a deadline distinguishes a wrong
9991000 // settle from a hang on the pending read.
0 commit comments