mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Preserve active recovery turns when clients reconnect (#61014)
## Why A recovery turn can occupy the core turn slot before `TurnStarted` is published and thread statuses reflect it. During this window, `thread/resume` with configuration overrides could treat an unsubscribed thread as idle and shut it down, interrupting recovery. ## What changed Require the core turn slot to be empty before replacing a loaded thread during resume. Expose `CodexThread::has_active_turn()` and reuse it in the residency unload check. ## Testing Add a regression test that blocks paginated history writes to hold a recovery turn before status publication, reconnects with a configuration override, and verifies that the client receives completion for the preserved recovery turn. GitOrigin-RevId: f295038c8502a9b2849ddc08614db4a3cb5610cf
This commit is contained in:
committed by
copyberry
parent
6bfdc75f0d
commit
b75ec48a2c
@@ -799,6 +799,11 @@ impl CodexThread {
|
||||
self.session.interrupted_turn().await
|
||||
}
|
||||
|
||||
/// Returns whether core owns a turn slot, including before `TurnStarted` is published.
|
||||
pub async fn has_active_turn(&self) -> bool {
|
||||
self.session.active_turn.lock().await.is_some()
|
||||
}
|
||||
|
||||
/// Returns the trusted root when the expected turn is currently active.
|
||||
pub async fn active_turn_root(&self, expected_turn_id: &str) -> Option<String> {
|
||||
let active = self.session.active_turn.lock().await;
|
||||
|
||||
Reference in New Issue
Block a user