Skip to content

sidebar: Fix archive loop when a thread's worktree folder was deleted - #65578

Merged
smitbarmase merged 2 commits into
mainfrom
sb/fix-archive-hang
Oct 14, 2026
Merged

smitbarmase merged 2 commits into
mainfrom
sb/fix-archive-hang

Conversation

@smitbarmase

@smitbarmase smitbarmase commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Closes #57957
Closes #65188
Closes #64977

Archiving a thread whose linked worktree had been deleted outside Zed did nothing and kept a CPU core busy.

To archive a thread whose workspace is closed, we open the workspace first and then call archive_thread again. With the worktree folder gone, opening falls back to the main project, so the thread's workspace never opens, and archive kept trying forever.

Now the second pass never opens a workspace. If the worktree is gone, we just archive the thread.

Left out on purpose:

  • Archiving can still switch the window to the main project once, because of that fallback. Fixing it means changing find_or_create_workspace for all of its callers, so I'd rather do it separately.
  • close_terminal follows the same pattern but can't loop, so I left it alone.

Before:

Release Notes:

  • Fixed archiving an agent thread doing nothing and keeping a CPU core busy when its linked worktree folder had been deleted.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Oct 14, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Oct 14, 2026
@smitbarmase
smitbarmase added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit df134bf Oct 14, 2026
38 checks passed
@smitbarmase
smitbarmase deleted the sb/fix-archive-hang branch October 14, 2026 09:16
amirkhakshour pushed a commit to SourceShift/zed-mini-ork that referenced this pull request Oct 18, 2026
…zed-industries#65578)

Closes zed-industries#57957

Archiving a thread whose linked worktree had been deleted outside Zed
did nothing and kept a CPU core busy.

To archive a thread whose workspace is closed, we open the workspace
first and then call `archive_thread` again. With the worktree folder
gone, opening falls back to the main project, so the thread's workspace
never opens, and archive kept trying forever.

Now the second pass never opens a workspace. If the worktree is gone, we
just archive the thread.

Left out on purpose:

- Archiving can still switch the window to the main project once,
because of that fallback. Fixing it means changing
`find_or_create_workspace` for all of its callers, so I'd rather do it
separately.
- `close_terminal` follows the same pattern but can't loop, so I left it
alone.

Before:
<img width="250"
src="https://github.com/user-attachments/assets/e66a5675-0e84-4a59-a316-a36f289b4ff6"
/>

Release Notes:

- Fixed archiving an agent thread doing nothing and keeping a CPU core
busy when its linked worktree folder had been deleted.

---------

Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

2 participants