@@ -835,6 +835,35 @@ describe("gateway agent handler", () => {
835835 ) ;
836836 } ) ;
837837
838+ it ( "accepts Paperclip adapter's root-level paperclip metadata" , async ( ) => {
839+ primeMainAgentRun ( ) ;
840+ mocks . agentCommand . mockClear ( ) ;
841+ const respond = vi . fn ( ) ;
842+
843+ await invokeAgent (
844+ {
845+ message : "Paperclip wake event" ,
846+ sessionKey : "paperclip" ,
847+ idempotencyKey : "paperclip-test" ,
848+ paperclip : {
849+ runId : "paperclip-run-123" ,
850+ agentId : "test-agent" ,
851+ companyId : "test-company" ,
852+ } ,
853+ } ,
854+ { reqId : "paperclip-test-1" , respond } ,
855+ ) ;
856+
857+ await waitForAssertion ( ( ) => expect ( mocks . agentCommand ) . toHaveBeenCalled ( ) ) ;
858+ expect ( respond ) . not . toHaveBeenCalledWith (
859+ false ,
860+ undefined ,
861+ expect . objectContaining ( {
862+ message : expect . stringContaining ( "invalid agent params" ) ,
863+ } ) ,
864+ ) ;
865+ } ) ;
866+
838867 it ( "does not create task rows for inter-session completion wakes" , async ( ) => {
839868 primeMainAgentRun ( ) ;
840869 mocks . agentCommand . mockClear ( ) ;
@@ -1052,9 +1081,7 @@ describe("gateway agent handler", () => {
10521081 expect ( mocks . performGatewaySessionReset ) . toHaveBeenCalledTimes ( 1 ) ;
10531082 const call = readLastAgentCommandCall ( ) ;
10541083 // Message is now dynamically built with current date — check key substrings
1055- expect ( call ?. message ) . toContain (
1056- "If runtime-provided startup context is included for this first turn" ,
1057- ) ;
1084+ expect ( call ?. message ) . toContain ( "Execute your Session Startup sequence now" ) ;
10581085 expect ( call ?. message ) . toContain ( "Current time:" ) ;
10591086 expect ( call ?. message ) . not . toBe ( BARE_SESSION_RESET_PROMPT ) ;
10601087 expect ( call ?. sessionId ) . toBe ( "reset-session-id" ) ;
0 commit comments