feat: pin a session to the top of the sidebar - #180
Merged
Conversation
The session you keep returning to drifts down the list as new ones open above it, and the × sits one stray click away from ending it for good. Pinning answers both. A pinned card sorts to the head of its project's list and stays there across restarts, and it drops every close affordance it had: no × on hover, no "Close session" in the context menu, and the worktree it lives in refuses to be removed from the Pulls screen. Unpin and all of it comes back, including the slot in the list the card had before. The order has one owner. The store keeps the drag order and the pin flag and nothing else — `sortPinned` lifts the pinned cards over that order when the sidebar draws. Hoisting in the query too would cost a session its slot on every reload: the frontend would hydrate from an already hoisted list and have no order left to drop an unpinned card back into. Grouping falls out of the same list: groupByWorktree buckets by first appearance, so pinning a worktree's session carries its group to the top with it. The guard behind the hidden affordances is in requestClose, not in the provider's closeSession — removing a worktree closes its sessions through that same primitive, and a PTY that outlives `git worktree remove` takes the checkout down with it. Pulls refuses the removal up front instead, the way it already refuses a dirty checkout.
4 tasks
# Conflicts: # CHANGELOG.md
This was referenced Aug 7, 2026
Merged
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.
What
Pin a session so it sorts to the head of its project's sidebar list and cannot be closed by accident.
pinnedcolumn on the session row.groupByWorktreebuckets by first appearance.How
The order has one owner.
internal/storekeeps the drag order (ORDER BY position, rowid) plus the flag;sortPinnedlifts the pinned cards over that order at render time inSessionSidebar. Hoisting in the query as well would cost a session its slot on every reload — the frontend would hydrate from an already hoisted list and have nothing left to drop an unpinned card back into. That was a real bug caught while smoke-testing, not a hypothetical.The close guard sits in
useWorktreeClose.requestClose, not in the provider'scloseSession: removing a worktree closes its sessions through that same primitive, and a PTY outlivinggit worktree removetakes the checkout with it.Pulls.removeWorktreerefuses up front instead.Test plan
gofmt -l .clean,go vet ./...clean,go test ./...green (25 packages)pnpm checkclean (13 pre-existing a11y warnings),pnpm testgreen (644),pnpm buildsucceedssortPinned/setSessionPinnedreducers (frontend),SetSessionPinnedpersistence and the untouched row order (backend)Rename | Unpin | Pull requestwhen pinned,Rename | Pin | Pull request | Close sessionwhen notCHANGELOG.md[Unreleased]entry included.