File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1549,7 +1549,7 @@ impl Session {
15491549 async fn fail_agent_identity_registration ( self : & Arc < Self > , error : anyhow:: Error ) {
15501550 warn ! ( error = %error, "agent identity registration failed" ) ;
15511551 let message = format ! (
1552- "Agent identity registration failed. Codex cannot continue while `features.use_agent_identity` is enabled: {error}"
1552+ "Agent identity registration failed while `features.use_agent_identity` is enabled: {error}"
15531553 ) ;
15541554 self . send_event_raw ( Event {
15551555 id : self . next_internal_sub_id ( ) ,
@@ -1559,7 +1559,6 @@ impl Session {
15591559 } ) ,
15601560 } )
15611561 . await ;
1562- handlers:: shutdown ( self , self . next_internal_sub_id ( ) ) . await ;
15631562 }
15641563
15651564 async fn cached_agent_task_for_current_binding ( & self ) -> Option < RegisteredAgentTask > {
@@ -6475,7 +6474,16 @@ pub(crate) async fn run_turn(
64756474 }
64766475 if let Err ( error) = sess. ensure_agent_task_registered ( ) . await {
64776476 warn ! ( error = %error, "agent task registration failed" ) ;
6478- sess. fail_agent_identity_registration ( error) . await ;
6477+ sess. send_event (
6478+ turn_context. as_ref ( ) ,
6479+ EventMsg :: Error ( ErrorEvent {
6480+ message : format ! (
6481+ "Agent task registration failed. Please try again; Codex will attempt to register the task again on the next turn: {error}"
6482+ ) ,
6483+ codex_error_info : Some ( CodexErrorInfo :: Other ) ,
6484+ } ) ,
6485+ )
6486+ . await ;
64796487 return None ;
64806488 }
64816489
Original file line number Diff line number Diff line change @@ -3782,7 +3782,7 @@ pub(crate) async fn make_session_and_context_with_rx() -> (
37823782}
37833783
37843784#[ tokio:: test]
3785- async fn fail_agent_identity_registration_emits_error_and_shutdown ( ) {
3785+ async fn fail_agent_identity_registration_emits_error_without_shutdown ( ) {
37863786 let ( session, _turn_context, rx_event) = make_session_and_context_with_rx ( ) . await ;
37873787
37883788 session
@@ -3800,21 +3800,14 @@ async fn fail_agent_identity_registration_emits_error_and_shutdown() {
38003800 } ) => {
38013801 assert_eq ! (
38023802 message,
3803- "Agent identity registration failed. Codex cannot continue while `features.use_agent_identity` is enabled: registration exploded" . to_string( )
3803+ "Agent identity registration failed while `features.use_agent_identity` is enabled: registration exploded" . to_string( )
38043804 ) ;
38053805 assert_eq ! ( codex_error_info, Some ( CodexErrorInfo :: Other ) ) ;
38063806 }
38073807 other => panic ! ( "expected error event, got {other:?}" ) ,
38083808 }
38093809
3810- let shutdown_event = timeout ( Duration :: from_secs ( 1 ) , rx_event. recv ( ) )
3811- . await
3812- . expect ( "shutdown event should arrive" )
3813- . expect ( "shutdown event should be readable" ) ;
3814- match shutdown_event. msg {
3815- EventMsg :: ShutdownComplete => { }
3816- other => panic ! ( "expected shutdown event, got {other:?}" ) ,
3817- }
3810+ assert ! ( rx_event. try_recv( ) . is_err( ) ) ;
38183811}
38193812
38203813#[ tokio:: test]
You can’t perform that action at this time.
0 commit comments