Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: side chat and fork surfaces for web and mobile #9437

Closedamanthanvi(GitHub profile, opens in a new tab)wants to merge 38 commits intomain fromrefs/pull/9437/headopened View on GitHub

This is the second half of the two-PR split of #9396. It depends on #9436 (contracts, server, shared client state). This diff is against main until that lands, so it currently includes those commits. The work that belongs to this PR touches only apps/web, apps/mobile, and docs/user.

What changed

Web and desktop

  • A fork action on completed assistant responses opens a small menu: Open side chat or Fork to new thread. Latest-turn providers only offer it on the latest completed response; unsupported providers never show it.
  • The same two actions live in the thread header menu, the sidebar context menu, and the command palette (disabled with a reason when the provider cannot fork or no turn has completed), plus chat.sideChat (mod+shift+b) and an unbound chat.forkThread. All entry points share one hook and resolve the active conversation, so pressing a shortcut while a side chat pane has focus forks that side chat.
  • A side chat renders in the right panel as a per-thread surface and reuses the chat view with its own composer handle. It omits the panel-opening actions (diff, terminal, Agents, files), which would otherwise target the host thread. The pane waits for the new thread's shell before opening, so there is no empty-state flash.
  • Reverse states: closing the tab is local, and the parent's header menu lists its side chats to reopen them. Promote to thread clears the side-chat flag, closes the surface, and navigates to the thread. Every fork shows a Forked from anchor back to the source, including on an empty fork. Side chats whose parent was deleted reappear as ordinary threads. Deleting a parent counts its side chats when deciding whether a worktree is orphaned.
  • Persisted right-panel state gains the side-chat surface kind and drops stale surfaces on hydration.
  • Web exposes one thread-list hook, useThreadShells, which returns visible shells. Worktree ownership checks read the unfiltered atom directly rather than through a second hook.

Mobile

The same actions appear on completed responses. Side chats open as full-screen threads with Promote to thread and Delete in the thread menu, and a parent's menu lists its side chats. The home and v2 lists hide side chats, and rows repaint when the latest turn or fork capability changes. The mobile client reapplies the iOS header menu when side chats change.

Docs

This PR adds docs/user/side-chats-and-forks.md and updates the keybinding docs, a sidebar note, and the docs index.

Why

In a long thread, a user often wants to ask a side question without spending the main context. At a decision point, they may want to try a second direction without losing the first. See #9436 for the mechanism.

UI changes

Captured on an isolated dev server seeded with a copy of real data (Claude and Codex threads).

BeforeAfter
Completed response actions: copy and timestamp only
before
A fork action joins them
after

Fork menu on a completed response:

fork menu

Side chat open in the right panel beside its parent, with the Forked from anchor and Promote to thread:

side chat open

Thread header menu with Open side chat, Fork to new thread, and the Side chats submenu listing existing side chats. This capture predates a later rename, so the menu still reads "Fork thread"; the shipped label is "Fork to new thread" everywhere.

header menu

Command palette entries, disabled with a reason when the thread has no completed turn yet:

command palette

Promoted side chat as an ordinary thread in the sidebar, keeping its Forked from anchor:

promoted

Codex (any-turn) thread: side chat forked from an earlier completed response, then promoted:

codex side chat codex promoted

Mobile, on the iOS Simulator (iPhone 17 Pro, dev client built from this branch, paired to the same seeded backend):

Fork menu on a completed responseSide chat opened full-screen with the Forked from anchor
mobile fork menumobile side chat
Side chat thread menu: Promote to thread and DeleteAfter promote: the thread appears in the list as "Worktree Storage Insights and Pruning (1)"
mobile menumobile promoted

Fork titles follow the Codex app convention: the source title plus a counter, so the first fork of a thread is "Title (1)" and the next is "Title (2)".

Recording of the flow (fork from an earlier Codex response, side chat opens, header menu, promote, navigate back via the anchor):

