File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1550,7 +1550,7 @@ impl Session {
15501550 async fn fail_agent_identity_registration ( self : & Arc < Self > , error : anyhow:: Error ) {
15511551 warn ! ( error = %error, "agent identity registration failed" ) ;
15521552 let message = format ! (
1553- "Agent identity registration failed. Codex cannot continue while `features.use_agent_identity` is enabled: {error}"
1553+ "Agent identity registration failed while `features.use_agent_identity` is enabled: {error}"
15541554 ) ;
15551555 self . send_event_raw ( Event {
15561556 id : self . next_internal_sub_id ( ) ,
@@ -1560,7 +1560,6 @@ impl Session {
15601560 } ) ,
15611561 } )
15621562 . await ;
1563- handlers:: shutdown ( self , self . next_internal_sub_id ( ) ) . await ;
15641563 }
15651564
15661565 fn latest_persisted_agent_task (
@@ -6532,7 +6531,16 @@ pub(crate) async fn run_turn(
65326531 }
65336532 if let Err ( error) = sess. ensure_agent_task_registered ( ) . await {
65346533 warn ! ( error = %error, "agent task registration failed" ) ;
6535- sess. fail_agent_identity_registration ( error) . await ;
6534+ sess. send_event (
6535+ turn_context. as_ref ( ) ,
6536+ EventMsg :: Error ( ErrorEvent {
6537+ message : format ! (
6538+ "Agent task registration failed. Please try again; Codex will attempt to register the task again on the next turn: {error}"
6539+ ) ,
6540+ codex_error_info : Some ( CodexErrorInfo :: Other ) ,
6541+ } ) ,
6542+ )
6543+ . await ;
65366544 return None ;
65376545 }
65386546
Original file line number Diff line number Diff line change @@ -3839,7 +3839,7 @@ pub(crate) async fn make_session_and_context_with_rx() -> (
38393839}
38403840
38413841#[ tokio:: test]
3842- async fn fail_agent_identity_registration_emits_error_and_shutdown ( ) {
3842+ async fn fail_agent_identity_registration_emits_error_without_shutdown ( ) {
38433843 let ( session, _turn_context, rx_event) = make_session_and_context_with_rx ( ) . await ;
38443844
38453845 session
@@ -3857,21 +3857,14 @@ async fn fail_agent_identity_registration_emits_error_and_shutdown() {
38573857 } ) => {
38583858 assert_eq ! (
38593859 message,
3860- "Agent identity registration failed. Codex cannot continue while `features.use_agent_identity` is enabled: registration exploded" . to_string( )
3860+ "Agent identity registration failed while `features.use_agent_identity` is enabled: registration exploded" . to_string( )
38613861 ) ;
38623862 assert_eq ! ( codex_error_info, Some ( CodexErrorInfo :: Other ) ) ;
38633863 }
38643864 other => panic ! ( "expected error event, got {other:?}" ) ,
38653865 }
38663866
3867- let shutdown_event = timeout ( Duration :: from_secs ( 1 ) , rx_event. recv ( ) )
3868- . await
3869- . expect ( "shutdown event should arrive" )
3870- . expect ( "shutdown event should be readable" ) ;
3871- match shutdown_event. msg {
3872- EventMsg :: ShutdownComplete => { }
3873- other => panic ! ( "expected shutdown event, got {other:?}" ) ,
3874- }
3867+ assert ! ( rx_event. try_recv( ) . is_err( ) ) ;
38753868}
38763869
38773870#[ tokio:: test]
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments