Focus the task list when reopening the agent command center (#44631)

## Why

Reopening the agent command center focused the composer, requiring an extra focus change before browsing tasks.

## What changed

- Focus the task list when opening the overview from a session or returning after task lifecycle actions. Keep composer focus when starting directly in the overview.
- Fall back to the composer when no visible tasks remain, after discovery and pending metadata have resolved.
- Preserve unsent drafts and explicit focus changes across populated refreshes.

## Testing

Add regression coverage for requested focus, draft and cursor preservation, arrow-key and Vim navigation, and empty-list fallback while metadata is pending. Add a snapshot of the reopened overview with list focus.

GitOrigin-RevId: 8713eadc4a2a72e2db4a962184d43c4028c7178d
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-10 20:06:51 +00:00
1 parent f8ab57359d
commit b9852fe6f7
11 files changed
+175 -21

No files matched your search

@@ -315,7 +315,7 @@ async fn lifecycle_removes_background_and_current_tasks_without_losing_the_dashb
};
let mut tui = crate::tui::test_support::make_test_tui()?;
tui.pause_events();
app.open_agents_overview(&app_server);
app.open_agents_overview(&app_server, AgentsOverviewFocus::List);
if action == AgentsOverviewAction::Archive {
let rollout = app_server
.thread_read(id, /*include_turns*/ false)
@@ -360,7 +360,7 @@ async fn lifecycle_removes_background_and_current_tasks_without_losing_the_dashb
.await?;
app.enqueue_primary_thread_session(resumed.session, resumed.turns)
.await?;
app.open_agents_overview(&app_server);
app.open_agents_overview(&app_server, AgentsOverviewFocus::List);
}
let background = ThreadId::from_string(
&app_test_support::create_fake_rollout(
@@ -434,7 +434,6 @@ async fn lifecycle_removes_background_and_current_tasks_without_losing_the_dashb
render_bottom_popup(&app.chat_widget, /*width*/ 80)
);
app.chat_widget.handle_key_event(KeyCode::Enter.into());
app.chat_widget.handle_key_event(KeyCode::Esc.into());
app_server
.request_handle()
.request_typed::<TurnStartResponse>(ClientRequest::TurnStart {