Allow selecting path-backed agents in the TUI picker (#33922)

## Why

Opening the agent picker stopped after adding status history whenever path-backed subagents were present, so those agents could not be selected from the picker.

## What changed

- Continue into the picker after rendering status for path-backed subagents.
- Skip duplicate liveness refreshes for path-backed threads and display non-primary agents by their canonical path when available.

## Testing

- Add a snapshot test that opens the picker for a path-backed agent and verifies that selecting it emits `SelectAgentThread` for the expected thread.

GitOrigin-RevId: 1668bb7817ce4e13c91d85c4d7ddab31c04c97b3
This commit is contained in:
Eric Traut authored and copyberry committed 2026-07-17 23:11:07 +00:00
1 parent d4982d0a33
commit e98765c212
3 files changed
+62 -8

No files matched your search

+17 -8
View File
@@ -26,7 +26,7 @@ impl App {
.into_iter()
.map(|(thread_id, _)| thread_id)
.collect();
for thread_id in path_backed_thread_ids {
for thread_id in path_backed_thread_ids.iter().copied() {
if let Some(channel) = self.thread_event_channels.get(&thread_id)
&& channel.attachment() == ThreadEventAttachment::Live
{
@@ -80,7 +80,6 @@ impl App {
.add_to_history(super::agent_status_feed::AgentStatusHistoryCell::new(
entries,
));
return;
}
let mut thread_ids = self.agent_navigation.tracked_thread_ids();
@@ -90,7 +89,9 @@ impl App {
}
}
for thread_id in thread_ids {
if self.side_threads.contains_key(&thread_id) {
if path_backed_thread_ids.contains(&thread_id)
|| self.side_threads.contains_key(&thread_id)
{
continue;
}
if !self
@@ -127,11 +128,19 @@ impl App {
}
let id = thread_id;
let is_primary = self.primary_thread_id == Some(thread_id);
let name = format_agent_picker_item_name(
entry.agent_nickname.as_deref(),
entry.agent_role.as_deref(),
is_primary,
);
let name = entry
.agent_path
.as_deref()
.map(str::trim)
.filter(|agent_path| !is_primary && !agent_path.is_empty())
.map(ToOwned::to_owned)
.unwrap_or_else(|| {
format_agent_picker_item_name(
entry.agent_nickname.as_deref(),
entry.agent_role.as_deref(),
is_primary,
)
});
let uuid = thread_id.to_string();
SelectionItem {
name: name.clone(),