@@ -256,7 +256,23 @@ describe("CursorAdapterV2", () => {
256256 "Cursor Agent SDK run.wait failed: Too many requests (resource_exhausted, HTTP 429)" ,
257257 } ,
258258 } ,
259- ] ) ( "fails the turn with $reason" , ( { wait, failure } ) =>
259+ {
260+ reason : "a transport dump sent after earlier commentary" ,
261+ updates : [
262+ { type : "text-delta" , text : "Checking the build first." } ,
263+ { type : "step-completed" , stepId : 1 , stepDurationMs : 1 } ,
264+ { type : "text-delta" , text : "Error: RetriableError: WritableIterable is closed" } ,
265+ ] satisfies ReadonlyArray < InteractionUpdate > ,
266+ wait : Effect . succeed ( {
267+ id : "native-cursor-run" ,
268+ requestId : "native-request" ,
269+ status : "finished" as const ,
270+ model : { id : "claude-fable-5" } ,
271+ durationMs : 1 ,
272+ } ) ,
273+ failure : { class : "transport_error" , message : "Provider turn failed." } ,
274+ } ,
275+ ] ) ( "fails the turn with $reason" , ( { updates = [ ] , wait, failure } ) =>
260276 Effect . gen ( function * ( ) {
261277 const fileSystem = yield * FileSystem . FileSystem ;
262278 const workspace = yield * fileSystem . makeTempDirectoryScoped ( { prefix : "cursor-v2-failure-" } ) ;
@@ -280,12 +296,17 @@ describe("CursorAdapterV2", () => {
280296 agentId : "native-cursor-failure" ,
281297 listMessages : Effect . succeed ( [ ] ) ,
282298 close : Effect . void ,
283- send : ( ) =>
284- Effect . succeed ( {
285- agentId : "native-cursor-failure" ,
286- runId : "native-cursor-run" ,
287- wait,
288- cancel : Effect . void ,
299+ send : ( input ) =>
300+ Effect . gen ( function * ( ) {
301+ for ( const update of updates ) {
302+ yield * input . onDelta ! ( update ) . pipe ( Effect . orDie ) ;
303+ }
304+ return {
305+ agentId : "native-cursor-failure" ,
306+ runId : "native-cursor-run" ,
307+ wait,
308+ cancel : Effect . void ,
309+ } ;
289310 } ) ,
290311 } ) ,
291312 } ) ,
0 commit comments