[core] Allow resume after client errors (#2053)

## Summary
Allow tui conversations to resume after the client fails out of retries.
I tested this with exec / mocked api failures as well, and it appears to
be fine. But happy to add an exec integration test as well!

## Testing
- [x] Added integration test
- [x] Tested locally
This commit is contained in:
Dylan
2025-08-08 18:21:19 -07:00
committed by GitHub
parent a2b9f46006
commit 0091930f5a
3 changed files with 159 additions and 4 deletions

View File

@@ -1098,7 +1098,7 @@ async fn run_task(sess: Arc<Session>, sub_id: String, input: Vec<InputItem>) {
sess.record_conversation_items(&[initial_input_for_turn.clone().into()])
.await;
let last_agent_message: Option<String>;
let mut last_agent_message: Option<String> = None;
// Although from the perspective of codex.rs, TurnDiffTracker has the lifecycle of a Task which contains
// many turns, from the perspective of the user, it is a single turn.
let mut turn_diff_tracker = TurnDiffTracker::new();
@@ -1248,7 +1248,8 @@ async fn run_task(sess: Arc<Session>, sub_id: String, input: Vec<InputItem>) {
}),
};
sess.tx_event.send(event).await.ok();
return;
// let the user continue the conversation
break;
}
}
}