@@ -17,6 +17,7 @@ import {
1717 SUBTASK_API_HANG_PARENT_PROMPT ,
1818 SUBTASK_API_HANG_PARENT_RESULT ,
1919 SUBTASK_API_HANG_RESUME_MESSAGE ,
20+ SUBTASK_API_HANG_RESPONSE_LATENCY_MS ,
2021 SUBTASK_CHILD_FOLLOWUP_ANSWER ,
2122 SUBTASK_FAST_CHILD_RESULT ,
2223 SUBTASK_FAST_PARENT_PROMPT ,
@@ -72,6 +73,12 @@ const waitForAimockRequestContaining = async (expectedText: string, excludeText?
7273suite ( "Roo Code Subtasks" , function ( ) {
7374 setDefaultSuiteTimeout ( this )
7475
76+ // Task cancellation aborts the client request asynchronously. Let the extension host
77+ // finish disposing it before the next test reuses the mock server.
78+ teardown ( async ( ) => {
79+ await sleep ( 1_500 )
80+ } )
81+
7582 test ( "child completing on its first response returns to parent" , async ( ) => {
7683 const api = globalThis . api
7784 const says : Record < string , ClineMessage [ ] > = { }
@@ -580,6 +587,9 @@ suite("Roo Code Subtasks", function () {
580587 await api . clearCurrentTask ( )
581588 }
582589 await waitFor ( ( ) => api . getCurrentTaskStack ( ) . length === 0 ) . catch ( ( ) => { } )
590+ // aimock does not cancel delayed server-side streams when the client aborts.
591+ // Drain this fixture before the next test can open another streamed request.
592+ await sleep ( SUBTASK_API_HANG_RESPONSE_LATENCY_MS )
583593 }
584594 } )
585595
0 commit comments