mirror of
https://github.com/openai/codex.git
synced 2026-11-19 23:05:23 +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
@@ -92,10 +92,15 @@ impl App {
|
||||
}
|
||||
}
|
||||
AppEvent::StartManagedWorktree { mode, name } => {
|
||||
self.start_managed_worktree(app_server, mode, name).await;
|
||||
if self.pending_start_managed_worktree.is_some() {
|
||||
self.chat_widget
|
||||
.add_error_message("A worktree is already being created.".to_string());
|
||||
} else {
|
||||
self.pending_start_managed_worktree = Some((mode, name));
|
||||
}
|
||||
}
|
||||
AppEvent::ManagedWorktreeCreated(created) => {
|
||||
self.finish_managed_worktree(tui, app_server, *created).await;
|
||||
self.pending_managed_worktree_created = Some(created);
|
||||
}
|
||||
AppEvent::BrowseManagedWorktrees => {
|
||||
if let Some(request) = self.chat_widget.request_managed_worktrees() {
|
||||
|
||||
Reference in new issue
Block a user