Show recent sessions in the agent command center (#42104)

## Why

The agent command center only listed sessions currently loaded by the app server, so completed or otherwise unloaded tasks could not be revisited from the overview.

## What changed

- Seed the overview with up to 20 recent root sessions in addition to loaded sessions, retain discovered sessions for the lifetime of the TUI, and update rows from thread lifecycle notifications.
- Allow unloaded sessions to be resumed from the overview using the normal working-directory selection and configuration rebuild flow. Explicit runtime permission choices carry across a cold resume, while settings inherited from the previously selected task do not.
- Fall back from `recency_at` to `updated_at` when connected to an older server, and continue showing loaded sessions when recent-history listing is unavailable.

## Testing

Added coverage for recent-session discovery and retention, notification races, legacy and failed listing fallbacks, cold-resume working-directory and permission handling, reconnect behavior, and unloaded-session rendering and selection.

GitOrigin-RevId: 668068b1594eb24b2ea7faccd0327804b8cd22ef
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-01 17:28:35 +00:00
1 parent 9969043b95
commit f40e08478c
21 files changed
+1352 -316

No files matched your search

+27 -1
View File
@@ -206,6 +206,7 @@ mod agent_navigation;
mod agent_picker;
mod agent_status_feed;
mod agents_overview;
mod agents_overview_threads;
mod agents_overview_view;
pub(crate) use agents_overview::AGENTS_OVERVIEW_VIEW_ID;
mod app_server_event_targets;
@@ -232,6 +233,7 @@ mod recap;
mod reconnect;
mod replay_filter;
mod resize_reflow;
mod resume_config;
mod safety_buffering;
mod session_lifecycle;
mod side;
@@ -544,7 +546,7 @@ pub(crate) struct App {
harness_overrides: ConfigOverrides,
loader_overrides: LoaderOverrides,
cloud_config_bundle: CloudConfigBundleLoader,
runtime_approval_policy_override: Option<AskForApproval>,
runtime_approval_policy_override: Option<RuntimeApprovalPolicyOverride>,
runtime_permission_profile_override: Option<RuntimePermissionProfileOverride>,
pub(crate) file_search: FileSearchManager,
@@ -642,9 +644,31 @@ struct RuntimePermissionProfileOverride {
permission_profile: PermissionProfile,
active_permission_profile: Option<ActivePermissionProfile>,
network: Option<crate::legacy_core::config::NetworkProxySpec>,
approvals_reviewer: ApprovalsReviewer,
turn_override: RuntimePermissionProfileTurnOverride,
}
/// Separates user choices from settings inherited when attaching to another task.
#[derive(Debug, Clone, Copy, PartialEq)]
enum RuntimeApprovalPolicyOverride {
Explicit(AskForApproval),
Restored(AskForApproval),
}
impl RuntimeApprovalPolicyOverride {
fn policy(self) -> AskForApproval {
match self {
Self::Explicit(policy) | Self::Restored(policy) => policy,
}
}
}
#[derive(Clone, Copy, PartialEq, Eq)]
enum RuntimePolicyOverrideScope {
All,
ExplicitOnly,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum RuntimePermissionProfileTurnOverride {
Preserve,
@@ -657,6 +681,7 @@ impl RuntimePermissionProfileOverride {
permission_profile: config.permissions.permission_profile().clone(),
active_permission_profile: config.permissions.active_permission_profile(),
network: config.permissions.network.clone(),
approvals_reviewer: config.approvals_reviewer,
turn_override: RuntimePermissionProfileTurnOverride::LegacySandbox,
}
}
@@ -672,6 +697,7 @@ impl RuntimePermissionProfileOverride {
self.permission_profile == *config.permissions.permission_profile()
&& self.active_permission_profile == config.permissions.active_permission_profile()
&& self.network == config.permissions.network
&& self.approvals_reviewer == config.approvals_reviewer
}
fn turn_permission_profile(&self) -> Option<&PermissionProfile> {