@@ -759,6 +759,44 @@ describe("gateway agent handler", () => {
759759 ) ;
760760 } ) ;
761761
762+ it ( "accepts music generation internal events" , async ( ) => {
763+ primeMainAgentRun ( ) ;
764+ mocks . agentCommand . mockClear ( ) ;
765+ const respond = vi . fn ( ) ;
766+
767+ await invokeAgent (
768+ {
769+ message : "music generation finished" ,
770+ sessionKey : "agent:main:main" ,
771+ internalEvents : [
772+ {
773+ type : "task_completion" ,
774+ source : "music_generation" ,
775+ childSessionKey : "music:task-123" ,
776+ childSessionId : "task-123" ,
777+ announceType : "music generation task" ,
778+ taskLabel : "compose a loop" ,
779+ status : "ok" ,
780+ statusLabel : "completed successfully" ,
781+ result : "MEDIA: https://example.test/song.mp3" ,
782+ replyInstruction : "Reply in your normal assistant voice now." ,
783+ } ,
784+ ] ,
785+ idempotencyKey : "music-generation-event" ,
786+ } ,
787+ { reqId : "music-generation-event-1" , respond } ,
788+ ) ;
789+
790+ await waitForAssertion ( ( ) => expect ( mocks . agentCommand ) . toHaveBeenCalled ( ) ) ;
791+ expect ( respond ) . not . toHaveBeenCalledWith (
792+ false ,
793+ undefined ,
794+ expect . objectContaining ( {
795+ message : expect . stringContaining ( "invalid agent params" ) ,
796+ } ) ,
797+ ) ;
798+ } ) ;
799+
762800 it ( "only forwards workspaceDir for spawned sessions with stored workspace inheritance" , async ( ) => {
763801 primeMainAgentRun ( ) ;
764802 mockMainSessionEntry ( {
0 commit comments