https://raw.githubusercontent.com/amanthanvi/t3code/pr-evidence-2026-09/evidence/side-chats/side-chats-flow.mp4

Verification

  • vp test run across the 44 test files both slices touch: 1195 tests passed
  • One failure in AgentSessionScanner.test.ts ("excludes sandboxes reached through a symlink into the worktrees dir") is pre-existing and unrelated: it fails the same way on a worktree that touches none of these files, because macOS resolves /var to /private/var
  • web and mobile typechecks pass with no errors; vp fmt and vp lint clean on changed files
  • Integrated web pass on an isolated dev server (vp run dev from the worktree, state seeded from a VACUUM INTO snapshot): fork action, side chat opening with lineage anchor and promote, header menu, command palette, promote navigation, no console errors
  • Integrated iOS Simulator pass on the dev client built from this branch: fork menu, side chat with lineage anchor, promote, list update; see evidence above
  • Two tests cover the mobile reorder fix, and reverting the filter first confirmed both. Without the filter, the move plan reads ["first", "side", "last"] instead of ["first", "last"], and the keyless-neighbor rewrite assigns an order key to environment-1:side, a row the user cannot see
  • A test covers the sidebar fork copy the same way. Reverting the branch fails it with - "Open this thread to fork an earlier response."

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Implemented by GPT-5.6 Sol via Codex and Claude Fable 5.1 via Claude Code, with two rounds of adversarial review by Claude Opus 5 and GPT-5.6 Sol.

Note on the bot summaries below: they name the migration as 048, which was its number when they ran. It is 051 on the current branch, renumbered so it does not collide with the 050 that landed on main.


Note

Medium Risk Touches orchestration fork startup, projection list/search semantics, and thread deletion/navigation; incorrect side-chat visibility or latest-turn fork races could confuse users or strand threads.

Overview Adds mobile support for forking assistant responses into a side chat or new thread, aligned with provider sessionFork rules (any-turn vs latest-turn) and ready-checkpoint gating.

Thread lists now hide side chats whose parent still exists (home groups and thread list v2); orphaned side chats stay visible and searchable. New sideChats.logic helpers drive that filtering plus fork eligibility and side-chat menu items.

Thread UI wires a fork menu on completed assistant messages, a Forked from link in the feed, header/Android overflow actions (Promote to thread, Delete, Side chats submenu), and navigation after fork via thread.fork plus waitForThreadShell / useSideChatsByParent.

Server projection/read model (also in this diff) persists fork and side_chat on thread projection, hydrates them in snapshots, applies a shared top-level thread SQL predicate (search and “first thread” picks), and adds getThreadTurnState / getForkSourceHead for fork validation. Provider command reactor tests cover lazy fork startup, source-instance/model inheritance, latest-turn races, and resume-cursor behavior.

Default keybinding chat.sideChat is mod+shift+b; chat.forkThread is removed from defaults.

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

Note

Add thread forking and side-chat surfaces for web and mobile

  • Introduces a full-stack thread.fork command: the orchestration normalizer validates source turns and provider fork capability, the decider emits thread.created with inherited metadata and fork lineage, and the projector persists fork origin and sideChat state.
  • Provider adapters declare sessionFork capability (any-turn for Codex, latest-turn for Claude and OpenCode, unsupported for Cursor, Grok, and Antigravity). Adapters that support forking validate source cursors and call native fork APIs; ProviderService.startSession resolves fork sources to provider cursors and rejects mismatched or unsupported forks.
  • Web client adds fork actions in the sidebar, command palette, and assistant-message menus; an embedded side-chat right-panel surface with promotion; and keybinding mod+shift+b for side chat. Mobile client adds fork controls in ThreadFeed, side-chat navigation and promotion in ThreadRouteScreen, and filters attached side chats from home and thread lists.
  • Persistence migration 048 adds nullable fork JSON and non-null sideChat integer columns to projection_threads. Thread-list queries hide side chats whose parent exists and show orphaned side chats.
  • Risk: ProviderSessionStartInput now rejects requests that include both resumeCursor and forkFrom; existing callers sending both fields will fail validation. useThreadShells (web and mobile) now returns only visible shells, so consumers that relied on side chats appearing in that hook must switch to useAllThreadShells.
