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

+4 -3
View File
@@ -3,6 +3,7 @@
//! This module contains the exhaustive `AppEvent` dispatcher and exit-mode handling. Large domain
//! actions are delegated to focused app submodules so the central match remains the routing layer.
use super::agents_overview_view::AgentsOverviewFocus;
use super::rate_limit_refresh::RateLimitReadStatus;
use super::rate_limit_refresh::RateLimitRefreshOutcome;
use super::resize_reflow::trailing_run_start;
@@ -2710,7 +2711,7 @@ impl App {
}
}
AppEvent::OpenAgentsOverview => {
self.open_agents_overview(app_server);
self.open_agents_overview(app_server, AgentsOverviewFocus::List);
}
AppEvent::AgentsOverviewThreadsLoaded { request_id, result } => {
self.apply_agents_overview_thread_refresh(app_server, request_id, result);
@@ -2721,7 +2722,7 @@ impl App {
.await?
{
AppRunControl::Continue if self.primary_thread_id.is_none() => {
self.open_agents_overview(app_server);
self.open_agents_overview(app_server, AgentsOverviewFocus::List);
}
AppRunControl::Continue => {}
AppRunControl::Exit(reason) => return Ok(AppRunControl::Exit(reason)),
@@ -3511,7 +3512,7 @@ impl App {
/*initial_user_message*/ None,
);
self.replace_chat_widget(ChatWidget::new_with_app_event(init));
self.open_agents_overview(app_server);
self.open_agents_overview(app_server, AgentsOverviewFocus::List);
AppRunControl::Continue
}
Err(err) => {