Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(sidebar-v2): bring back thread pinning #5312

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/5312/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Sidebar v2 shipped without a way to keep an important thread from drifting: active cards hold creation order, and the settle/snooze lifecycle eventually parks everything on a shelf. There was no way to say "this one stays on top."

Pinning brings that back. Pinned threads render as full cards above the inbox behind a thin divider (no header text — the pin glyphs carry the meaning). A pin overrides the lifecycle: while pinned, a thread can neither auto-settle out of sight nor be hidden by snooze state, and its settle/snooze affordances yield to a single Unpin. Unpinning returns the thread to wherever it would otherwise classify.

Pin state is server-backed and syncs across devices, following the snooze template layer for layer:

  • Contracts: optional pinnedAt on thread + shell (pre-pin servers still decode), thread.pin/thread.unpin commands and events, and a threadPinning capability so clients hide the affordance under version skew.
  • Server: decider cases (idempotent by re-emission, archived threads rejected; no other invariants — a pin only ever promotes visibility), projector, projection pipeline, pinned_at column via migration 036, and snapshot/persistence plumbing.
  • Web: pinned partition ahead of snooze/settle, pin glyph on cards, Unpin hover action, Pin/Unpin in the context menu.
  • Mobile: same partition in thread list v2, Unpin as the swipe primary on pinned rows, Pin in card long-press menus.

Covered by focused tests at each layer: decider pin/unpin invariants, projector lifecycle, persistence round-trip, client reducer events, and a mobile partition test proving a pinned thread cannot vanish into a shelf.


Built by Claude Fable 5 via Claude Code.

🤖 Generated with Claude Code


Note

Medium Risk Touches orchestration decider event bundles and list classification across web, mobile, and DB projections; behavior is well-tested but pin/settle/snooze interactions affect core inbox ordering.

Overview Adds thread pinning end-to-end so important threads stay as full cards above the inbox instead of drifting into settle/snooze shelves.

Contracts & clients: Optional pinnedAt on thread shells, thread.pin / thread.unpin commands and events, and a threadPinning capability (same version-skew pattern as snooze). Client runtime dispatches pin/unpin; web and mobile gate UI on the capability and surface Pin/Unpin in context menus (mobile long-press menus + pin glyph on pinned rows).

Server & persistence: Decider handles pin/unpin (idempotent re-emission, archived threads rejected). Pinning promotes visibility by also emitting unsettle/unsnooze when needed; settling a pinned thread also emits thread.unpinned. Projector, projection pipeline, and queries carry pinnedAt; migration 036 adds pinned_at to projection_threads. Server advertises threadPinning: true.

List behavior (web sidebar v2 + mobile thread list v2): Partition order is pinned → active → snoozed → settled. Snooze still hides a thread (pin preserved underneath); pinned threads skip settled classification. Tests cover decider, projector, persistence, reducer, and mobile partition parity with web.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5d8f568146f600a0cc98ae8a41d007688972b4df. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add thread pinning to sidebar v2 on web and mobile

  • Adds a pinned block that appears above the active inbox in both the web sidebar (SidebarV2.tsx) and mobile thread lists, showing pinned threads in creation order with a pin icon.
  • Introduces thread.pin and thread.unpin orchestration commands with full decider, projector, and projection pipeline support; settling a pinned thread also emits thread.unpinned.
  • Adds database migration 036_ProjectionThreadsPinned.ts to add pinned_at to projection_threads.
  • Pinning is gated by a new threadPinning server capability; environments not advertising this capability hide pin actions.
  • Pinned threads are exempt from auto-settle; snoozed pinned threads are hidden until they wake, then return to the pinned block.
