@@ -150,6 +150,18 @@ describe("fx sub-agent hooks", () => {
150150 status : "success" ,
151151 } ) ,
152152 } ,
153+ {
154+ hook : hook ( CHILD , "tool.start" , {
155+ call : call ( "call_nested" , "subagent" , '{"action":"run","task":"Check scripts"}' ) ,
156+ } ) ,
157+ } ,
158+ {
159+ hook : hook ( CHILD , "tool.end" , {
160+ call : call ( "call_nested" , "subagent" ) ,
161+ output : '{"ok":true,"result":"Scripts checked"}' ,
162+ status : "success" ,
163+ } ) ,
164+ } ,
153165 { hook : hook ( CHILD , "model.start" , { modelCallId : 2 , purpose : "permission_review" } ) } ,
154166 { hook : hook ( CHILD , "model.end" , { modelCallId : 2 , output : "allow" , toolCalls : [ { } ] } ) } ,
155167 { hook : hook ( CHILD , "model.start" , { modelCallId : 3 , purpose : "agent" } ) } ,
@@ -168,10 +180,28 @@ describe("fx sub-agent hooks", () => {
168180 "tool_call call_read in_progress" ,
169181 "tool_call_update call_read completed" ,
170182 "tool_call_update call_read completed" ,
183+ "tool_call call_nested in_progress" ,
184+ "tool_call_update call_nested completed" ,
171185 `agent_message result: ${ REPLY } ` ,
172186 ] ) ;
173187 const read = run . delivered [ 1 ] ?. update ;
174188 assert . deepInclude ( read , { kind : "read" , rawInput : { path : "package.json" } } ) ;
189+ let nested : AcpToolCallState | undefined ;
190+ for ( const notification of run . delivered . slice ( 4 , 6 ) ) {
191+ for ( const event of parseSessionUpdateEvent ( notification ) . events ) {
192+ if ( event . _tag !== "ToolCallUpdated" ) continue ;
193+ nested = mergeToolCallState ( nested , event . toolCall ) ;
194+ assert . isUndefined ( extractFxSubagentUpdate ( nested ) ) ;
195+ }
196+ }
197+ assert . deepInclude ( nested , {
198+ toolCallId : "call_nested" ,
199+ status : "completed" ,
200+ title : "subagent" ,
201+ } ) ;
202+ assert . deepInclude ( nested ?. data , {
203+ rawInput : { action : "run" , task : "Check scripts" } ,
204+ } ) ;
175205 // fx completes the ACP call before it reports the whole result.
176206 assert . deepEqual ( run . statuses , [
177207 "running" ,
0 commit comments