@@ -380,6 +380,48 @@ suite('ByokLmProxyService', () => {
380380 } ) ;
381381 } ) ;
382382
383+ test ( 'preserves full stateless replay when no resumable provider state is reported' , async ( ) => {
384+ const captured : IByokLmChatRequest [ ] = [ ] ;
385+ const initialInput = [ { type : 'message' , role : 'user' , content : [ { type : 'input_text' , text : 'Use the tool.' } ] } ] ;
386+ const replayedInput = [
387+ ...initialInput ,
388+ { type : 'function_call' , call_id : 'call_1' , name : 'tool' , arguments : '{}' } ,
389+ { type : 'function_call_output' , call_id : 'call_1' , output : 'done' } ,
390+ ] ;
391+
392+ await withProxy (
393+ async request => {
394+ captured . push ( request ) ;
395+ return captured . length === 1
396+ ? { output : [ { type : 'function_call' , callId : 'call_1' , name : 'tool' , argumentsJson : '{}' } ] }
397+ : { output : [ { type : 'message' , content : [ { type : 'text' , text : 'done' } ] } ] } ;
398+ } ,
399+ async handle => {
400+ for ( const input of [ initialInput , replayedInput ] ) {
401+ const response = await fetch ( responsesUrl ( handle , 'acme' ) , {
402+ method : 'POST' ,
403+ headers : authHeaders ( handle ) ,
404+ body : JSON . stringify ( { model : 'm' , input } ) ,
405+ } ) ;
406+ assert . strictEqual ( response . status , 200 ) ;
407+ await response . text ( ) ;
408+ }
409+ } ,
410+ ) ;
411+
412+ assert . deepStrictEqual ( {
413+ previousResponseId : captured [ 1 ] ?. previousResponseId ,
414+ input : captured [ 1 ] ?. input ,
415+ } , {
416+ previousResponseId : undefined ,
417+ input : [
418+ { type : 'message' , role : 'user' , content : [ { type : 'text' , text : 'Use the tool.' } ] } ,
419+ { type : 'function_call' , callId : 'call_1' , name : 'tool' , argumentsJson : '{}' } ,
420+ { type : 'function_call_output' , callId : 'call_1' , output : 'done' } ,
421+ ] ,
422+ } ) ;
423+ } ) ;
424+
383425 test ( 'bounds abandoned tool continuations while preserving recent state' , async ( ) => {
384426 const captured : IByokLmChatRequest [ ] = [ ] ;
385427 const maximumPendingContinuations = 256 ;
0 commit comments