Show read-only conversations when resume encounters an active writer (#43253)

## Why

Resuming a conversation that is open in another app fails with an active-writer error. Allow users to inspect its transcript and retry after closing it in the other app.

## What changed

- Fall back to a read-only history snapshot on active-writer conflicts during startup and session selection.
- Replace the composer with an explanatory notice, `R` to retry, exit shortcuts, and the configured transcript shortcut.
- Block input and freeze active command and MCP animations while viewing the snapshot. Preserve initial prompts and existing drafts for a successful retry.
- Keep the subscription when retrying the same thread and preserve read-only state across thread switches and reconnects.

## Testing

Add regression tests for conflict detection, history viewing, draft preservation, same-thread retry without unsubscribing, exit shortcuts, and notice and frozen-tool rendering.

GitOrigin-RevId: fa864cc73143cad9139c22e33b7958569eec20cf
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-09-06 17:27:44 +00:00
1 parent a9896da3fe
commit 4aec23384e
29 files changed
+869 -109

No files matched your search

+7 -3
View File
@@ -158,7 +158,7 @@ impl App {
&& self
.thread_event_channels
.get(&id)
.is_some_and(|channel| channel.attachment() == ThreadEventAttachment::ReplayOnly)
.is_some_and(|channel| channel.attachment() != ThreadEventAttachment::Live)
}
pub(super) fn recover_transport_error(&mut self, error: &color_eyre::Report) -> bool {
@@ -284,7 +284,11 @@ impl App {
// so their late requests cannot leak into recovery. Background threads attach on selection.
for channel in self.thread_event_channels.values_mut() {
let mut replacement = ThreadEventChannel::new(THREAD_EVENT_CHANNEL_CAPACITY);
replacement.mark_replay_only();
if channel.attachment() == ThreadEventAttachment::ExternalWriter {
replacement.mark_external_writer();
} else {
replacement.mark_replay_only();
}
let mut store = std::mem::replace(
&mut *channel.store.lock().await,
ThreadEventStore::new(THREAD_EVENT_CHANNEL_CAPACITY),
@@ -349,7 +353,7 @@ impl App {
)?;
self.config = self.chat_widget.config_ref().clone();
self.refresh_pending_thread_approvals().await;
if self.thread_unavailable(id) {
if self.thread_unavailable(id) && !self.chat_widget.is_external_writer_view() {
self.agent_navigation.mark_stopped(id);
self.chat_widget.pause_unavailable_thread();
self.chat_widget.add_info_message("This conversation is unavailable. Its cached transcript and draft remain here; input is paused. Open the agent picker or return to the parent to continue.".into(), /*hint*/ None);