Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: side chats and forking #9396

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

Draft: opened for discussion per CONTRIBUTING.md. This implements the community asks in #7311 (Codex-style /side side chats) and #6707 / #1404 (branch a conversation from a message). It is larger than the preferred PR size because a fork feature with no way to see a fork is not a feature. Screenshots and a short video will be added before this leaves draft; happy to split (contracts+server, then web+mobile) if that helps review.

What Changed

One mechanism, two presentations.

  • Fork. A new thread in the same project that inherits the source's model, modes, branch, and worktree and records immutable lineage (source thread, turn, and message). Its transcript starts empty. The provider session carries the inherited context and is created lazily on the fork's first turn: Codex thread/fork with the source turn as lastTurnId, Claude resume with forkSession, OpenCode session.fork. Cursor and Grok report sessionFork: "unsupported" and the UI disables the actions. A fork never resumes the source session; once the fork has its own session, restarts resume that.
  • Side chat. A fork flagged sideChat. Hidden from every thread list and rendered in the right panel beside its parent on web and desktop, or as a full-screen thread on mobile. Promote flips the flag through the existing meta update; closing a tab is local; delete is the normal thread delete. Forked threads show a "Forked from" anchor back to the source.
  • Entry points. A fork action on completed assistant responses (latest-turn providers only offer it on the latest completed response), the thread header menu, the command palette, chat.sideChat (mod+shift+b), and an unbound chat.forkThread. Deleting a parent counts its side chats when deciding whether a worktree is orphaned.
  • Contracts. ThreadForkOrigin, optional fork/sideChat on thread and shell, thread.fork command (decides to thread.created), optional sideChat on thread.meta.update, forkFrom on provider session start, ServerProvider.sessionFork. Migration 047 adds fork_json and side_chat to projection_threads.
  • Docs. docs/user/side-chats-and-forks.md, keybinding and sidebar notes, glossary entries.

Why

Long-running threads need a place to ask a side question without spending the main context, and decision points need a way to try a second direction without losing the first. Reusing the thread model keeps this small: no new event type, no transcript copying, and lineage that later work such as merge-back can read.

UI Changes

Screenshots and a short recording to follow before marking ready for review.

Verification

  • 34 touched test files: 752 tests passed across two targeted runs
  • Package typechecks for contracts, client-runtime, shared, server, web, and mobile all pass
  • vp fmt and vp lint clean on all 90 changed code files
  • No browser or simulator pass yet

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 independent designs and two rounds of adversarial review by Claude Opus 5 and GPT-5.6 Sol.

Note

Add side chats and thread forking across server, web, and mobile

  • Adds the thread.fork orchestration command with source thread, turn, message, timestamp, and sideChat lineage. The decider emits a thread.created event inheriting project, model, runtime, and branch fields from the source.
  • Provider adapters implement session-fork support: Claude and OpenCode support latest-turn, Codex supports any-turn via a native thread/fork RPC, and Cursor and Grok report unsupported. ProviderService.startSession resolves the source cursor, validates provider compatibility, and creates the fork session or resumes an existing target.
  • Server persistence: migration 047 adds nullable fork_json and NOT NULL side_chat columns to projection_threads. The projection pipeline and snapshot queries persist and return fork lineage and side-chat state, and default thread-selection and search queries exclude side chats.
  • Web UI: side chats render in a right-panel surface with their own composer; ChatHeader, AssistantForkMenu, threadActionMenu, and the command palette expose open-side-chat and fork-thread actions. A mod+shift+b shortcut opens a side chat from the active thread.
  • Mobile UI: ThreadRouteContent can fork an eligible assistant response into a side chat or new thread, promote or delete a side chat, open child side chats, and navigate to a fork's source. Side chats are filtered from home and v2 thread lists.
  • Risk: rightPanelStore persisted-state version bumped from 11 to 12; the migration in rightPanelStore.ts discards side-chat records with inconsistent IDs or non-string thread IDs. Providers bound to a different instance than the fork source are rejected in ProviderService.ts.
📊 Macroscope summarized 1aea09e. 61 files reviewed, 16 issues evaluated, 3 issues filtered, 12 comments posted

🗂️ Filtered Issues

apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 513: listActiveThreadRows populates the normal getShellSnapshot navigation snapshot but filters only deleted and archived threads; it never excludes side_chat = 1. Consequently every side-chat row is returned in the main shell thread list (with sideChat: true), so clients that bootstrap normal navigation from this snapshot display side chats instead of keeping them out of ordinary thread lists. [ Out of scope (triage) ]
apps/web/src/components/chat/MessagesTimeline.tsx — 0 comments posted, 1 evaluated, 1 filtered
  • line 794: transcriptHeader is only rendered inside LegendList, but the earlier rows.length === 0 && !isWorking return bypasses that list entirely. A newly created fork has an empty transcript and is not working, so its only view is the generic empty placeholder; the new “Forked from …” navigation control never appears until after the fork receives a message. [ Cross-file consolidated ]
packages/contracts/src/orchestration.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 884: ThreadMetaUpdateCommand accepts sideChat: true for any thread, including a thread without fork lineage. The decider persists this flag, while list views hide every sideChat === true thread and the side-chat grouping deliberately skips entries with no fork origin. Thus a client command can make an ordinary thread disappear from both the normal list and every parent side-chat panel, leaving it effectively inaccessible except by its direct URL. [ Cross-file consolidated ]
    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

      https://github.com/pingdotgg/t3code/blob/1aea09ea10e21c15bbbc2397a944c8b1c4ae09ad/apps/mobile/src/features/threads/ThreadFeed.tsx#L2346

      Visible assistant rows do not rerender when latestTurn completes or forkCapability changes, so the fork control remains absent until an unrelated extraData change or remount occurs. Although these values are captured by renderItem, listAppearanceData is the extraData used to repaint rows and omits both; include them there and in its dependency list.

      ✅ Resolved in 1fe6f41b96be4b6be4207c70f98cf07fb77c3ec0

      @@ -62,3 +71,4 @@
      6271 },
      6372 ]
      6473 : []),
      74+ ...(state.forking
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium components/threadActionMenu.logic.ts:74

      The sidebar never shows Open side chat, Fork thread, or existing side chats because handleThreadContextMenu omits the forking property when calling buildThreadActionMenuItems, so the new block at line 74 is always skipped there. Pass the thread's forking state into this call, matching the header menu.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/threadActionMenu.logic.ts around line 74:
      
      The sidebar never shows `Open side chat`, `Fork thread`, or existing side chats because `handleThreadContextMenu` omits the `forking` property when calling `buildThreadActionMenuItems`, so the new block at line 74 is always skipped there. Pass the thread's forking state into this call, matching the header menu.

      Agreed, fixing in the next push.

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

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

    3. Agreed, fixing in the next push.

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

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

    6. Split into two PRs as offered: #9436 (contracts, server, shared client state) and #9437 (web and mobile surfaces, with screenshots and a recording). Both are rebased onto current main and are ready for review; this PR stays open only as the whole-feature reference and can be closed once the split is preferred.

    7. Note

      🤖 GPT-6 Astra (preview) responding on behalf of Theo

      This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened.

      Closing this whole-feature branch in favor of the author's split PRs: #9436 for contracts, server, and shared state, and #9437 for web and mobile. Both remain open and contain later fixes. The original implementation and review history remain available here, while review continues on those two PRs.

Sign in to join this conversation.