sidebar: Include archived threads in the thread switcher dropdown - #58215
sidebar: Include archived threads in the thread switcher dropdown#58215KevinLaveto wants to merge 1 commit into
Conversation
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.
|
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? |
|
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. |
|
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. |
Summary:
The thread switcher dropdown (the per-project popover triggered by
ToggleThreadSwitcher) sources its entries from the sidebar'sfiltered 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-openprojects (so the entry has a valid
Workspaceto switch into), andappends those to the switcher entries. They're de-duped against the
entries already sourced from
contents.entries, then the existingsort runs as before.
Implementation notes:
seen_thread_ids: HashSet<ThreadId>is built while iterating thesidebar contents and then consulted while iterating archived
entries to avoid double-listing.
folder_paths()ismatched against the path lists of currently-open workspaces; if
none matches, the archived entry is skipped (no workspace to switch
to).
variant (NativeAgent / Custom) rather than reusing
resolve_agent_icon, which is a closure local torebuild_contentsthat capturesagent_server_store; that closurewould also surface custom-agent SVG icons via the store, but
routing that here would require plumbing the store into
mru_entries_for_switcherfor what is, visually, a minor iconfallback. 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:
Release Notes: