Skip to content

feat(app): pin Home sessions - #61647

Closed
s63388951-design wants to merge 3 commits into
anomalyco:devfrom
s63388951-design:home-session-pin
Closed

s63388951-design wants to merge 3 commits into
anomalyco:devfrom
s63388951-design:home-session-pin

Conversation

@s63388951-design

@s63388951-design s63388951-design commented Nov 4, 2026 •

Copy link
Copy Markdown

Summary

Adds a per-session Pin to the desktop/web Home session list. Pinned sessions appear in a dedicated Pinned group at the top, with a pin icon and a quiet accent bar. Pinning is client UI state, kept per server; it does not mutate session data or server-side ordering.

Changes

  • New home/sessions/pins.ts persisted store: Persist.global("home.sessions.pinned"), keyed by ServerConnection.key.
    • Desktop: drafts.sqlite state table.
    • Web: localStorage (opencode.global.dat:home.sessions.pinned).
  • Home controller:
    • partitions pinned records before the visible limit;
    • adds a Pinned group;
    • exposes isPinned / togglePin;
    • prunes pins when a session is deleted.
  • Retention:
    • keep set threaded through homeSessionsQuery, loadHomeSessionIndex, and retainHomeSessions, so a pinned session survives the per-directory 64-row window.
    • The recently-closed-tabs menu shares the same keep set.
  • Row UI:
    • Pin / Unpin context-menu item;
    • pin icon before the title;
    • data-pinned attribute and left accent bar;
    • Pinned group header with pin icon.
  • English i18n keys: home.sessions.group.pinned, common.pin, common.unpin.
  • Added a pin icon to the UI artwork catalog.

Verification

  • bun typecheck: no type errors in 1,896 files.
  • packages/app home session unit tests: 26 pass.
  • packages/app/e2e/regression/home.spec.ts: 15 passed.
    • New case: pin → Pinned group + data-pinned; reload → still pinned; unpin → group removed.
  • home-session-index-benchmark run before/after. The no-pin path keeps the original slice/sorted fast paths; no structural regression observed. Benchmark numbers vary on this machine.

Notes

  • Pin is client-local and per server, matching the existing TUI pin behavior. Cross-device sync would require server-side metadata or a new API.
  • No session rows or schema are changed.
  • This PR intentionally implements only Pin, not a separate favorites collection.

Added by the opencode bot (AI-generated).

Fixes #55764
Fixes #59906

Related: #59220

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach looks sound, but there's one pin-state problem worth fixing before merge. I checked it by reading the code and by running the src/home/sessions unit tests (26 pass) and tsc -b for packages/app (clean). I couldn't run the UI or the new Playwright test here (no browser), so a short before/after screenshot or video of Home with a pinned session would help.

Public API: unchanged. Pins are client-only state in a new persisted key, home.sessions.pinned.

The concern: the pin store is created once in the Home controller and again in the recently-closed-tabs menu. Their copies don't sync with each other (see the inline comment).

Fixes #55764
Fixes #59906
Related: #59220

return {
...homeSessionsQuery(conn, ctx),
enabled: state.open && recent().length < 10 && ctx?.sdk.connection.status() === "connected",
...homeSessionsQuery(conn, ctx, () => new Set(pins.ids(ServerConnection.key(conn)))),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a second persisted(Persist.global("home.sessions.pinned")) copy, separate from the one in the Home controller. Persist.global doesn't set sync, so the two copies never share updates. This one lives in the titlebar for the whole session and keeps the pins it read when it started.

When the menu's fetch runs, it writes the same ["home-sessions", conn] cache entry with that stale keep set. A session pinned since then, and later pushed past the 64-row window, gets dropped from Home until the controller fetches again. Separate desktop windows have the same problem: each window writes its own full pinned record, so one window's pin can wipe out another's.

Possible fixes: share a single pin store (a context or provider, or sync: true on the target), or have the menu not depend on pins at all.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commits add tab-strip pinning and then revert it, so the code is the same as at my last review. The point about the recently-closed-tabs menu keeping its own copy of the pin store, which doesn't sync with Home's, is still open. Public API: unchanged.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Nov 7, 2026
@github-actions github-actions Bot closed this Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow pinning sessions on the new experimental view. [FEATURE]: Session pinning in the Desktop app (TUI parity)

1 participant