@@ -88,6 +88,7 @@ function makeRunReplyAgentParams(
8888 commandBody : prompt ,
8989 followupRun : createMockFollowupRun ( {
9090 prompt,
91+ summaryLine : prompt ,
9192 run : {
9293 agentId : "main" ,
9394 agentDir : "/tmp/agent" ,
@@ -216,6 +217,7 @@ describe("runReplyAgent media path normalization", () => {
216217
217218 expect ( queueEmbeddedPiMessageMock ) . toHaveBeenLastCalledWith ( "session" , "generate chart" , {
218219 steeringMode : "all" ,
220+ toolCallSteeringBehavior : "inject" ,
219221 } ) ;
220222
221223 await runReplyAgent (
@@ -228,9 +230,72 @@ describe("runReplyAgent media path normalization", () => {
228230
229231 expect ( queueEmbeddedPiMessageMock ) . toHaveBeenLastCalledWith ( "session" , "generate chart" , {
230232 steeringMode : "one-at-a-time" ,
233+ toolCallSteeringBehavior : "inject" ,
231234 } ) ;
232235 } ) ;
233236
237+ it ( "steers active embedded runs even when the busy snapshot is not streaming" , async ( ) => {
238+ queueEmbeddedPiMessageMock . mockReturnValue ( true ) ;
239+
240+ await runReplyAgent (
241+ makeRunReplyAgentParams ( {
242+ resolvedQueue : { mode : "steer" } as QueueSettings ,
243+ shouldSteer : true ,
244+ isActive : true ,
245+ isStreaming : false ,
246+ } ) ,
247+ ) ;
248+
249+ expect ( queueEmbeddedPiMessageMock ) . toHaveBeenCalledWith ( "session" , "generate chart" , {
250+ steeringMode : "all" ,
251+ toolCallSteeringBehavior : "inject" ,
252+ } ) ;
253+ expect ( enqueueFollowupRunMock ) . not . toHaveBeenCalled ( ) ;
254+ expect ( runEmbeddedPiAgentMock ) . not . toHaveBeenCalled ( ) ;
255+ } ) ;
256+
257+ it ( "falls back to follow-up queue when active-run steering cannot be delivered" , async ( ) => {
258+ queueEmbeddedPiMessageMock . mockReturnValue ( false ) ;
259+
260+ await runReplyAgent (
261+ makeRunReplyAgentParams ( {
262+ resolvedQueue : { mode : "steer" } as QueueSettings ,
263+ shouldSteer : true ,
264+ isActive : true ,
265+ isStreaming : false ,
266+ isRunActive : ( ) => true ,
267+ } ) ,
268+ ) ;
269+
270+ expect ( queueEmbeddedPiMessageMock ) . toHaveBeenCalledWith ( "session" , "generate chart" , {
271+ steeringMode : "all" ,
272+ toolCallSteeringBehavior : "inject" ,
273+ } ) ;
274+ expect ( enqueueFollowupRunMock ) . toHaveBeenCalledTimes ( 1 ) ;
275+ expect ( runEmbeddedPiAgentMock ) . not . toHaveBeenCalled ( ) ;
276+ } ) ;
277+
278+ it ( "interrupts remaining tool calls for stop-like active-run steering" , async ( ) => {
279+ queueEmbeddedPiMessageMock . mockReturnValue ( true ) ;
280+
281+ await runReplyAgent (
282+ makeRunReplyAgentParams ( {
283+ prompt : "stop" ,
284+ resolvedQueue : { mode : "steer" } as QueueSettings ,
285+ shouldSteer : true ,
286+ isActive : true ,
287+ isStreaming : false ,
288+ } ) ,
289+ ) ;
290+
291+ expect ( queueEmbeddedPiMessageMock ) . toHaveBeenCalledWith ( "session" , "stop" , {
292+ steeringMode : "all" ,
293+ toolCallSteeringBehavior : "interrupt" ,
294+ } ) ;
295+ expect ( enqueueFollowupRunMock ) . not . toHaveBeenCalled ( ) ;
296+ expect ( runEmbeddedPiAgentMock ) . not . toHaveBeenCalled ( ) ;
297+ } ) ;
298+
234299 it ( "shares one media cache between block accumulation and final payload delivery" , async ( ) => {
235300 let stagedIndex = 0 ;
236301 resolveOutboundAttachmentFromUrlMock . mockImplementation ( async ( mediaUrl : string ) => {
0 commit comments