File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1551,7 +1551,7 @@ impl Session {
15511551 async fn fail_agent_identity_registration ( self : & Arc < Self > , error : anyhow:: Error ) {
15521552 warn ! ( error = %error, "agent identity registration failed" ) ;
15531553 let message = format ! (
1554- "Agent identity registration failed. Codex cannot continue while `features.use_agent_identity` is enabled: {error}"
1554+ "Agent identity registration failed while `features.use_agent_identity` is enabled: {error}"
15551555 ) ;
15561556 self . send_event_raw ( Event {
15571557 id : self . next_internal_sub_id ( ) ,
@@ -1561,7 +1561,6 @@ impl Session {
15611561 } ) ,
15621562 } )
15631563 . await ;
1564- handlers:: shutdown ( self , self . next_internal_sub_id ( ) ) . await ;
15651564 }
15661565
15671566 fn latest_persisted_agent_task (
@@ -6529,7 +6528,16 @@ pub(crate) async fn run_turn(
65296528 }
65306529 if let Err ( error) = sess. ensure_agent_task_registered ( ) . await {
65316530 warn ! ( error = %error, "agent task registration failed" ) ;
6532- sess. fail_agent_identity_registration ( error) . await ;
6531+ sess. send_event (
6532+ turn_context. as_ref ( ) ,
6533+ EventMsg :: Error ( ErrorEvent {
6534+ message : format ! (
6535+ "Agent task registration failed. Please try again; Codex will attempt to register the task again on the next turn: {error}"
6536+ ) ,
6537+ codex_error_info : Some ( CodexErrorInfo :: Other ) ,
6538+ } ) ,
6539+ )
6540+ . await ;
65336541 return None ;
65346542 }
65356543
Original file line number Diff line number Diff line change @@ -3845,7 +3845,7 @@ pub(crate) async fn make_session_and_context_with_rx() -> (
38453845}
38463846
38473847#[ tokio:: test]
3848- async fn fail_agent_identity_registration_emits_error_and_shutdown ( ) {
3848+ async fn fail_agent_identity_registration_emits_error_without_shutdown ( ) {
38493849 let ( session, _turn_context, rx_event) = make_session_and_context_with_rx ( ) . await ;
38503850
38513851 session
@@ -3863,21 +3863,14 @@ async fn fail_agent_identity_registration_emits_error_and_shutdown() {
38633863 } ) => {
38643864 assert_eq ! (
38653865 message,
3866- "Agent identity registration failed. Codex cannot continue while `features.use_agent_identity` is enabled: registration exploded" . to_string( )
3866+ "Agent identity registration failed while `features.use_agent_identity` is enabled: registration exploded" . to_string( )
38673867 ) ;
38683868 assert_eq ! ( codex_error_info, Some ( CodexErrorInfo :: Other ) ) ;
38693869 }
38703870 other => panic ! ( "expected error event, got {other:?}" ) ,
38713871 }
38723872
3873- let shutdown_event = timeout ( Duration :: from_secs ( 1 ) , rx_event. recv ( ) )
3874- . await
3875- . expect ( "shutdown event should arrive" )
3876- . expect ( "shutdown event should be readable" ) ;
3877- match shutdown_event. msg {
3878- EventMsg :: ShutdownComplete => { }
3879- other => panic ! ( "expected shutdown event, got {other:?}" ) ,
3880- }
3873+ assert ! ( rx_event. try_recv( ) . is_err( ) ) ;
38813874}
38823875
38833876#[ tokio:: test]
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments