mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Defer managed worktree transitions to fresh TUI loop iterations (#43298)
## Why Managed worktree transitions run through the event handler into the large synchronous `ChatWidget` constructor. Split this work so each stage runs on a fresh event-loop stack. ## What changed - Queue worktree setup, checkout completion and configuration loading, session transition, and widget attachment as separate stages with boxed futures. - Recheck the source session before transitioning and report retained checkout cleanup instructions when the transition cannot proceed. - Keep the old configuration paired with the old widget until attachment, and protect input during the handoff. ## Testing Update worktree lifecycle and submission tests to drain the deferred stages explicitly and assert that checkout creation starts before completion. GitOrigin-RevId: 0435f56d08bf3a6392d35b5c1cfdcc0f1fe02753
This commit is contained in:
1 parent
3cd6004dc4
commit
52e12e0cb5
10 files changed
+235
-36
No files matched your search
@@ -74,6 +74,18 @@ pub(crate) enum ManagedWorktreeMode {
|
||||
}
|
||||
|
||||
/// Checkout creation result returned from the blocking Git task to the TUI event loop.
|
||||
/// Prepared checkout and destination configuration consumed on a fresh event-loop stack.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct ManagedWorktreeTransition {
|
||||
pub(crate) source_thread_id: ThreadId,
|
||||
pub(crate) source_cwd: AbsolutePathBuf,
|
||||
pub(crate) manager: codex_worktree::WorktreeManager,
|
||||
pub(crate) checkout: codex_worktree::ManagedWorktree,
|
||||
pub(crate) config: Box<crate::legacy_core::config::Config>,
|
||||
pub(crate) mode: ManagedWorktreeMode,
|
||||
pub(crate) name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct ManagedWorktreeCreated {
|
||||
pub(crate) source_thread_id: ThreadId,
|
||||
|
||||
Reference in new issue
Block a user