mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:22:05 +00:00
Defer resume picker and directory changes to a fresh TUI stack (#43376)
## Why Session transitions need stack headroom for embedded-server initialization and configuration loading. Running them inside event dispatch risks exhausting the TUI thread's stack. ## What changed - Queue `/resume` and valid `/cd` requests for processing after event dispatch returns. - Reject additional `/cd` requests while one is pending, and recheck the source session, working directory, idle state, and remote-environment restrictions before applying it. ## Testing Add a Unix PTY regression test that exercises `/resume`, worktree conversation forks, `/cd`, and new worktree conversations through the real TUI event loop. Update the directory-change test to verify that dispatch queues the request without immediately changing configuration. GitOrigin-RevId: 4950921931dfaba9e55e6bb04f98f7ba64b72122
This commit is contained in:
1 parent
694b6319d3
commit
5ecb3afd1b
11 files changed
+283
-5
No files matched your search
@@ -3446,6 +3446,9 @@ async fn changing_directory_preserves_project_trust_permissions_history_and_hook
|
||||
let thread_id = [original, ThreadId::new()][usize::from(kind == "stale")];
|
||||
app.handle_event(&mut tui, &mut server, change(thread_id, path))
|
||||
.await?;
|
||||
if let Some(pending) = app.pending_working_directory_change.take() {
|
||||
Box::pin(app.finish_working_directory_change(&mut tui, &mut server, pending)).await;
|
||||
}
|
||||
assert_eq!(app.chat_widget.thread_id(), Some(original));
|
||||
assert_eq!(app.config.cwd, current.clone().abs());
|
||||
assert!(app.runtime_working_directory_override.is_none());
|
||||
@@ -3526,6 +3529,13 @@ async fn changing_directory_preserves_project_trust_permissions_history_and_hook
|
||||
requests.lock().expect("request recorder lock").clear();
|
||||
app.handle_event(&mut tui, &mut server, change(original, "../trusted"))
|
||||
.await?;
|
||||
// Dispatch only queues /cd: configuration loading happens on a fresh loop iteration.
|
||||
assert_eq!(app.config.cwd, current.clone().abs());
|
||||
let pending = app
|
||||
.pending_working_directory_change
|
||||
.take()
|
||||
.expect("valid /cd queued");
|
||||
Box::pin(app.finish_working_directory_change(&mut tui, &mut server, pending)).await;
|
||||
let forked = app.chat_widget.thread_id().expect("forked thread");
|
||||
assert_ne!(forked, original);
|
||||
let forked_rollout = app.chat_widget.rollout_path().expect("forked rollout");
|
||||
|
||||
Reference in new issue
Block a user