A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
Open the scoped agents view for a session without subagents (#3654)
Sebastian Müller7cbffa77b38f
diff --git a/crates/pa-cli/tests/dock_scope_exit_focus_e2e.rs b/crates/pa-cli/tests/dock_scope_exit_focus_e2e.rsindex ffc17d6b31..8defe20fa6 100644--- a/crates/pa-cli/tests/dock_scope_exit_focus_e2e.rs+++ b/crates/pa-cli/tests/dock_scope_exit_focus_e2e.rs@@ -23,7 +23,10 @@ use std::path::{Path, PathBuf};use std::process::{Child, Command, Stdio};use std::time::{Duration, Instant};-use pa_tui::agents_view::{AgentsHeadlessPlan, AgentsStep, AgentsViewOptions, AgentsViewUiMode};+use pa_tui::agents_view::{+ AgentsHeadlessPlan, AgentsStep, AgentsViewOptions, AgentsViewOutcome, AgentsViewScope,+ AgentsViewUiMode,+};use pa_tui::interactive::{HeadlessPlan, HeadlessStep, InteractiveOptions, ModelSelection, SessionSelection, UiMode,};@@ -203,6 +206,42 @@ fn session_options(}}+/// The scoped agents view over `scope`, run headless through `steps`.+async fn run_scoped_view(+ socket: &Path,+ session_dir: &Path,+ scope: AgentsViewScope,+ steps: Vec<AgentsStep>,+) -> AgentsViewOutcome {+ let view_options = AgentsViewOptions {+ socket_path: socket.to_path_buf(),+ cwd: PathBuf::from("/tmp"),+ session_dir: Some(session_dir.to_path_buf()),+ theme: "prime".to_string(),+ version: "0.0.0".to_string(),+ anchor_session_id: None,+ scope: Some(scope),+ query: None,+ expanded_ancestors: Vec::new(),+ selected_row_identity: None,+ selected_key: None,+ status_message: None,+ keybindings: pa_tui::keybindings::KeybindingsManager::new(),+ show_hardware_cursor: false,+ incident_notice_state: None,+ create_config: serde_json::json!({}),+ };+ let plan = AgentsHeadlessPlan {+ steps,+ width: 120,+ height: 36,+ };+ pa_tui::agents_view::run_agents_view(view_options, AgentsViewUiMode::Headless(plan), None)+ .await+ .expect("scoped agents view run")+ .outcome+}+/// One full scope-back cycle: the parent's chat opens with the dock's/// Subagents group selectable, the scoped agents view is entered from the/// dock and left with `exit_key`, and the reopened chat's bare Enter re-opens@@ -257,7 +296,6 @@ async fn scope_exit_keeps_the_subagents_item(exit_key: &'static str) {crossterm::event::KeyCode::Down,crossterm::event::KeyModifiers::NONE,)),- HeadlessStep::WaitMs(300),HeadlessStep::Key(crossterm::event::KeyEvent::new(crossterm::event::KeyCode::Enter,crossterm::event::KeyModifiers::NONE,@@ -290,40 +328,16 @@ async fn scope_exit_keeps_the_subagents_item(exit_key: &'static str) {// Run 2 — the scoped agents view (the Subagents panel): the exit key// hands the pane back to the scope root's chat, and the outcome carries// `scope_back`.- let view_options = AgentsViewOptions {- socket_path: supervisor.socket.clone(),- cwd: PathBuf::from("/tmp"),- session_dir: Some(session_dir.clone()),- theme: "prime".to_string(),- version: "0.0.0".to_string(),- anchor_session_id: None,- scope: Some(scope),- query: None,- expanded_ancestors: Vec::new(),- selected_row_identity: None,- selected_key: None,- status_message: None,- keybindings: pa_tui::keybindings::KeybindingsManager::new(),- show_hardware_cursor: false,- incident_notice_state: None,- create_config: serde_json::json!({}),- };- let view_plan = AgentsHeadlessPlan {- steps: vec![+ let view = run_scoped_view(+ &supervisor.socket,+ &session_dir,+ scope,+ vec![AgentsStep::WaitSettle { timeout_ms: 2_000 },AgentsStep::Key(exit_key.to_string()),],- width: 120,- height: 36,- };- let view = pa_tui::agents_view::run_agents_view(- view_options,- AgentsViewUiMode::Headless(view_plan),- None,)- .await- .expect("scoped agents view run")- .outcome;+ .await;assert_eq!(view.selection,Some(SessionSelection::Attach(parent_active.clone())),@@ -384,3 +398,186 @@ async fn scoped_view_escape_returns_to_the_subagents_dock_item() {async fn scoped_view_left_returns_to_the_subagents_dock_item() {scope_exit_keeps_the_subagents_item("left").await;}++/// A fresh session with no subagents (and no messages yet): Down focuses the+/// dock, Enter opens the session's own scoped agents view. Returns the scope+/// and the session's file, the path a child binds to.+async fn open_fresh_session_scope(socket: &Path, session_dir: &Path) -> (AgentsViewScope, String) {+ let plan = HeadlessPlan {+ steps: vec![+ HeadlessStep::WaitIdle { timeout_ms: 15_000 },+ HeadlessStep::Key(crossterm::event::KeyEvent::new(+ crossterm::event::KeyCode::Down,+ crossterm::event::KeyModifiers::NONE,+ )),+ HeadlessStep::Key(crossterm::event::KeyEvent::new(+ crossterm::event::KeyCode::Enter,+ crossterm::event::KeyModifiers::NONE,+ )),+ ],+ width: 120,+ height: 36,+ };+ let run = pa_tui::interactive::run_interactive(+ session_options(socket, session_dir, SessionSelection::New, false),+ UiMode::Headless(plan),+ )+ .await+ .expect("fresh session run");+ let scope = run+ .agents_view_scope+ .expect("the dock's Enter opens the scoped agents view");+ let (client, _events) = pa_tui::daemon_client::DaemonClient::connect_with_retry(socket)+ .await+ .expect("connect");+ let roster = client+ .request_ok(+ serde_json::from_value(serde_json::json!({ "type": "roster_subscribe" }))+ .expect("roster_subscribe command"),+ )+ .await+ .expect("roster snapshot");+ client.close();+ let session_file = roster["roster"]+ .as_array()+ .into_iter()+ .flatten()+ .find(|entry| entry["summary"]["activeSessionId"] == run.active_session_id.as_str())+ .and_then(|entry| entry["summary"]["sessionFile"].as_str())+ .map_or_else(+ || panic!("the fresh session's roster row: {roster}"),+ str::to_string,+ );+ (scope, session_file)+}++fn assert_scoped_frame(frame: &str) {+ assert!(+ frame.contains("\u{203a} subagents") && frame.contains("No subagents yet."),+ "the scoped view lists the session's empty subtree:\n{frame}"+ );+}++/// The operator's report: a session with zero subagents fell back to the+/// top-level agents view. Its dock entry opens the session's own scoped+/// view, empty, and the new action starts a child bound to the session.+#[tokio::test]+async fn a_session_without_subagents_opens_its_empty_scoped_view() {+ let dir = tempfile::TempDir::new().expect("temp dir");+ let session_dir = dir.path().join("agent").join("sessions");+ std::fs::create_dir_all(&session_dir).expect("session dir");+ let supervisor = spawn_supervisor(dir.path());+ let (scope, session_file) = open_fresh_session_scope(&supervisor.socket, &session_dir).await;++ let view = run_scoped_view(+ &supervisor.socket,+ &session_dir,+ scope,+ vec![+ AgentsStep::WaitSettle { timeout_ms: 2_000 },+ AgentsStep::Key("ctrl+n".to_string()),+ ],+ )+ .await;+ assert!(+ !view.scope_dropped,+ "the scope holds: {:?}",+ view.frames.last()+ );+ let last = view.frames.last().expect("a rendered frame");+ assert_scoped_frame(last);+ assert!(+ last.contains("Ctrl+N new") && last.contains("\u{2190} parent"),+ "the hint offers the new action and the way back:\n{last}"+ );+ assert_eq!(+ view.selection,+ Some(SessionSelection::NewChild {+ parent_session_file: PathBuf::from(session_file),+ rlm_depth: 1,+ }),+ "the new action starts a child of the scoped session"+ );+}++/// A child bound to the session while its empty scoped view is open pops in+/// without reopening the view.+#[tokio::test]+async fn a_child_created_under_the_open_empty_scope_appears_live() {+ let dir = tempfile::TempDir::new().expect("temp dir");+ let session_dir = dir.path().join("agent").join("sessions");+ std::fs::create_dir_all(&session_dir).expect("session dir");+ let supervisor = spawn_supervisor(dir.path());+ let (scope, session_file) = open_fresh_session_scope(&supervisor.socket, &session_dir).await;+ let live_dir = dir.path().join("live");+ std::fs::create_dir_all(&live_dir).expect("live dir");++ // The plan wakes the child's create once the empty scoped view rendered.+ let empty_rendered = std::sync::Arc::new(tokio::sync::Notify::new());+ let view = run_scoped_view(+ &supervisor.socket,+ &session_dir,+ scope,+ vec![+ AgentsStep::WaitRender {+ needle: "No subagents yet.".to_string(),+ timeout_ms: 5_000,+ },+ AgentsStep::Notify(empty_rendered.clone()),+ AgentsStep::WaitRender {+ needle: "late child".to_string(),+ timeout_ms: 15_000,+ },+ AgentsStep::Key("escape".to_string()),+ ],+ );+ // The child's file lives outside the session dir, so the saved catalog+ // never lists it: the row can only arrive live from the create. The+ // frame order below proves the view showed the empty scope first.+ let create_child = async {+ empty_rendered.notified().await;+ let child_path = write_fixture(+ &live_dir,+ "late-child",+ "late child",+ Some(Path::new(&session_file)),+ 1,+ &[("join late", "joined")],+ );+ let (client, _events) =+ pa_tui::daemon_client::DaemonClient::connect_with_retry(&supervisor.socket)+ .await+ .expect("connect");+ client+ .request_ok(+ serde_json::from_value(serde_json::json!({+ "type": "create",+ "sessionPath": child_path.to_string_lossy(),+ "config": {+ "cwd": "/tmp",+ "sessionDir": session_dir.to_string_lossy(),+ },+ }))+ .expect("create command"),+ )+ .await+ .expect("the child session starts");+ client.close();+ };+ let (view, ()) = tokio::join!(view, create_child);+ let empty = view+ .frames+ .iter()+ .position(|frame| frame.contains("No subagents yet."))+ .unwrap_or_else(|| panic!("the empty scoped view rendered: {:?}", view.frames.last()));+ assert_scoped_frame(&view.frames[empty]);+ let child = view.frames[empty..]+ .iter()+ .find(|frame| frame.contains("late child"))+ .unwrap_or_else(|| panic!("the child row popped in: {:?}", view.frames.last()));+ assert!(+ child.contains("\u{203a} subagents"),+ "the child lists inside the same scoped view:\n{child}"+ );+ assert!(!view.scope_dropped);+}diff --git a/crates/pa-tui/src/agents_view.rs b/crates/pa-tui/src/agents_view.rsindex b515cca865..f4d893392f 100644--- a/crates/pa-tui/src/agents_view.rs+++ b/crates/pa-tui/src/agents_view.rs@@ -139,6 +139,9 @@ pub enum AgentsStep {Click { row: usize, col: usize },/// A raw SGR mouse sequence, decoded by the same parser the terminal's reports flow through.Mouse(String),+ /// Wake the waiter once the plan reaches this step (every preceding step, barriers included,+ /// has run): hands control back to a test whose next action must follow a rendered state.+ Notify(std::sync::Arc<tokio::sync::Notify>),}#[derive(Debug, Default)]@@ -201,6 +204,8 @@ enum UiInput {},/// A decoded SGR mouse report (the click grammar's input).Mouse(crate::mouse::MouseEvent),+ /// The headless plan's `Notify` step, popped in plan order.+ Notify(std::sync::Arc<tokio::sync::Notify>),Resize,Settled,Done,@@ -885,6 +890,7 @@ async fn run_agents_view_surface(UiInput::Paste(text) => {mode.handle_paste(&text);}+ UiInput::Notify(notify) => notify.notify_one(),// `Settled` is the plan's own settle no-op; `WaitRender` never reaches the batch// pop (the pre-pass at the loop head owns it).UiInput::Resize | UiInput::Settled | UiInput::WaitRender { .. } => {}diff --git a/crates/pa-tui/src/agents_view/data_input.rs b/crates/pa-tui/src/agents_view/data_input.rsindex 7293d7c3f2..e1310aa4a8 100644--- a/crates/pa-tui/src/agents_view/data_input.rs+++ b/crates/pa-tui/src/agents_view/data_input.rs@@ -11,7 +11,12 @@ use super::{impl AgentsViewMode {pub(super) fn records(&self) -> Vec<crate::agents_view_state::UnifiedRecord> {- reconcile_unified_sessions(&self.roster, &self.saved)+ let scope_root_session = self+ .options+ .scope+ .as_ref()+ .and_then(|scope| scope.session_id.as_deref());+ reconcile_unified_sessions(&self.roster, &self.saved, scope_root_session)}/// Rebuild rows from the current roster, catalog, and query. A scoped run lists the scopediff --git a/crates/pa-tui/src/agents_view/render.rs b/crates/pa-tui/src/agents_view/render.rsindex c9e8263373..ffed3b31bd 100644--- a/crates/pa-tui/src/agents_view/render.rs+++ b/crates/pa-tui/src/agents_view/render.rs@@ -269,10 +269,10 @@ impl AgentsViewMode {return Vec::new();}if self.rows.is_empty() {- let text = if self.query.trim().is_empty() {- "No sessions yet."- } else {- "No sessions match your search."+ let text = match (self.query.trim().is_empty(), self.scope_active) {+ (false, _) => "No sessions match your search.",+ (true, true) => "No subagents yet.",+ (true, false) => "No sessions yet.",};return vec![vec![self.theme.fg(ThemeColor::Dim, text.to_string())]];}@@ -1014,6 +1014,11 @@ impl Renderer {}}}+ AgentsStep::Notify(notify) => {+ if ui_tx.send(UiInput::Notify(notify)).is_err() {+ return;+ }+ }}}let _ = ui_tx.send(UiInput::Done);diff --git a/crates/pa-tui/src/agents_view/tests/running_lines.rs b/crates/pa-tui/src/agents_view/tests/running_lines.rsindex 33dbe0714a..ea20f350db 100644--- a/crates/pa-tui/src/agents_view/tests/running_lines.rs+++ b/crates/pa-tui/src/agents_view/tests/running_lines.rs@@ -35,8 +35,8 @@ fn childless_scope() -> AgentsViewMode {)}-/// A childless scope is an empty view that keeps its keys: the TS-identical empty-state row-/// renders, search drives the no-match row, and every route out stays intact.+/// A childless scope is an empty view that keeps its keys: the scoped empty-state row renders,+/// search drives the no-match row, and every route out stays intact.#[test]fn a_childless_scope_is_an_empty_view_that_keeps_its_keys() {let mut mode = childless_scope();@@ -44,7 +44,7 @@ fn a_childless_scope_is_an_empty_view_that_keeps_its_keys() {assert_eq!(mode.rows, Vec::<AgentsViewRow>::new());let (lines, _) = mode.render_frame(120, 36);let frame = lines.iter().map(flat).collect::<Vec<_>>().join("\n");- assert!(frame.contains("No sessions yet."), "frame: {frame}");+ assert!(frame.contains("No subagents yet."), "frame: {frame}");mode.handle_key("z");assert_eq!(mode.query, "z");let (lines, _) = mode.render_frame(120, 36);diff --git a/crates/pa-tui/src/agents_view_forest/tests.rs b/crates/pa-tui/src/agents_view_forest/tests.rsindex 09bf3b86a0..3e64feb87e 100644--- a/crates/pa-tui/src/agents_view_forest/tests.rs+++ b/crates/pa-tui/src/agents_view_forest/tests.rs@@ -41,7 +41,7 @@ fn rows_for(scope: Option<&AgentsViewScope>,expanded: &[&str],) -> Vec<AgentsViewRow> {- let records = reconcile_unified_sessions(roster, &[]);+ let records = reconcile_unified_sessions(roster, &[], None);let rollups = compute_rollups(&records);let expanded: HashSet<String> = expanded.iter().map(ToString::to_string).collect();build_rows(@@ -482,7 +482,7 @@ fn scoped_rows_lift_direct_children_and_exclude_the_root() {active_session_id: Some("p-live".to_string()),session_name: None,};- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);let subtree = scope_to_subtree(&records, &scope).expect("subtree");assert_eq!(subtree.len(), 2);let rows = rows_for(&roster, Some(&scope), &[]);@@ -523,7 +523,7 @@ fn a_root_with_an_empty_session_file_binds_nothing() {active_session_id: Some("p-live".to_string()),session_name: None,};- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);assert_eq!(scope_root(&records, &scope),Some(ScopeRoot {@@ -554,7 +554,7 @@ fn saved_child_nests_under_its_saved_parent() {"messageCount": 1,}),];- let records = reconcile_unified_sessions(&[], &saved);+ let records = reconcile_unified_sessions(&[], &saved, None);let rollups = compute_rollups(&records);let rows = build_rows(&records,@@ -671,7 +671,7 @@ fn rollups_sum_costs_over_descendants_only() {}),),];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);let rollups = compute_rollups(&records);let parent = rollups.get("file:/x/p.jsonl").expect("parent rollup");assert!((parent.cost - 0.75).abs() < f64::EPSILON);@@ -724,7 +724,7 @@ fn rollups_sum_costs_over_descendants_only() {),];let fixture_records =- reconcile_unified_sessions(&fixture_roster, std::slice::from_ref(&saved_parent));+ reconcile_unified_sessions(&fixture_roster, std::slice::from_ref(&saved_parent), None);let fixture_rollups = compute_rollups(&fixture_records);let fixture_parent = fixture_rollups.get("file:/x/p.jsonl")@@ -739,7 +739,8 @@ fn rollups_sum_costs_over_descendants_only() {"path": "/x/p.jsonl", "id": "p","usage": { "inputTokens": 0, "outputTokens": 0, "cost": 0.0 },});- let bare_records = reconcile_unified_sessions(&fixture_roster, std::slice::from_ref(&bare));+ let bare_records =+ reconcile_unified_sessions(&fixture_roster, std::slice::from_ref(&bare), None);let bare_rollups = compute_rollups(&bare_records);let bare_parent = bare_rollups.get("file:/x/p.jsonl").expect("parent rollup");assert!(@@ -797,7 +798,7 @@ fn an_active_query_ranks_hits_globally_ancestors_sink_last() {}),),];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);let filtered = crate::agents_view_state::filter_unified_sessions(&records,&crate::agents_view_state::parse_search_query("sweep"),@@ -885,7 +886,7 @@ fn equal_scores_break_ties_by_recency_not_section() {}),),];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);let filtered = crate::agents_view_state::filter_unified_sessions(&records,&crate::agents_view_state::parse_search_query("sweep"),@@ -963,7 +964,7 @@ fn the_summary_line_bills_the_deleted_descendant_bucket() {roster_entry("p", "idle", &parent),roster_entry("r1", "running", &runner),];- let records = reconcile_unified_sessions(&roster, std::slice::from_ref(&saved_parent));+ let records = reconcile_unified_sessions(&roster, std::slice::from_ref(&saved_parent), None);let rollups = compute_rollups(&records);assert!((rollups@@ -1167,7 +1168,7 @@ fn a_ledger_child_nests_across_the_windows_path_forms() {"rlmDepth": 1,}),];- let records = reconcile_unified_sessions(&roster, &saved);+ let records = reconcile_unified_sessions(&roster, &saved, None);let rollups = compute_rollups(&records);let rows = build_rows(&records,diff --git a/crates/pa-tui/src/agents_view_state.rs b/crates/pa-tui/src/agents_view_state.rsindex 553ef9b323..1dbc49ca64 100644--- a/crates/pa-tui/src/agents_view_state.rs+++ b/crates/pa-tui/src/agents_view_state.rs@@ -181,7 +181,13 @@ pub(crate) fn record_search_text(record: &UnifiedRecord) -> SessionSearchText {/// Merge the live roster entries and the saved catalog rows into unified records without/// inventing runtime ancestry: roster data wins, saved rows only join through a shared alias.-pub fn reconcile_unified_sessions(roster: &[Value], saved: &[Value]) -> Vec<UnifiedRecord> {+/// `scope_root_session` names a scoped view's root: the view resolves its subtree through the+/// root's record but never lists the root, so that record stays whatever its lifecycle.+pub fn reconcile_unified_sessions(+ roster: &[Value],+ saved: &[Value],+ scope_root_session: Option<&str>,+) -> Vec<UnifiedRecord> {let mut records: Vec<UnifiedRecord> = Vec::new();let mut by_alias: HashMap<String, usize> = HashMap::new();@@ -189,7 +195,9 @@ pub fn reconcile_unified_sessions(roster: &[Value], saved: &[Value]) -> Vec<Uniflet summary = entry.get("summary").cloned().unwrap_or(Value::Null);// Only live rows render (TS `shouldShowAgentsViewSession`): a message-less draft never// surfaces a roster row; subagent workers are live before their first message.- if get_str(&summary, "lifecycle") != Some("live") {+ let scope_root =+ scope_root_session.is_some_and(|root| get_str(&summary, "sessionId") == Some(root));+ if get_str(&summary, "lifecycle") != Some("live") && !scope_root {continue;}let status = entry@@ -698,7 +706,7 @@ mod tests {"name": "Bug fix","messageCount": 4,})];- let records = reconcile_unified_sessions(&roster, &saved);+ let records = reconcile_unified_sessions(&roster, &saved, None);assert_eq!(records.len(), 1);assert_eq!(records[0].section, Section::Idle);assert_eq!(records[0].identity, "file:/x/s1.jsonl");@@ -735,7 +743,7 @@ mod tests {}),),];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);assert_eq!(records.len(), 1);assert_eq!(get_str(records[0].daemon.as_ref().unwrap(), "sessionId"),@@ -765,7 +773,7 @@ mod tests {"thinkingLevel": "high","messageCount": 2,})];- let records = reconcile_unified_sessions(&roster, &saved);+ let records = reconcile_unified_sessions(&roster, &saved, None);let summary = summary_for_record(&records[0]);assert_eq!(summary["thinkingLevel"], json!("high"));let roster_with_level = vec![roster_entry(@@ -778,7 +786,7 @@ mod tests {"thinkingLevel": "medium",}),)];- let records = reconcile_unified_sessions(&roster_with_level, &saved);+ let records = reconcile_unified_sessions(&roster_with_level, &saved, None);let summary = summary_for_record(&records[0]);assert_eq!(summary["thinkingLevel"], json!("medium"));@@ -789,7 +797,7 @@ mod tests {"thinkingLevel": "high","messageCount": 3,})];- let records = reconcile_unified_sessions(&[], &saved_only);+ let records = reconcile_unified_sessions(&[], &saved_only, None);let summary = summary_for_record(&records[0]);assert_eq!(summary["thinkingLevel"], json!("high"));assert_eq!(@@ -797,7 +805,7 @@ mod tests {"mock-1:high");let bare = vec![json!({ "id": "s3", "path": "/x/s3.jsonl", "messageCount": 3 })];- let records = reconcile_unified_sessions(&[], &bare);+ let records = reconcile_unified_sessions(&[], &bare, None);assert!(summary_for_record(&records[0]).get("thinkingLevel").is_none());@@ -811,12 +819,12 @@ mod tests {"firstMessage": "hello world","messageCount": 3,})];- let records = reconcile_unified_sessions(&[], &saved);+ let records = reconcile_unified_sessions(&[], &saved, None);assert_eq!(records[0].section, Section::Inactive);let filtered = filter_empty_sessions(&records, &[]);assert_eq!(filtered.len(), 1);let empty = vec![json!({ "id": "s3", "path": "/x/s3.jsonl", "messageCount": 0 })];- let records = reconcile_unified_sessions(&[], &empty);+ let records = reconcile_unified_sessions(&[], &empty, None);assert!(filter_empty_sessions(&records, &[]).is_empty());assert_eq!(filter_empty_sessions(&records, &["s3"]).len(), 1);}@@ -841,7 +849,7 @@ mod tests {"firstMessage": "old chat","messageCount": 2,})];- let records = reconcile_unified_sessions(&roster, &saved);+ let records = reconcile_unified_sessions(&roster, &saved, None);let rows = crate::agents_view_forest::build_rows::<std::collections::hash_map::RandomState>(&records,None,@@ -869,7 +877,7 @@ mod tests {"cwd": "/home/u/API-server","parentSessionPath": "/x/parent.jsonl",})];- let records = reconcile_unified_sessions(&[], &saved);+ let records = reconcile_unified_sessions(&[], &saved, None);let targets = record_search_text(&records[0]);for query in ["alpha", "roster", "ROSTER", "api-server", "sess-al"] {let parsed = parse_search_query(query);@@ -920,7 +928,7 @@ mod tests {"name": "stale catalog name","allMessagesText": "we bumped the backoff ceiling to 30s",})];- let records = reconcile_unified_sessions(&roster, &saved);+ let records = reconcile_unified_sessions(&roster, &saved, None);assert_eq!(records.len(), 1);// Daemon data wins for the merged targets; the saved transcript// stays out of the corpus.@@ -951,7 +959,7 @@ mod tests {"messageCount": 1,}),];- let records = reconcile_unified_sessions(&[], &saved);+ let records = reconcile_unified_sessions(&[], &saved, None);let filtered = filter_unified_sessions(&records, &parse_search_query("child"));let titles: Vec<&str> = filtered.iter()@@ -1031,7 +1039,7 @@ mod tests {"usage": { "cost": 1.5 },}),)];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);let rows = crate::agents_view_forest::build_rows::<std::collections::hash_map::RandomState>(&records,None,@@ -1077,7 +1085,7 @@ mod tests {"created": created_days_ago,"modified": modified_minutes_ago,})];- let records = reconcile_unified_sessions(&[], &saved);+ let records = reconcile_unified_sessions(&[], &saved, None);let rows = crate::agents_view_forest::build_rows::<std::collections::hash_map::RandomState>(&records,None,@@ -1116,7 +1124,7 @@ mod tests {"firstMessage": "hey",}),)];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);assert_eq!(record_search_text(&records[0]).name, "hey");for query in ["hey", "HEY", "Hey"] {let filtered = filter_unified_sessions(&records, &parse_search_query(query));@@ -1150,7 +1158,7 @@ mod tests {"cwd": "/work/ops",}),)];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);let title = session_title(&summary_for_record(&records[0]));let visible = truncate_text(&title, SESSION_TITLE_MAX_CELLS);let targets = record_search_text(&records[0]);@@ -1202,7 +1210,7 @@ mod tests {"id": "archived-01", "path": "/x/archived-01.jsonl","firstMessage": "orchestrate the fleet", "messageCount": 2,})];- let records = reconcile_unified_sessions(&roster, &saved);+ let records = reconcile_unified_sessions(&roster, &saved, None);let names: Vec<String> = records.iter().map(record_search_text)@@ -1235,7 +1243,7 @@ mod tests {"cwd": "/work/gateway",}),)];- let records = reconcile_unified_sessions(&roster, &[]);+ let records = reconcile_unified_sessions(&roster, &[], None);let targets = record_search_text(&records[0]);assert_eq!(targets.name, "gateway worker");assert!(diff --git a/crates/pa-tui/src/subagents.rs b/crates/pa-tui/src/subagents.rsindex 5454beb27b..3b11974e4c 100644--- a/crates/pa-tui/src/subagents.rs+++ b/crates/pa-tui/src/subagents.rs@@ -306,7 +306,7 @@ pub fn count_descendants(roster: &[Value], parent: &SessionIdentity) -> Subagent/// agents view bills the session's row. `None` when the roster holds no/// record for the session.pub(crate) fn family_cost(roster: &[Value], session: &SessionIdentity) -> Option<f64> {- let records = crate::agents_view_state::reconcile_unified_sessions(roster, &[]);+ let records = crate::agents_view_state::reconcile_unified_sessions(roster, &[], None);let rollups = crate::agents_view_forest::compute_rollups(&records);let keys = session.keys();records@@ -447,7 +447,7 @@ mod tests {assert_eq!(family_cost(&roster, &identity), Some(2.30));// Pinned against the agents-view row itself, not a second copy// of the formula.- let records = crate::agents_view_state::reconcile_unified_sessions(&roster, &[]);+ let records = crate::agents_view_state::reconcile_unified_sessions(&roster, &[], None);let rollups = crate::agents_view_forest::compute_rollups(&records);let rows = crate::agents_view_forest::build_rows(&records,