Macroscope summarized 5d8f568.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: c90c084a-a72f-4953-88ec-706df2cdc316

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High

      https://github.com/pingdotgg/t3code/blob/fcb6cbd051a6226c847e586376f448a4f649df17/apps/mobile/src/features/home/HomeScreen.tsx#L795

      The renderV2Item callback passes handlePinThread and handleUnpinThread to ThreadListV2Row but omits both from its dependency array. If onPinThread or onUnpinThread changes identity, rows keep dispatching through the stale callbacks until an unrelated dependency trips a re-create. Add handlePinThread and handleUnpinThread to the dependency list.

      ✅ Resolved in 51f013f708c53cc427747d622c2609ca3cb5f15a

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      1 blocking correctness issue found. This PR introduces a complete thread pinning feature with new commands, events, database migration, and UI across web and mobile. As a new user-facing capability with multiple unresolved bugs identified (including high-severity issues with re-pin idempotency and mobile swipe actions), it warrants human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. [claude-fable-5] RESPONDING ON BEHALF OF THEO


      Real finding. Fixed in 51f013f70 — handlePinThread, handleUnpinThread, and pinningEnvironmentIds added to the dependency array (and the same omission in ThreadNavigationSidebar's render callback).

    6. @@ -506,0 +509,21 @@
      509+ // stamp invisible state — the pin would hold the card in place until
      510+ // a separate unpin.
      511+ if (thread.pinnedAt == null) {
      512+ return settledEvent;
      513+ }
      514+ return [
      515+ settledEvent,
      516+ {
      517+ ...(yield* withEventBase({
      518+ aggregateKind: "thread",
      519+ aggregateId: command.threadId,
      520+ occurredAt,
      521+ commandId: command.commandId,
      522+ })),
      523+ type: "thread.unpinned" as const,
      524+ payload: {
      525+ threadId: command.threadId,
      526+ updatedAt: occurredAt,
      527+ },
      528+ },
      529+ ];

      Settle leaves latent snooze

      Medium Severity

      When thread.settle runs on a pinned thread, the decider clears the pin but leaves snoozedUntil/snoozedAt unchanged. After unpin, list partition treats snooze before settled, so the thread moves to the snoozed shelf instead of the settled tail despite the user choosing Settle.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0f171bd7ee907839703aea8d0e7427ecbd668a66. Configure [here](https://www.cursor.com/dashboard/bugbot).
    7. @@ -82,3 +82,8 @@
      8282 { id: "delete", title: "Delete", image: "trash", attributes: { destructive: true } },
      8383 ];
      8484
      85+// Pinned rows: Settle stays the lifecycle action (settling clears the pin
      86+// server-side); Unpin is the menu-only escape hatch. Snooze is withheld —
      87+// it does not unpin, so the pin would override it invisibly.
      88+const PINNED_MENU_ACTIONS: MenuAction[] = [
      89+ { id: "settle", title: "Settle", image: "checkmark" },

      Pinned menu ignores settlement

      Low Severity

      Pinned rows always use PINNED_MENU_ACTIONS with Settle, regardless of settlementSupported. Swipe correctly falls back to Archive when settlement is unsupported, but long-press Settle hits the server guard and shows an error instead of offering archive like other legacy rows.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0f171bd7ee907839703aea8d0e7427ecbd668a66. Configure [here](https://www.cursor.com/dashboard/bugbot).
    8. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High

      https://github.com/pingdotgg/t3code/blob/5d8f568146f600a0cc98ae8a41d007688972b4df/apps/mobile/src/features/threads/thread-list-v2-items.tsx#L513-L517

      A pinned card's primary swipe action is still Settle (or Archive on legacy servers), not Unpin — so the main mobile swipe gesture on a pinned row settles or archives the thread instead of unpinning it. The pinnedRow flag only controls the pin glyph and the long-press menu item; it is never passed into resolveThreadListV2SwipeActions or the primaryAction memo, so the swipe path never produces an Unpin action. Route the pinned state into primaryAction selection and return handleUnpin for pinned rows.

        const primaryAction = useMemo(() => {
          if (pinnedRow && props.pinningSupported) {
            return {
              accessibilityLabel: `Unpin ${thread.title}`,
              icon: "pin.slash" as const,
              label: "Unpin",
              onPress: handleUnpin,
            };
          }
          // Pre-settlement server: archive is the swipe action, as in v1. (Slim
          // rows cannot occur here — unsupported environments never classify as
          // settled.)
      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/mobile/src/features/threads/thread-list-v2-items.tsx around lines 513-517:
      
      A pinned card's primary swipe action is still Settle (or Archive on legacy servers), not Unpin — so the main mobile swipe gesture on a pinned row settles or archives the thread instead of unpinning it. The `pinnedRow` flag only controls the pin glyph and the long-press menu item; it is never passed into `resolveThreadListV2SwipeActions` or the `primaryAction` memo, so the swipe path never produces an Unpin action. Route the pinned state into `primaryAction` selection and return `handleUnpin` for pinned rows.
    9. Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

      There are 4 total unresolved issues (including 2 from previous reviews).

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5d8f568146f600a0cc98ae8a41d007688972b4df. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -805,4 +843,4 @@
      805843 ? SLIM_MENU_ACTIONS
      806844 : swipeActions.secondary === "snooze"
      807845 ? snoozableCardMenuActions
      808- : CARD_MENU_ACTIONS
      846+ : cardMenuActions

      Mobile snoozed shelf lacks Unpin

      Medium Severity

      When a pinned thread is snoozed, its mobile long-press menu incorrectly shows only "Wake" and "Delete". The "Unpin" option is missing, requiring users to wake the thread before unpinning, which differs from web behavior.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5d8f568146f600a0cc98ae8a41d007688972b4df. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -632,0 +699,21 @@
      699+ updatedAt: occurredAt,
      700+ },
      701+ });
      702+ }
      703+ if (thread.snoozedUntil != null) {
      704+ promotionEvents.push({
      705+ ...(yield* withEventBase({
      706+ aggregateKind: "thread",
      707+ aggregateId: command.threadId,
      708+ occurredAt,
      709+ commandId: command.commandId,
      710+ })),
      711+ type: "thread.unsnoozed",
      712+ payload: {
      713+ threadId: command.threadId,
      714+ reason: "user",
      715+ updatedAt: occurredAt,
      716+ },
      717+ });
      718+ }
      719+ return promotionEvents.length > 0 ? [pinnedEvent, ...promotionEvents] : pinnedEvent;

      Re-pin emits promotion events

      High Severity

      thread.pin always emits thread.unsettled / thread.unsnoozed when settled or snooze fields are set, even on idempotent re-pin when pinnedAt is already set. Retries or duplicate pin commands on a pinned-and-snoozed thread can wake it early instead of no-op re-emission.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5d8f568146f600a0cc98ae8a41d007688972b4df. Configure [here](https://www.cursor.com/dashboard/bugbot).

Sign in to join this conversation.