@@ -278,7 +278,50 @@ describe('deserialize helpers', () => {
278278 functions : [ ] ,
279279 handoffs : [ ] ,
280280 computerActions : [ { toolCall : call , computer : tool } ] ,
281- mcpApprovalRequests : [ ] ,
281+ mcpApprovalRequests : [
282+ {
283+ requestItem : {
284+ rawItem : {
285+ type : 'hosted_tool_call' ,
286+ name : 'fetch_generic_url_content' ,
287+ status : 'in_progress' ,
288+ providerData : {
289+ id : 'mcpr_685bc3c47ed88192977549b5206db77504d4306d5de6ab36' ,
290+ type : 'mcp_approval_request' ,
291+ arguments :
292+ '{"url":"https://raw.githubusercontent.com/openai/codex/main/README.md"}' ,
293+ name : 'fetch_generic_url_content' ,
294+ server_label : 'gitmcp' ,
295+ } ,
296+ } ,
297+ type : 'tool_approval_item' ,
298+ agent : new Agent ( { name : 'foo ' } ) ,
299+ toJSON : function ( ) : any {
300+ throw new Error ( 'Function not implemented.' ) ;
301+ } ,
302+ } ,
303+ mcpTool : {
304+ type : 'hosted_tool' ,
305+ name : 'hosted_mcp' ,
306+ providerData : {
307+ type : 'mcp' ,
308+ server_label : 'gitmcp' ,
309+ server_url : 'https://gitmcp.io/openai/codex' ,
310+ require_approval : {
311+ always : {
312+ tool_names : [ 'fetch_generic_url_content' ] ,
313+ } ,
314+ never : {
315+ tool_names : [
316+ 'search_codex_code' ,
317+ 'fetch_codex_documentation' ,
318+ ] ,
319+ } ,
320+ } ,
321+ } ,
322+ } ,
323+ } ,
324+ ] ,
282325 toolsUsed : [ ] ,
283326 hasToolsOrApprovalsToRun : ( ) => true ,
284327 } ;
@@ -292,5 +335,15 @@ describe('deserialize helpers', () => {
292335 if ( restored . _currentStep ?. type === 'next_step_handoff' ) {
293336 expect ( restored . _currentStep . newAgent ) . toBe ( agent ) ;
294337 }
338+ expect (
339+ restored . _lastProcessedResponse ?. mcpApprovalRequests [ 0 ] . mcpTool ,
340+ ) . toEqual ( state . _lastProcessedResponse ?. mcpApprovalRequests [ 0 ] . mcpTool ) ;
341+ expect (
342+ restored . _lastProcessedResponse ?. mcpApprovalRequests [ 0 ] . requestItem
343+ . rawItem . providerData ,
344+ ) . toEqual (
345+ state . _lastProcessedResponse ?. mcpApprovalRequests [ 0 ] . requestItem . rawItem
346+ . providerData ,
347+ ) ;
295348 } ) ;
296349} ) ;
0 commit comments