@@ -1025,9 +1025,31 @@ it.effect("a partial delegated Stop retries only the original children that fail
10251025 const parentThreadId = ThreadId . make ( "thread:stop-partial" ) ;
10261026 yield * createWatchingThread ( parentThreadId , 6 ) ;
10271027 yield * send ( parentThreadId , "work" , "start_immediately" ) ;
1028+ const rootRefused = yield * threads
1029+ . dispatch ( {
1030+ type : "thread.stop" ,
1031+ commandId : CommandId . make ( "stop-root-above-limit" ) ,
1032+ threadId : parentThreadId ,
1033+ } )
1034+ . pipe (
1035+ Effect . provideService ( DispatchModeLimit , {
1036+ runtimeMode : "approval-required" ,
1037+ interactionMode : "default" ,
1038+ } ) ,
1039+ Effect . exit ,
1040+ ) ;
1041+ assert . isTrue ( Exit . isFailure ( rootRefused ) ) ;
1042+ assert . deepEqual ( ( yield * threadState ( parentThreadId ) ) . runs , [ "starting" ] ) ;
10281043 const blockedChild = yield * delegate ( parentThreadId , "default task" ) ;
10291044 const advancedChild = yield * delegate ( parentThreadId , "default task that advances" ) ;
10301045 const stoppedChild = yield * delegate ( parentThreadId , "plan task" ) ;
1046+ const blockedGrandchild = yield * delegate ( stoppedChild , "broader grandchild" ) ;
1047+ yield * orchestrator . dispatch ( {
1048+ type : "thread.runtime-mode.set" ,
1049+ commandId : CommandId . make ( "approval-child" ) ,
1050+ threadId : stoppedChild ,
1051+ runtimeMode : "approval-required" ,
1052+ } ) ;
10311053 yield * orchestrator . dispatch ( {
10321054 type : "thread.interaction-mode.set" ,
10331055 commandId : CommandId . make ( "plan-child" ) ,
@@ -1038,14 +1060,15 @@ it.effect("a partial delegated Stop retries only the original children that fail
10381060 yield * orchestrator . dispatch ( { type : "thread.stop" , commandId, threadId : parentThreadId } ) ;
10391061 const walked = yield * threads . stopDelegatedTasks ( { threadId : parentThreadId , commandId } ) . pipe (
10401062 Effect . provideService ( DispatchModeLimit , {
1041- runtimeMode : "full-access " ,
1063+ runtimeMode : "approval-required " ,
10421064 interactionMode : "plan" ,
10431065 } ) ,
10441066 Effect . exit ,
10451067 ) ;
10461068 assert . isTrue ( Exit . isFailure ( walked ) ) ;
10471069 assert . deepEqual ( ( yield * threadState ( stoppedChild ) ) . runs , [ "interrupted" ] ) ;
10481070 assert . deepEqual ( ( yield * threadState ( blockedChild ) ) . runs , [ "starting" ] ) ;
1071+ assert . deepEqual ( ( yield * threadState ( blockedGrandchild ) ) . runs , [ "starting" ] ) ;
10491072
10501073 yield * orchestrator . dispatch ( {
10511074 type : "thread.stop" ,
@@ -1059,6 +1082,7 @@ it.effect("a partial delegated Stop retries only the original children that fail
10591082 const newChild = yield * delegate ( parentThreadId , "new child" ) ;
10601083 yield * threads . stopDelegatedTasks ( { threadId : parentThreadId , commandId } ) ;
10611084 assert . deepEqual ( ( yield * threadState ( blockedChild ) ) . runs , [ "interrupted" ] ) ;
1085+ assert . deepEqual ( ( yield * threadState ( blockedGrandchild ) ) . runs , [ "interrupted" ] ) ;
10621086 assert . deepEqual ( ( yield * threadState ( stoppedChild ) ) . runs , [ "interrupted" , "starting" ] ) ;
10631087 assert . deepEqual ( ( yield * threadState ( advancedChild ) ) . runs , [ "interrupted" , "starting" ] ) ;
10641088 assert . deepEqual ( ( yield * threadState ( newChild ) ) . runs , [ "starting" ] ) ;
0 commit comments