Skip to content

agent: Fix find_or_create repository to support remote#54074

Merged
eholk merged 11 commits intomainfrom
remote-find-repositories
Apr 16, 2026
Merged

agent: Fix find_or_create repository to support remote#54074
eholk merged 11 commits intomainfrom
remote-find-repositories

Conversation

@Anthony-Eid
Copy link
Copy Markdown
Contributor

@Anthony-Eid Anthony-Eid commented Apr 16, 2026

Summary

Follow up to: #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:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 16, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Apr 16, 2026
@eholk eholk merged commit 302e591 into main Apr 16, 2026
31 checks passed
@eholk eholk deleted the remote-find-repositories branch April 16, 2026 23:36
@eholk
Copy link
Copy Markdown
Contributor

eholk commented Apr 16, 2026

/cherry-pick preview

@zed-zippy
Copy link
Copy Markdown
Contributor

zed-zippy Bot commented Apr 16, 2026

🍒💥 Cherry-pick did not succeed
https://github.com/zed-industries/zed/actions/runs/24539610974

@zed-zippy
Copy link
Copy Markdown
Contributor

zed-zippy Bot commented Apr 16, 2026

🍒💥 Cherry-pick did not succeed
https://github.com/zed-industries/zed/actions/runs/24539614213

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]>
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

Development

Successfully merging this pull request may close these issues.

2 participants