Reduce TUI stack usage during session transitions (#44176)

## Why

Session transitions need stack headroom to rebuild configuration and the chat widget. Tokio stores task outputs inline even when it boxes the task future, so returning a large `Config` adds stack pressure during task allocation.

## What changed

Box the configuration build result inside the runtime worker and unbox it after joining. Box the `App::run` future to keep the large event loop out of enclosing startup futures.

## Testing

Extend the production-stack TUI integration test to enter `/side`, verify the process remains running, and return to the saved conversation with Ctrl+C.

GitOrigin-RevId: 44975300bb837bf3645ff762cf7bcdc44a277f41
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-09 15:20:47 +00:00
1 parent 0df1daf526
commit c77c34ed33
3 files changed
+15 -5

No files matched your search

+7 -1
View File
@@ -16,7 +16,7 @@ use std::time::Instant;
use wiremock::matchers::body_string_contains;
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn picker_worktree_fork_and_cd_run_on_the_production_stack() -> Result<()> {
async fn picker_side_worktree_fork_and_cd_run_on_the_production_stack() -> Result<()> {
let repository = tempfile::tempdir_in("/tmp")?;
let root = repository.path().canonicalize()?;
let status = Command::new("git")
@@ -93,6 +93,12 @@ async fn picker_worktree_fork_and_cd_run_on_the_production_stack() -> Result<()>
terminal.wait_for_screen("STACK_SAVED_HISTORY")?;
terminal.wait_for_screen("Ask Codex to do anything")?;
submit(&mut terminal, "/side")?;
terminal.wait_for_screen("Side from main thread")?;
terminal.ensure_running()?;
terminal.write_input(b"\x03")?;
terminal.wait_for_screen("STACK_SAVED_HISTORY")?;
submit(&mut terminal, "/resume")?;
terminal.wait_for_screen("Resume a previous session")?;
terminal.ensure_running()?;