@@ -66,6 +66,7 @@ describe('Task Event-Driven Scheduler', () => {
6666 handler ( {
6767 type : MessageBusType . TOOL_CALLS_UPDATE ,
6868 toolCalls : [ toolCall ] ,
69+ schedulerId : 'task-id' ,
6970 } ) ;
7071
7172 expect ( mockEventBus . publish ) . toHaveBeenCalledWith (
@@ -106,6 +107,7 @@ describe('Task Event-Driven Scheduler', () => {
106107 handler ( {
107108 type : MessageBusType . TOOL_CALLS_UPDATE ,
108109 toolCalls : [ toolCall ] ,
110+ schedulerId : 'task-id' ,
109111 } ) ;
110112
111113 // Simulate A2A client confirmation
@@ -148,7 +150,11 @@ describe('Task Event-Driven Scheduler', () => {
148150 const handler = ( messageBus . subscribe as Mock ) . mock . calls . find (
149151 ( call : unknown [ ] ) => call [ 0 ] === MessageBusType . TOOL_CALLS_UPDATE ,
150152 ) ?. [ 1 ] ;
151- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall ] } ) ;
153+ handler ( {
154+ type : MessageBusType . TOOL_CALLS_UPDATE ,
155+ toolCalls : [ toolCall ] ,
156+ schedulerId : 'task-id' ,
157+ } ) ;
152158
153159 // Simulate Rejection (Cancel)
154160 const handled = await (
@@ -174,7 +180,11 @@ describe('Task Event-Driven Scheduler', () => {
174180 correlationId : 'corr-2' ,
175181 confirmationDetails : { type : 'info' , title : 'test' , prompt : 'test' } ,
176182 } ;
177- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall2 ] } ) ;
183+ handler ( {
184+ type : MessageBusType . TOOL_CALLS_UPDATE ,
185+ toolCalls : [ toolCall2 ] ,
186+ schedulerId : 'task-id' ,
187+ } ) ;
178188
179189 // Simulate ModifyWithEditor
180190 const handled2 = await (
@@ -215,7 +225,11 @@ describe('Task Event-Driven Scheduler', () => {
215225 const handler = ( messageBus . subscribe as Mock ) . mock . calls . find (
216226 ( call : unknown [ ] ) => call [ 0 ] === MessageBusType . TOOL_CALLS_UPDATE ,
217227 ) ?. [ 1 ] ;
218- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall ] } ) ;
228+ handler ( {
229+ type : MessageBusType . TOOL_CALLS_UPDATE ,
230+ toolCalls : [ toolCall ] ,
231+ schedulerId : 'task-id' ,
232+ } ) ;
219233
220234 // Simulate ProceedOnce for MCP
221235 const handled = await (
@@ -255,7 +269,11 @@ describe('Task Event-Driven Scheduler', () => {
255269 const handler = ( messageBus . subscribe as Mock ) . mock . calls . find (
256270 ( call : unknown [ ] ) => call [ 0 ] === MessageBusType . TOOL_CALLS_UPDATE ,
257271 ) ?. [ 1 ] ;
258- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall ] } ) ;
272+ handler ( {
273+ type : MessageBusType . TOOL_CALLS_UPDATE ,
274+ toolCalls : [ toolCall ] ,
275+ schedulerId : 'task-id' ,
276+ } ) ;
259277
260278 const handled = await (
261279 task as unknown as {
@@ -294,7 +312,11 @@ describe('Task Event-Driven Scheduler', () => {
294312 const handler = ( messageBus . subscribe as Mock ) . mock . calls . find (
295313 ( call : unknown [ ] ) => call [ 0 ] === MessageBusType . TOOL_CALLS_UPDATE ,
296314 ) ?. [ 1 ] ;
297- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall ] } ) ;
315+ handler ( {
316+ type : MessageBusType . TOOL_CALLS_UPDATE ,
317+ toolCalls : [ toolCall ] ,
318+ schedulerId : 'task-id' ,
319+ } ) ;
298320
299321 const handled = await (
300322 task as unknown as {
@@ -333,7 +355,11 @@ describe('Task Event-Driven Scheduler', () => {
333355 const handler = ( messageBus . subscribe as Mock ) . mock . calls . find (
334356 ( call : unknown [ ] ) => call [ 0 ] === MessageBusType . TOOL_CALLS_UPDATE ,
335357 ) ?. [ 1 ] ;
336- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall ] } ) ;
358+ handler ( {
359+ type : MessageBusType . TOOL_CALLS_UPDATE ,
360+ toolCalls : [ toolCall ] ,
361+ schedulerId : 'task-id' ,
362+ } ) ;
337363
338364 const handled = await (
339365 task as unknown as {
@@ -376,7 +402,11 @@ describe('Task Event-Driven Scheduler', () => {
376402 const handler = ( yoloMessageBus . subscribe as Mock ) . mock . calls . find (
377403 ( call : unknown [ ] ) => call [ 0 ] === MessageBusType . TOOL_CALLS_UPDATE ,
378404 ) ?. [ 1 ] ;
379- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall ] } ) ;
405+ handler ( {
406+ type : MessageBusType . TOOL_CALLS_UPDATE ,
407+ toolCalls : [ toolCall ] ,
408+ schedulerId : 'task-id' ,
409+ } ) ;
380410
381411 // Should NOT auto-publish ProceedOnce anymore, because PolicyEngine handles it directly
382412 expect ( yoloMessageBus . publish ) . not . toHaveBeenCalledWith (
@@ -419,6 +449,7 @@ describe('Task Event-Driven Scheduler', () => {
419449 handler ( {
420450 type : MessageBusType . TOOL_CALLS_UPDATE ,
421451 toolCalls : [ toolCall ] ,
452+ schedulerId : 'task-id' ,
422453 } ) ;
423454
424455 // Should publish artifact update for output
@@ -453,7 +484,11 @@ describe('Task Event-Driven Scheduler', () => {
453484 const handler = ( messageBus . subscribe as Mock ) . mock . calls . find (
454485 ( call : unknown [ ] ) => call [ 0 ] === MessageBusType . TOOL_CALLS_UPDATE ,
455486 ) ?. [ 1 ] ;
456- handler ( { type : MessageBusType . TOOL_CALLS_UPDATE , toolCalls : [ toolCall ] } ) ;
487+ handler ( {
488+ type : MessageBusType . TOOL_CALLS_UPDATE ,
489+ toolCalls : [ toolCall ] ,
490+ schedulerId : 'task-id' ,
491+ } ) ;
457492
458493 // The tool should be complete and registered appropriately, eventually
459494 // triggering the toolCompletionPromise resolution when all clear.
@@ -533,6 +568,7 @@ describe('Task Event-Driven Scheduler', () => {
533568 handler ( {
534569 type : MessageBusType . TOOL_CALLS_UPDATE ,
535570 toolCalls : [ toolCall1 , toolCall2 ] ,
571+ schedulerId : 'task-id' ,
536572 } ) ;
537573
538574 // Confirm first tool call
@@ -600,6 +636,7 @@ describe('Task Event-Driven Scheduler', () => {
600636 handler ( {
601637 type : MessageBusType . TOOL_CALLS_UPDATE ,
602638 toolCalls : [ toolCall1 , toolCall2 ] ,
639+ schedulerId : 'task-id' ,
603640 } ) ;
604641
605642 // Should NOT transition to input-required yet
@@ -621,6 +658,7 @@ describe('Task Event-Driven Scheduler', () => {
621658 handler ( {
622659 type : MessageBusType . TOOL_CALLS_UPDATE ,
623660 toolCalls : [ toolCall1Complete , toolCall2 ] ,
661+ schedulerId : 'task-id' ,
624662 } ) ;
625663
626664 // Now it should transition
0 commit comments