@@ -125,6 +125,8 @@ function openTurnWork(
125125 const subagentNodeId = NodeId . make ( `node:subagent:${ input . attemptId } ` ) ;
126126 const childThreadId = providerNativeChildThreadId ( input . threadId ) ;
127127 const grandchildThreadId = providerNativeChildThreadId ( childThreadId ) ;
128+ const childApprovalNodeId = NodeId . make ( `node:child-approval:${ input . attemptId } ` ) ;
129+ const childRequestId = RuntimeRequestId . make ( `request:child-approval:${ input . attemptId } ` ) ;
128130 const requestId = RuntimeRequestId . make ( `request:approval:${ input . attemptId } ` ) ;
129131 return [
130132 {
@@ -235,6 +237,61 @@ function openTurnWork(
235237 result : null ,
236238 } ,
237239 } ,
240+ // The subagent is waiting on an approval in its own thread. Its rows carry
241+ // no run id; the child thread has no runs.
242+ {
243+ type : "node.updated" ,
244+ driver,
245+ node : {
246+ id : childApprovalNodeId ,
247+ threadId : childThreadId ,
248+ runId : null ,
249+ parentNodeId : null ,
250+ rootNodeId : childApprovalNodeId ,
251+ kind : "approval_request" ,
252+ status : "waiting" ,
253+ countsForRun : false ,
254+ providerThreadId : input . providerThread . id ,
255+ providerTurnId,
256+ nativeItemRef : null ,
257+ runtimeRequestId : childRequestId ,
258+ checkpointScopeId : null ,
259+ startedAt : now ,
260+ completedAt : null ,
261+ } ,
262+ } ,
263+ {
264+ type : "runtime_request.updated" ,
265+ driver,
266+ threadId : childThreadId ,
267+ runtimeRequest : {
268+ id : childRequestId ,
269+ nodeId : childApprovalNodeId ,
270+ providerTurnId,
271+ nativeRequestRef : null ,
272+ kind : "command" ,
273+ status : "pending" ,
274+ responseCapability : { type : "live" , providerSessionId } ,
275+ createdAt : now ,
276+ resolvedAt : null ,
277+ } ,
278+ } ,
279+ {
280+ type : "turn_item.updated" ,
281+ driver,
282+ turnItem : {
283+ ...base ,
284+ id : TurnItemId . make ( `turn-item:child-approval:${ input . attemptId } ` ) ,
285+ threadId : childThreadId ,
286+ runId : null ,
287+ nodeId : childApprovalNodeId ,
288+ ordinal : 3 ,
289+ status : "waiting" ,
290+ type : "approval_request" ,
291+ requestId : childRequestId ,
292+ requestKind : "command" ,
293+ } ,
294+ } ,
238295 {
239296 type : "message.updated" ,
240297 driver,
@@ -826,6 +883,7 @@ it.live("settles the work a restarted run inherited when its replacement never o
826883 projection,
827884 nativeChildItems,
828885 nativeChildStreaming,
886+ nativeChildRequests,
829887 nativeGrandchildItems,
830888 delegatedItems,
831889 } = yield * Effect . gen ( function * ( ) {
@@ -990,6 +1048,9 @@ it.live("settles the work a restarted run inherited when its replacement never o
9901048 nativeChildStreaming : ( yield * orchestrator . getThreadProjection (
9911049 providerNativeChildThreadId ( threadId ) ,
9921050 ) ) . messages . some ( ( message ) => message . streaming ) ,
1051+ nativeChildRequests : ( yield * orchestrator . getThreadProjection (
1052+ providerNativeChildThreadId ( threadId ) ,
1053+ ) ) . runtimeRequests . map ( ( request ) => request . status ) ,
9931054 nativeGrandchildItems : openItems (
9941055 yield * orchestrator . getThreadProjection (
9951056 providerNativeChildThreadId ( providerNativeChildThreadId ( threadId ) ) ,
@@ -1025,10 +1086,12 @@ it.live("settles the work a restarted run inherited when its replacement never o
10251086 // The provider-native subagent's own thread ends with the run, and so does
10261087 // the thread of a nested subagent whose row already settled.
10271088 assert . deepEqual ( nativeChildItems , [
1089+ [ "approval_request" , "cancelled" ] ,
10281090 [ "subagent" , "completed" ] ,
10291091 [ "command_execution" , "cancelled" ] ,
10301092 ] ) ;
10311093 assert . isFalse ( nativeChildStreaming ) ;
1094+ assert . deepEqual ( nativeChildRequests , [ "cancelled" ] ) ;
10321095 assert . deepEqual ( nativeGrandchildItems , [ [ "command_execution" , "cancelled" ] ] ) ;
10331096 // The delegated task and its thread keep running.
10341097 assert . deepEqual (
0 commit comments