agent: Fix find_or_create repository to support remote#54074
Merged
Conversation
Co-authored-by: Smit Barmase <[email protected]>
This allows remote users of the git store API to have the same cleanup as local users in the archive thread call stack
eholk
approved these changes
Apr 16, 2026
Contributor
|
/cherry-pick preview |
Contributor
|
🍒💥 Cherry-pick did not succeed |
Contributor
|
🍒💥 Cherry-pick did not succeed |
eholk
pushed a commit
to eholk/zed
that referenced
this pull request
Apr 17, 2026
…s#54074) ### Summary Follow up to: zed-industries#54001 This PR makes `agent_ui::thread_worktree_archive::find_or_create_repository` whether or not the repository it's searching for is on a remote machine. In the case where it's on a remote machine that has an active connection in Zed's connection pool, we return the repository; otherwise, we error out. I implemented it this way so archiving a thread on a remote machine that isn't connected deletes the metadata without showing a remote connection modal to a user. In the future, we can work around this by having better git worktree garbage collection, where remote machines remove git worktree's that were created by Zed and have no thread metadata on connection too. Finally, this PR gets archive threads working on remotes! #### Follow Ups 1. Replace instances of `std::fs` with Zed's Fs trait in the archive thread codepaths 2. Make archive thread work properly for workspace's that are not open (local and remote) Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --------- Co-authored-by: Smit Barmase <[email protected]>
eholk
added a commit
that referenced
this pull request
Apr 17, 2026
Cherry picks for today's preview release, bringing the v0.233.x branch up to date with fixes for archive threads on remotes and sidebar thread time ordering. ### Cherry-picked PRs Requested for this release: - #54074 — agent: Fix `find_or_create` repository to support remote - #54173 — sidebar: Fix sidebar thread times Pulled in as dependencies so the requested PRs apply cleanly (preferring to carry over additional changes rather than modify the cherry-picked patches): - #53991 — Only archive worktrees that Zed created - #54001 — agent: Support remote archive thread git operations - #54014 — Avoid showing draft threads in the sidebar or storing them in the database - #54088 — Use Fs abstraction for worktree directory removal ### Conflict resolution notes - **#54014** — The previous omnibus cherry-pick (#54111) pulled in later refactors that extracted `LIST_QUERY` to a `const` without including #54014's `WHERE session_id IS NOT NULL` filter or its draft-cleanup migration. I applied the filter to the existing `const LIST_QUERY` and kept the branch's `run_thread_metadata_migrations` helper in the affected test, rather than reverting to #54014's inline forms. - **#54173** — On v0.233.x, `sidebar_tests.rs` still contains `test_search_finds_threads_hidden_behind_view_more` (removed from main by #53956, which isn't on this branch). That test calls `save_thread_metadata`, so #54173's signature change — adding an `interacted_at: Option<DateTime<Utc>>` parameter — required a mechanical `None,` argument added to this one additional call site beyond what the cherry-pick touched. No changes were made to the substance of any cherry-picked patch. Release Notes: - N/A --------- Co-authored-by: Richard Feldman <[email protected]> Co-authored-by: Anthony Eid <[email protected]> Co-authored-by: Max Brunsfeld <[email protected]> Co-authored-by: Smit Barmase <[email protected]> Co-authored-by: Cameron Mcloughlin <[email protected]> Co-authored-by: Ben Brandt <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow up to: #54001
This PR makes
agent_ui::thread_worktree_archive::find_or_create_repositorywhether or not the repository it's searching for is on a remote machine. In the case where it's on a remote machine that has an active connection in Zed's connection pool, we return the repository; otherwise, we error out.I implemented it this way so archiving a thread on a remote machine that isn't connected deletes the metadata without showing a remote connection modal to a user. In the future, we can work around this by having better git worktree garbage collection, where remote machines remove git worktree's that were created by Zed and have no thread metadata on connection too.
Finally, this PR gets archive threads working on remotes!
Follow Ups
std::fswith Zed's Fs trait in the archive thread codepathsSelf-Review Checklist:
Release Notes: