11use codex_core:: CodexAuth ;
2+ use codex_core:: ContentItem ;
23use codex_core:: ConversationManager ;
4+ use codex_core:: LocalShellAction ;
5+ use codex_core:: LocalShellExecAction ;
6+ use codex_core:: LocalShellStatus ;
37use codex_core:: ModelClient ;
48use codex_core:: ModelProviderInfo ;
59use codex_core:: NewConversation ;
@@ -15,6 +19,7 @@ use codex_core::protocol::Op;
1519use codex_core:: spawn:: CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR ;
1620use codex_protocol:: mcp_protocol:: ConversationId ;
1721use codex_protocol:: models:: ReasoningItemReasoningSummary ;
22+ use codex_protocol:: models:: WebSearchAction ;
1823use core_test_support:: load_default_config_for_test;
1924use core_test_support:: load_sse_fixture_with_id;
2025use core_test_support:: wait_for_event;
@@ -699,6 +704,45 @@ async fn azure_responses_request_includes_store_and_reasoning_ids() {
699704 } ] ) ,
700705 encrypted_content : None ,
701706 } ) ;
707+ prompt. input . push ( ResponseItem :: Message {
708+ id : Some ( "message-id" . into ( ) ) ,
709+ role : "assistant" . into ( ) ,
710+ content : vec ! [ ContentItem :: OutputText {
711+ text: "message" . into( ) ,
712+ } ] ,
713+ } ) ;
714+ prompt. input . push ( ResponseItem :: WebSearchCall {
715+ id : Some ( "web-search-id" . into ( ) ) ,
716+ status : Some ( "completed" . into ( ) ) ,
717+ action : WebSearchAction :: Search {
718+ query : "weather" . into ( ) ,
719+ } ,
720+ } ) ;
721+ prompt. input . push ( ResponseItem :: FunctionCall {
722+ id : Some ( "function-id" . into ( ) ) ,
723+ name : "do_thing" . into ( ) ,
724+ arguments : "{}" . into ( ) ,
725+ call_id : "function-call-id" . into ( ) ,
726+ } ) ;
727+ prompt. input . push ( ResponseItem :: LocalShellCall {
728+ id : Some ( "local-shell-id" . into ( ) ) ,
729+ call_id : Some ( "local-shell-call-id" . into ( ) ) ,
730+ status : LocalShellStatus :: Completed ,
731+ action : LocalShellAction :: Exec ( LocalShellExecAction {
732+ command : vec ! [ "echo" . into( ) , "hello" . into( ) ] ,
733+ timeout_ms : None ,
734+ working_directory : None ,
735+ env : None ,
736+ user : None ,
737+ } ) ,
738+ } ) ;
739+ prompt. input . push ( ResponseItem :: CustomToolCall {
740+ id : Some ( "custom-tool-id" . into ( ) ) ,
741+ status : Some ( "completed" . into ( ) ) ,
742+ call_id : "custom-tool-call-id" . into ( ) ,
743+ name : "custom_tool" . into ( ) ,
744+ input : "{}" . into ( ) ,
745+ } ) ;
702746
703747 let mut stream = client
704748 . stream ( & prompt)
@@ -722,10 +766,13 @@ async fn azure_responses_request_includes_store_and_reasoning_ids() {
722766
723767 assert_eq ! ( body[ "store" ] , serde_json:: Value :: Bool ( true ) ) ;
724768 assert_eq ! ( body[ "stream" ] , serde_json:: Value :: Bool ( true ) ) ;
725- assert_eq ! (
726- body[ "input" ] [ 0 ] [ "id" ] ,
727- serde_json:: Value :: String ( "reasoning-id" . into( ) )
728- ) ;
769+ assert_eq ! ( body[ "input" ] . as_array( ) . map( Vec :: len) , Some ( 6 ) ) ;
770+ assert_eq ! ( body[ "input" ] [ 0 ] [ "id" ] . as_str( ) , Some ( "reasoning-id" ) ) ;
771+ assert_eq ! ( body[ "input" ] [ 1 ] [ "id" ] . as_str( ) , Some ( "message-id" ) ) ;
772+ assert_eq ! ( body[ "input" ] [ 2 ] [ "id" ] . as_str( ) , Some ( "web-search-id" ) ) ;
773+ assert_eq ! ( body[ "input" ] [ 3 ] [ "id" ] . as_str( ) , Some ( "function-id" ) ) ;
774+ assert_eq ! ( body[ "input" ] [ 4 ] [ "id" ] . as_str( ) , Some ( "local-shell-id" ) ) ;
775+ assert_eq ! ( body[ "input" ] [ 5 ] [ "id" ] . as_str( ) , Some ( "custom-tool-id" ) ) ;
729776}
730777
731778#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
0 commit comments