mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
a9896da3fe
commit
4aec23384e
29 files changed
+869
-109
No files matched your search
@@ -16,10 +16,7 @@ use codex_app_server_protocol::WarningNotification;
|
||||
|
||||
impl App {
|
||||
pub(super) async fn shutdown_current_thread(&mut self, app_server: &mut AppServerSession) {
|
||||
let side_thread_ids: Vec<ThreadId> = self.side_threads.keys().copied().collect();
|
||||
for side_thread_id in side_thread_ids {
|
||||
self.discard_side_thread(app_server, side_thread_id).await;
|
||||
}
|
||||
self.shutdown_side_threads(app_server).await;
|
||||
if let Some(thread_id) = self.chat_widget.thread_id() {
|
||||
if let Err(err) = app_server.thread_unsubscribe(thread_id).await {
|
||||
tracing::warn!("failed to unsubscribe thread {thread_id}: {err}");
|
||||
@@ -28,6 +25,13 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) async fn shutdown_side_threads(&mut self, app_server: &mut AppServerSession) {
|
||||
let side_thread_ids: Vec<ThreadId> = self.side_threads.keys().copied().collect();
|
||||
for side_thread_id in side_thread_ids {
|
||||
self.discard_side_thread(app_server, side_thread_id).await;
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn abort_thread_event_listener(&mut self, thread_id: ThreadId) {
|
||||
if let Some(handle) = self.thread_event_listener_tasks.remove(&thread_id) {
|
||||
handle.abort();
|
||||
@@ -175,7 +179,12 @@ impl App {
|
||||
&mut self,
|
||||
target_session: &crate::resume_picker::SessionTarget,
|
||||
) -> bool {
|
||||
if self.active_thread_id != Some(target_session.thread_id) {
|
||||
if self.active_thread_id != Some(target_session.thread_id)
|
||||
|| self
|
||||
.thread_event_channels
|
||||
.get(&target_session.thread_id)
|
||||
.is_some_and(|channel| channel.attachment() != ThreadEventAttachment::Live)
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -445,7 +454,7 @@ impl App {
|
||||
) -> Result<()> {
|
||||
if self.thread_unavailable(thread_id) {
|
||||
self.chat_widget.add_error_message(
|
||||
"This conversation is unavailable; no operation was sent.".into(),
|
||||
"This conversation is read-only or unavailable; no operation was sent.".into(),
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user