@@ -2402,7 +2402,7 @@ it.layer(Layer.merge(layerTest, ProviderContinuationRequests.layer))(
24022402
24032403 const finishFollowup = ( input : {
24042404 readonly name : string ;
2405- readonly startedBy : "background-command" | "parent" ;
2405+ readonly startedBy : "background-command" | "parent" | "user" ;
24062406 /** The parent steers a message into the follow-up's run before it answers. */
24072407 readonly steeredByParent ?: boolean ;
24082408 readonly result : "repeat" | "new" ;
@@ -2520,11 +2520,15 @@ it.layer(Layer.merge(layerTest, ProviderContinuationRequests.layer))(
25202520 }
25212521 : {
25222522 type : "message.dispatch" ,
2523- createdBy : "agent" ,
2524- creationSource : "mcp" ,
25252523 commandId : CommandId . make ( `command:${ name } -followup` ) ,
25262524 threadId : child . childThreadId ,
2527- senderThreadId : parentThreadId ,
2525+ ...( input . startedBy === "user"
2526+ ? { createdBy : "user" as const , creationSource : "web" as const }
2527+ : {
2528+ createdBy : "agent" as const ,
2529+ creationSource : "mcp" as const ,
2530+ senderThreadId : parentThreadId ,
2531+ } ) ,
25282532 messageId,
25292533 text : "Check the same work again." ,
25302534 attachments : [ ] ,
@@ -2675,11 +2679,11 @@ it.layer(Layer.merge(layerTest, ProviderContinuationRequests.layer))(
26752679 } ) ,
26762680 ) ;
26772681
2678- it . effect ( "a parent -sent repeat still wakes", ( ) =>
2682+ it . effect . each ( [ "parent" , "user" ] as const ) ( "a %s -sent repeat still wakes", ( startedBy ) =>
26792683 Effect . gen ( function * ( ) {
26802684 const { followup, delivery } = yield * finishFollowup ( {
2681- name : " followup-parent -repeat" ,
2682- startedBy : "parent" ,
2685+ name : ` followup-${ startedBy } -repeat` ,
2686+ startedBy,
26832687 result : "repeat" ,
26842688 } ) ;
26852689 assert . equal ( followup . completionDelivery ?. state , "claimed" ) ;
@@ -3589,14 +3593,15 @@ it.layer(layerTest)("delegated tasks across a server restart", (it) => {
35893593 ) ;
35903594
35913595 it . effect . each ( [
3592- { origin : "provider_native" , state : "delivered" } ,
3593- { origin : "app_owned" , state : "claimed" } ,
3594- ] as const ) ( "a cut delivery run whose only item is a $origin subagent ends $state" , ( input ) =>
3596+ { item : "provider_native subagent" , state : "delivered" } ,
3597+ { item : "app_owned subagent" , state : "claimed" } ,
3598+ { item : "question" , state : "delivered" } ,
3599+ ] as const ) ( "a cut delivery run whose only item is a $item ends $state" , ( input ) =>
35953600 Effect . gen ( function * ( ) {
35963601 const orchestrator = yield * Orchestrator . OrchestratorV2 ;
35973602 const eventSink = yield * EventSink . EventSinkV2 ;
35983603 const now = yield * DateTime . now ;
3599- const name = `delivery-cut-${ input . origin } ` ;
3604+ const name = `delivery-cut-${ input . item . replace ( " " , "-" ) } ` ;
36003605 const threadId = ThreadId . make ( `thread:${ name } ` ) ;
36013606 const runId = RunId . make ( `run:${ name } ` ) ;
36023607 const taskId = NodeId . make ( `node:${ name } -task` ) ;
@@ -3659,14 +3664,26 @@ it.layer(layerTest)("delegated tasks across a server restart", (it) => {
36593664 startedAt : now ,
36603665 completedAt : null ,
36613666 updatedAt : now ,
3662- type : "subagent" ,
3663- subagentId : NodeId . make ( `node:${ name } -launched` ) ,
3664- origin : input . origin ,
3665- driver,
3666- providerInstanceId : modelSelection . instanceId ,
3667- childThreadId : null ,
3668- prompt : "Check the merged findings." ,
3669- result : null ,
3667+ ...( input . item === "question"
3668+ ? {
3669+ type : "user_input_request" as const ,
3670+ requestId : RuntimeRequestId . make ( `request:${ name } ` ) ,
3671+ questions : [ ] ,
3672+ responseMode : "message" as const ,
3673+ }
3674+ : {
3675+ type : "subagent" as const ,
3676+ subagentId : NodeId . make ( `node:${ name } -launched` ) ,
3677+ origin :
3678+ input . item === "provider_native subagent"
3679+ ? ( "provider_native" as const )
3680+ : ( "app_owned" as const ) ,
3681+ driver,
3682+ providerInstanceId : modelSelection . instanceId ,
3683+ childThreadId : null ,
3684+ prompt : "Check the merged findings." ,
3685+ result : null ,
3686+ } ) ,
36703687 } ,
36713688 } ,
36723689 runEvent ( {
0 commit comments