Hide TUI status details for read-only history (#61219)

## What changed

Track whether a thread is being viewed without a live attachment. Hide the status line and context usage for saved history and unavailable conversations, even when token usage updates arrive. Restore these displays when the thread resumes interactively, including sessions using read-only permissions.

Avoid a leading separator before the Vim mode indicator when context usage is hidden.

## Testing

Add regression coverage for history viewing, token updates, and interactive resume. Update unavailable-conversation snapshots to omit the status line.

GitOrigin-RevId: 14dfd2ee0f232001814b7fc45a5ac8a5d755669b
This commit is contained in:
Joe Savona
2026-11-13 01:07:44 +00:00
committed by copyberry
parent 1111483b48
commit fdad70ba5d
34 changed files with 160 additions and 22 deletions
@@ -246,6 +246,7 @@ impl ChatWidget {
active_side_conversation: false,
blocks_direct_input: false,
external_writer_view: false,
read_only_history: false,
provider_error: None,
fork_in_progress: false,
misalignment_policy_violation: None,
+3
View File
@@ -130,6 +130,9 @@ impl ChatWidget {
}
pub(crate) fn pause_unavailable_thread(&mut self) {
self.read_only_history = true;
self.sync_context_window_visibility();
self.refresh_status_line();
if let Some(questions) = &mut self.bottom_pane.questions {
questions.delivery_enabled = false;
}
@@ -96,6 +96,8 @@ impl ChatWidget {
let connector_scope_changed = previous_thread_id != Some(session.thread_id)
|| self.config.cwd.as_path() != session.cwd.as_path();
self.thread_id = Some(session.thread_id);
self.read_only_history = session.read_only_history;
self.sync_context_window_visibility();
self.daybreak_enabled = self.config.features.enabled(Feature::CliDaybreak)
&& session.daybreak_enabled
&& !matches!(display, SessionConfiguredDisplay::SideConversation);
@@ -465,6 +465,9 @@ impl ChatWidget {
///
/// Unknown ids are deduplicated in insertion order for warning messages.
fn status_line_items_with_invalids(&self) -> (Vec<StatusLineItem>, Vec<String>) {
if self.read_only_history {
return Default::default();
}
parse_items_with_invalids(self.configured_status_line_items())
}
@@ -47,6 +47,7 @@ fn thread_settings_for_test(
fn configured_thread_session(thread_id: ThreadId) -> crate::session_state::ThreadSessionState {
crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -629,6 +629,7 @@ async fn submission_preserves_text_elements_and_local_images() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -739,6 +740,7 @@ async fn submission_includes_configured_active_permission_profile() {
};
let expected_active_permission_profile = ActivePermissionProfile::new("custom");
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -795,6 +797,7 @@ async fn submission_omits_active_permission_profile_for_legacy_snapshot() {
file_system: ManagedFileSystemPermissions::Unrestricted,
};
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -841,6 +844,7 @@ async fn submission_with_remote_and_local_images_keeps_local_placeholder_numberi
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -942,6 +946,7 @@ async fn enter_with_only_remote_images_submits_user_turn() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -1012,6 +1017,7 @@ async fn shift_enter_with_only_remote_images_does_not_submit_user_turn() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -1054,6 +1060,7 @@ async fn enter_with_only_remote_images_does_not_submit_when_modal_is_active() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -1096,6 +1103,7 @@ async fn enter_with_only_remote_images_does_not_submit_when_input_disabled() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -1141,6 +1149,7 @@ async fn submission_prefers_selected_duplicate_skill_path() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -1269,6 +1269,7 @@ async fn bang_shell_enter_while_task_running_submits_run_user_shell_command() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -22,6 +22,7 @@ async fn resumed_initial_messages_render_history() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let mut configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: true,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -184,6 +185,7 @@ async fn restored_conversation_ultra_remains_selected_after_switching_to_plan()
chat.set_plan_mode_reasoning_effort(Some(ReasoningEffortConfig::High));
chat.handle_thread_session(crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -507,6 +509,7 @@ async fn replayed_user_message_preserves_text_elements_and_local_images() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -580,6 +583,7 @@ async fn replayed_user_message_preserves_remote_image_urls() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -687,6 +691,7 @@ async fn session_configured_syncs_widget_config_permissions_and_cwd() {
.expect("permission profile should project to legacy sandbox policy");
let expected_sandbox = SandboxPolicy::from(expected_core_sandbox);
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -768,6 +773,7 @@ async fn session_configured_preserves_profile_workspace_roots() {
let session_permission_profile = PermissionProfile::workspace_write()
.materialize_project_roots_with_workspace_roots(&session_effective_workspace_roots);
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -816,6 +822,7 @@ async fn session_configured_external_sandbox_keeps_external_runtime_policy() {
network_access: NetworkAccess::Restricted,
};
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -858,6 +865,7 @@ async fn replayed_user_message_with_only_remote_images_renders_history_cell() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -919,6 +927,7 @@ async fn replayed_user_message_with_only_local_images_renders_history_cell() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -1277,6 +1286,7 @@ async fn replayed_reasoning_item_preserves_summary_parts_and_hides_raw_reasoning
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.config.show_raw_agent_reasoning = false;
chat.handle_thread_session(crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -1329,6 +1339,7 @@ async fn replayed_reasoning_item_shows_raw_reasoning_when_enabled() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.config.show_raw_agent_reasoning = true;
chat.handle_thread_session(crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -1162,6 +1162,7 @@ async fn required_windows_sandbox_setup_defers_configured_initial_prompt() {
create_initial_user_message(Some(initial_prompt.clone()), Vec::new(), Vec::new());
chat.handle_thread_session(crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -1612,6 +1613,7 @@ async fn permissions_selection_marks_auto_review_current_after_session_configure
.set_enabled(Feature::GuardianApproval, /*enabled*/ true);
chat.handle_thread_session(crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -1666,6 +1668,7 @@ async fn permissions_selection_marks_auto_review_current_with_custom_workspace_w
let permission_profile = app_server_workspace_write_profile(extra_root);
chat.handle_thread_session(crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),
@@ -16,6 +16,7 @@ fn paste_hidden_plan_shell_payload(chat: &mut ChatWidget) -> String {
fn plan_test_session(thread_id: ThreadId) -> crate::session_state::ThreadSessionState {
crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -1229,6 +1230,7 @@ async fn submit_user_message_emits_structured_plugin_mentions_from_bindings() {
let thread_id = ThreadId::new();
let rollout_file = NamedTempFile::new().unwrap();
let configured = crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id,
@@ -4719,6 +4719,7 @@ async fn session_configured_clears_goal_status_footer() {
let rollout_file = NamedTempFile::new().unwrap();
chat.handle_thread_session(crate::session_state::ThreadSessionState {
read_only_history: false,
daybreak_enabled: false,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
thread_id: ThreadId::new(),