mirror of
https://github.com/openai/codex.git
synced 2026-11-19 23:05:23 +00:00
Show worktree owner details and add confirmed deletion (#43942)
## What changed - Display owner thread titles, relative update times, and archived or unavailable status in the managed worktree browser. Offer resume only for resumable owners, including those with compressed thread history. - Add a delete action with a confirmation dialog that defaults to Cancel and preserves thread history. - Restrict removal to managed worktrees in the current repository. Refuse the current checkout, including path aliases, and checkouts containing local changes, untracked files, or ignored files. ## Testing Add browser snapshots and tests for owner states, deletion confirmation, and compressed thread history. Add worktree removal coverage for unrelated checkouts, current-directory aliases, untracked and ignored files, and successful removal of a clean checkout. GitOrigin-RevId: e5867f1540d5d5bc8130acc76875e51e3d8b3b6a
This commit is contained in:
1 parent
c53f342fec
commit
973dcd80fc
12 files changed
+611
-31
No files matched your search
@@ -114,6 +114,7 @@ impl App {
|
||||
crate::worktree_browser::fetch(
|
||||
request,
|
||||
self.config.codex_home.to_path_buf(),
|
||||
app_server.request_handle(),
|
||||
self.app_event_tx.clone(),
|
||||
);
|
||||
}
|
||||
@@ -129,6 +130,37 @@ impl App {
|
||||
AppEvent::ShowManagedWorktreeActions { request, entry } => {
|
||||
self.chat_widget.show_managed_worktree_actions(request, entry);
|
||||
}
|
||||
AppEvent::ConfirmManagedWorktreeRemoval { request, root } => {
|
||||
self.chat_widget.confirm_managed_worktree_removal(request, root);
|
||||
}
|
||||
AppEvent::RemoveManagedWorktree { request, root } => {
|
||||
if self.chat_widget.worktree_request_is_current(&request)
|
||||
&& !request.cwd.starts_with(&root)
|
||||
{
|
||||
let codex_home = self.config.codex_home.to_path_buf();
|
||||
let tx = self.app_event_tx.clone();
|
||||
tokio::spawn(async move {
|
||||
let result = crate::worktree_browser::remove(
|
||||
codex_home,
|
||||
request.cwd,
|
||||
root.clone(),
|
||||
)
|
||||
.await
|
||||
.map_err(|error| error.to_string());
|
||||
tx.send(AppEvent::ManagedWorktreeRemoved { root, result });
|
||||
});
|
||||
}
|
||||
}
|
||||
AppEvent::ManagedWorktreeRemoved { root, result } => match result {
|
||||
Ok(()) => self.chat_widget.add_info_message(
|
||||
format!("Removed worktree at {}. Thread history was kept.", root.display()),
|
||||
/*hint*/ None,
|
||||
),
|
||||
Err(error) => self.chat_widget.add_error_message(format!(
|
||||
"Could not remove worktree at {}: {error}",
|
||||
root.display()
|
||||
)),
|
||||
},
|
||||
AppEvent::ChangeWorkingDirectory {
|
||||
thread_id,
|
||||
requested_cwd,
|
||||
|
||||
Reference in new issue
Block a user