Macroscope summarized 4ce0f6c.

Summary by CodeRabbit

  • New Features
    • Added thread forking and side chats across web and mobile, including menus, panels, navigation, promotion, deletion, and fork-origin indicators.
    • Added provider-aware fork support, with availability based on provider capabilities and completed responses.
    • Added keyboard shortcuts for creating side chats and forks.
  • Bug Fixes
    • Side chats now stay out of primary thread lists while their parent exists, remain searchable when orphaned, and no longer interfere with thread ordering or worktree cleanup.
  • Documentation
    • Added user guidance for side chats, forks, provider support, and keyboard shortcuts.

Closes discussions

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

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

      🟡 Medium components/Sidebar.tsx:3186

      The sidebar disables both fork actions for an "any-turn" provider when the current turn is running, even if the thread has a prior completed assistant turn. resolveForkEntryAvailability needs thread.messages to find that fallback target; pass it here so valid forkable responses remain available.

      ✅ Resolved in 7e91ea34e4969124910ad5d38775bdbd60604812

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

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/48c321c69e0ebd6668214dbf528ee1a5fa2ff24a/apps/web/src/components/CommandPalette.tsx#L1079

      Project search can navigate to a hidden side-chat route instead of the project's ordinary latest thread. Both getLatestThreadForProject paths pass threads that still include sideChat: true, so a recently active side chat can win the selection; filter side chats out before selecting the latest project thread.

      ✅ Resolved in 4bf1ce5d4e99b5515c1a94f9db6d43865f9796c9

    3. Agreed, fixing in the next push (the source-turn validation and stop-cleanup items are addressed on #9436, which this PR stacks on).

    4. Agreed, fixing in the next push (the source-turn validation and stop-cleanup items are addressed on #9436, which this PR stacks on).

    5. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    6. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    7. Fixed in 4bf1ce5d4 (source-turn validation and stop-cleanup in #9436 at db346db35).

    8. Fixed in 4bf1ce5d4 (source-turn validation and stop-cleanup in #9436 at db346db35).

    9. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    10. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

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

      Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting).

      This review would cost an estimated $11.21, which exceeds your per-review limit of $10.00.

      The top 3 files driving up this estimate:

      FileDiff SizeEstimate
      apps/web/src/components/ChatView.tsx29.74KB$1.49
      apps/mobile/src/features/threads/ThreadRouteScreen.tsx16.47KB$0.82
      apps/server/src/orchestration/Layers/ProviderCommandReactor.ts14.35KB$0.72

      Tip

      To get this pull request reviewed, you can:

      1. Comment @macroscope-app on this PR to request a manual review (monthly spend limits still apply).
      2. Exclude the file(s) above from review by adding a pattern to your .macroscope/ignore.md — note that creating this file replaces Macroscope's built-in default ignores rather than extending them.
      3. Raise your cost limit in your workspace billing settings.
      [Turn off this reminder going forward](https://app.macroscope.com/pingdotgg/settings#Personal)
    12. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR introduces a large, cross-platform fork and side-chat capability spanning provider sessions, orchestration, persistence, thread visibility, and new web/mobile surfaces. It also adds a default shortcut, so the scope and runtime impact require human review.

      Not approved because:

      • Per-review cost limit exceeded (workspace setting). Approvability relies on correctness review in order to determine eligibility
      Review your spending limits in [Billing settings](https://app.macroscope.com/pingdotgg/settings/billing), or comment `@macroscope-app review this PR` to bypass the limit and review now. You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    13. Stale Bugbot comment from a previous run.

Sign in to join this conversation.