Skip to content

sidebar: Include archived threads in the thread switcher dropdown - #58215

Closed
KevinLaveto wants to merge 1 commit into
zed-industries:mainfrom
KevinLaveto:pr/switcher-archived
Closed

sidebar: Include archived threads in the thread switcher dropdown#58215
KevinLaveto wants to merge 1 commit into
zed-industries:mainfrom
KevinLaveto:pr/switcher-archived

Conversation

@KevinLaveto

Copy link
Copy Markdown
Contributor

Summary:

The thread switcher dropdown (the per-project popover triggered by
ToggleThreadSwitcher) sources its entries from the sidebar's
filtered list, which excludes archived threads. So archived agent
threads — even ones from the project you're currently in — are
unreachable from the dropdown. The only way back is to open the
Archive view.

This PR also pulls archived metadata from
ThreadMetadataStore::archived_entries(), scoped to currently-open
projects (so the entry has a valid Workspace to switch into), and
appends those to the switcher entries. They're de-duped against the
entries already sourced from contents.entries, then the existing
sort runs as before.

Implementation notes:

  • A seen_thread_ids: HashSet<ThreadId> is built while iterating the
    sidebar contents and then consulted while iterating archived
    entries to avoid double-listing.
  • Workspace resolution: each archived entry's folder_paths() is
    matched against the path lists of currently-open workspaces; if
    none matches, the archived entry is skipped (no workspace to switch
    to).
  • The agent-icon resolution is inlined as a simple match on the Agent
    variant (NativeAgent / Custom) rather than reusing
    resolve_agent_icon, which is a closure local to
    rebuild_contents that captures agent_server_store; that closure
    would also surface custom-agent SVG icons via the store, but
    routing that here would require plumbing the store into
    mru_entries_for_switcher for what is, visually, a minor icon
    fallback. Happy to thread it through if reviewers prefer.

Related work:

This pairs nicely with a planned follow-up PR that surfaces archived
threads in the sidebar's "Search threads…" content search as well.
With both, archived threads are reachable from the two natural search
entry points — the per-project dropdown (this PR) and the
cross-project sidebar filter — without users having to bounce into
the Archive view.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments — N/A
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior — extends an existing enumeration; manually verified.
  • Performance impact has been considered and is acceptable — one extra pass over the archived metadata, only when the switcher is built.

Release Notes:

  • Improved the thread switcher dropdown so it also lists archived threads from currently-open projects, so they're reachable without opening the Archive view.

The thread switcher (the per-project dropdown reached via
ToggleThreadSwitcher) only sourced entries from the sidebar's filtered
list, which excludes archived threads — so archived/closed agent threads
weren't reachable from it. The switcher now also pulls archived metadata
from ThreadMetadataStore::archived_entries, scoped to currently-open
projects (so the entry has a valid Workspace to switch to), de-duped
against the active entries already sourced from the sidebar list.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 1, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jun 1, 2026
@danilo-leal

danilo-leal commented Jun 1, 2026

Copy link
Copy Markdown
Member

Heya, thanks for the PR! On the one hand, I do think this is a reasonable change, but on the other, I also think it does not make sense to have archived threads be part of the thread switcher. I believe if you're archiving a thread, you want to intentionally have it hidden from the set of active threads, otherwise, you'd unarchive it. The thread switcher in particular is a surface for interacting with active threads, so I'm unsure whether this is a desirable change. What's the use case here, do you interact with threads with the history view toggled?

@KevinLaveto

KevinLaveto commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Fair point — you're right that this PR currently surfaces archived threads in the switcher unconditionally, which does blur the "switcher = active work" model you're describing.

Sharpening the proposal: what if archived threads only appear when there's an actual filter/query active in the switcher, listed under a demoted "Archived" subheader? The default dropdown then stays exactly as it is today (active only), and archive remains intentionally hidden by default — they only re-appear when you're explicitly looking for something specific.

Workflow this enables: archive aggressively to keep the active set clean, and if you later need to reference a closed thread from the same project (which I do find happens — context that's "done" but still useful), the switcher's filter can surface it without bouncing to the Archive view.

If that gated version feels more in line with how the switcher should behave, I'm happy to update the PR. If you'd rather keep archived strictly out of the switcher entirely, totally fine to close this one — the cross-thread search in #58219 covers most of the same workflow.

@KevinLaveto

Copy link
Copy Markdown
Contributor Author

Actually re-checking the diffs: I framed this incorrectly earlier. PR #58219 already surfaces archived threads in the sidebar's "Search threads…" filter on its own (one of its commits is sidebar: Surface archived threads in content search, demoted, another is sidebar: Include archived threads in "Search more" closed-ACP pass). So the archive-via-search workflow is fully covered there.

This PR is purely about the per-project switcher dropdown, which is a different surface — and your "switcher = active only" framing makes sense for it. Closing this one. Thanks for the pushback, it pointed me back at what each surface should be responsible for.

@KevinLaveto KevinLaveto closed this Jun 1, 2026
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 first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants