Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(sidebar): pin chats within projects #3913

Closed12ya(GitHub profile, opens in a new tab)wants to merge 24 commits intomain fromrefs/pull/3913/headopened View on GitHub

What Changed

  • Persist pinned chat state per logical project.
  • Keep pinned chats above the normal thread sort order for each project.
  • Add hover pin and unpin controls without consuming title space.
  • Support pinning and unpinning by dragging a chat across the pinned divider.
  • Show a compact divider with a centered pin icon and distinct pin/unpin feedback colors.
  • Animate chats moving between pinned and regular sections.

Why

Important chats should stay easy to reach without being pinned globally across unrelated projects. Project-scoped pinning keeps each sidebar group predictable while preserving the existing thread sort order for unpinned chats.

The hover control provides a quick direct action, while divider-crossing drag behavior makes bulk sidebar organization feel natural.

UI Changes

Interaction demo:

https://github.com/user-attachments/assets/e7f8fd01-00dc-4ff6-84ee-15bf7d979f8f

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

Note

High Risk Wide renames of env vars, home dirs, API well-known paths, CI package filters, and release/deploy config can break local dev, upgrades, and production pipelines if secrets/vars are not updated; persisted state under old T3 keys may be ignored.

Overview This diff is a repo-wide rebrand and fork bootstrap, not the sidebar pinning work described in the PR title. Reviewers should treat the title/description as out of sync with the changes shown here unless additional commits exist outside this diff.

Product and package identity moves from T3 Code / @t3tools to V12 / @v12: root and app package.json names, desktop productName, npm CLI filters (v12, v12-relay, @v12/web), and Effect service tags (e.g. @v12/desktop/...). Imports and subpath exports shift to @v12/contracts, @v12/shared, @v12/client-runtime, etc.

Runtime and storage paths rename ~/.t3 / .t3 to ~/.v12 / .v12, desktop user-data folder names (V12 (Dev) / V12 (Alpha)), custom URL schemes v12 / v12-dev, and backend readiness /.well-known/v12/environment. Environment variables become V12_* (V12_HOME, V12_PORT, V12_CLERK_*, V12_RELAY_*, OTLP and web deploy vars). .env.example and dev-runner/desktop scripts follow the same naming (including V12_DEV_REMOTE_V12_SERVER_ENTRY_PATH and dev-root flags like --v12-dev-root).

CI and release workflows target @v12/desktop, v12-relay, and V12-hosted defaults (e.g. app.v12.codes), release titles "V12 v$version", and mostly stock GitHub-hosted runners instead of Blacksmith labels. .github/VOUCHED.td drops inherited external trust entries for this fork.

Contributor-facing docs replace the “not accepting contributions” stance with CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md; README credits upstream T3 Code and points installs/releases at 12ya/v12. PR template adds validation checklist items (vp check, vp run typecheck).

Lint/docs/plans update oxlint plugin references (@v12/oxlint-plugin-v12), macroscope notes, and planning docs from T3 → V12 (hosted app URLs, tunnel provider ids, service names).

Migration risk: anyone with data under old keys/paths (T3CODE_HOME, t3code: schemes, t3codeCommitHash, prior localStorage prefixes mentioned in Macroscope) will not see it unless a separate migration is added—this diff does not show one.

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

Note

Add chat pinning in project sidebar and introduce thread forking

  • Adds the ability to pin threads within a project in the sidebar; pinned threads are shown first with a visual divider, support drag-and-drop reordering across the pin boundary, and persist pin state in uiStateStore.
  • Introduces thread forking via a new thread.fork command: the decider copies message history up to a selected message into a new thread, tracking parentThreadId and forkedFromMessageId through the schema, projection pipeline, and persistence layer (migration 033 adds the required columns).
  • Adds a TaskHud overlay replacing the PlanSidebar; it surfaces plan steps and contextual tasks, supports toggling, removing, and reordering steps, and appends pending tasks to outgoing prompts.
  • Adds a "Queue message behind active run" action in ComposerPrimaryActions so users can submit while a run is in progress.
  • Replaces the "Revert to checkpoint" action with "Edit and rerun": interrupts active work, waits for thread settlement, forks a recovery thread, and restores the original message and attachments into the composer.
  • The entire codebase is rebranded from @t3tools/T3 Code to @v12/V12, including package names, DI service keys, environment variables, storage keys, URL schemes, JWT claims, and API endpoints.
  • Risk: the @t3tools → @v12 rename changes DI service identifiers, JWT typ/iss/aud claim values, API paths (/.well-known/t3/environment → /v12/environment, /api/t3-connect/* → /api/v12-connect/*), local storage keys, IndexedDB names, and deep-link schemes (t3code:// → v12://); existing persisted data under old keys will not be migrated automatically.
Macroscope summarized dd9d094.
    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

      Run ID: c47995d4-f6d9-49d1-931d-e68f5d27a2a9

      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
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      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:unvouched

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

      Approvability

      Verdict: Needs human review

      11 blocking correctness issues found. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. @@ -147,4 +147,4 @@
      147147 : input.platform === "darwin"
      148148 ? path.join(homeDirectory, "Library", "Application Support")
      149149 : Option.getOrElse(config.xdgConfigHome, () => path.join(homeDirectory, ".config"));
      150- const baseDir = Option.getOrElse(config.t3Home, () => path.join(homeDirectory, ".t3"));
      150+ const baseDir = Option.getOrElse(config.v12Home, () => path.join(homeDirectory, ".v12"));

      Home directory switch orphans state

      High Severity

      Default baseDir is now ~/.v12 with no fallback to ~/.t3, and the desktop bootstrap passes that as v12Home. Existing projects, SQLite, and settings under ~/.t3 are ignored after upgrade unless V12_HOME is set manually.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 91b9b6662922b9f76df6eaf64b557315d2e72187. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. @@ -262,0 +291,21 @@
      291+ return yield* new OrchestrationCommandInvariantError({
      292+ commandType: command.type,
      293+ detail: `Message '${command.throughMessageId}' does not exist on thread '${command.sourceThreadId}'.`,
      294+ });
      295+ }
      296+ const throughMessage = sourceThread.messages[throughMessageIndex];
      297+ if (!throughMessage || throughMessage.streaming) {
      298+ return yield* new OrchestrationCommandInvariantError({
      299+ commandType: command.type,
      300+ detail: `Message '${command.throughMessageId}' is still streaming and cannot be used as a fork point.`,
      301+ });
      302+ }
      303+
      304+ const includedMessages = sourceThread.messages.slice(0, throughMessageIndex + 1);
      305+ const messageIdBySourceId = new Map<string, MessageId>();
      306+ for (const message of includedMessages) {
      307+ messageIdBySourceId.set(message.id, yield* randomMessageId);
      308+ }
      309+ const cutoff = throughMessage.updatedAt;
      310+ const includedPlans = sourceThread.proposedPlans.filter((plan) => plan.createdAt <= cutoff);
      311+ const includedCheckpoints = sourceThread.checkpoints.filter(
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium orchestration/decider.ts:311

      In thread.fork, checkpoints are filtered by comparing checkpoint.completedAt to throughMessage.updatedAt. A checkpoint for the selected assistant turn is captured after the assistant message completes, so its completedAt is typically later than the message's updatedAt. This means the checkpoint whose turnId belongs to the retained message prefix is excluded, silently dropping the selected turn's diff/checkpoint history from the fork. Consider retaining checkpoints whose turnId matches a turn represented by the retained message prefix instead of using the timestamp cutoff.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/orchestration/decider.ts around line 311:
      
      In `thread.fork`, checkpoints are filtered by comparing `checkpoint.completedAt` to `throughMessage.updatedAt`. A checkpoint for the selected assistant turn is captured after the assistant message completes, so its `completedAt` is typically later than the message's `updatedAt`. This means the checkpoint whose `turnId` belongs to the retained message prefix is excluded, silently dropping the selected turn's diff/checkpoint history from the fork. Consider retaining checkpoints whose `turnId` matches a turn represented by the retained message prefix instead of using the timestamp cutoff.
    6. @@ -3856,0 +4009,21 @@
      4009+ useTaskHudStore.getState().copyContextTasksToFork({
      4010+ sourceThreadKey: scopedThreadKey(routeThreadRef),
      4011+ targetThreadKey: scopedThreadKey(recoveryThreadRef),
      4012+ sourceThreadId: historyThread.id,
      4013+ targetThreadId: recoveryThreadId,
      4014+ messageIdBySourceId: buildForkMessageIdMap(
      4015+ historyThread.messages,
      4016+ recoveryThread.messages,
      4017+ ),
      4018+ });
      4019+
      4020+ const revertResult = await revertThreadCheckpoint({
      4021+ environmentId,
      4022+ input: {
      4023+ threadId: activeThread.id,
      4024+ turnCount,
      4025+ },
      4026+ });
      4027+ if (revertResult._tag === "Failure") {
      4028+ throw squashAtomCommandFailure(revertResult);
      4029+ }

      Stale tasks after edit-and-rerun

      Medium Severity

      onEditAndRerun copies Task HUD context tasks onto the recovery fork, then reverts the original thread, but never removes or prunes tasks on the source thread. After revert, pending tasks can still reference removed messages and get appended on the next send via pendingSend.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit bd2bd65a602febcdc1884464aff74170fc094b5a. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -3857,3 +4027,20 @@
      4027+ if (revertResult._tag === "Failure") {
      4028+ throw squashAtomCommandFailure(revertResult);
      4029+ }
      4030+
      4031+ clearComposerDraftContent(routeThreadRef);
      4032+ setComposerDraftPrompt(routeThreadRef, message.text);
      4033+ addComposerDraftImages(routeThreadRef, restoredImages);
      4034+ restoredToComposer = true;
      4035+ composerRef.current?.resetCursorState({
      4036+ cursor: message.text.length,
      4037+ prompt: message.text,
      4038+ });
      4039+ composerRef.current?.focusAtEnd();
      4040+ } catch (error) {
      4041+ if (!restoredToComposer) {
      4042+ for (const image of restoredImages) revokeBlobPreviewUrl(image.previewUrl);
      4043+ }
      38574044 setThreadError(
      38584045 activeThread.id,
      3859- error instanceof Error ? error.message : "Failed to revert thread state.",
      4046+ error instanceof Error ? error.message : "Failed to prepare this request for rerun.",

      Orphan recovery on partial failure

      Medium Severity

      onEditAndRerun creates the recovery fork before waiting for projection, copying tasks, and reverting. If any later step fails, the catch path only surfaces an error and does not clean up the already-created recovery chat, so users can get an orphaned fork while the original thread is unchanged or only partly updated.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit bd2bd65a602febcdc1884464aff74170fc094b5a. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -262,0 +360,21 @@
      360+ createdAt: message.createdAt,
      361+ updatedAt: message.updatedAt,
      362+ },
      363+ });
      364+ }
      365+
      366+ const planEvents: PlannedOrchestrationEvent[] = [];
      367+ for (const proposedPlan of includedPlans) {
      368+ planEvents.push({
      369+ ...(yield* withEventBase({
      370+ aggregateKind: "thread",
      371+ aggregateId: command.threadId,
      372+ occurredAt: command.createdAt,
      373+ commandId: command.commandId,
      374+ })),
      375+ type: "thread.proposed-plan-upserted",
      376+ payload: {
      377+ threadId: command.threadId,
      378+ proposedPlan,
      379+ },
      380+ });

      Fork steals source proposed plans

      High Severity

      thread.fork copies proposed plans into the new thread without minting new plan IDs, while message and activity IDs are remapped. Projection upserts plans on global plan_id and rewrites thread_id on conflict, so applying the fork moves those plans off the source thread. Fork and Edit and rerun flows can silently strip plans from the original chat.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit bd2bd65a602febcdc1884464aff74170fc094b5a. Configure [here](https://www.cursor.com/dashboard/bugbot).
    7. @@ -0,0 +196,21 @@
      196+ case "running":
      197+ return <LoaderCircleIcon className="size-3.5 animate-spin text-sky-500" aria-hidden />;
      198+ case "waiting_for_approval":
      199+ return <Clock3Icon className="size-3.5 text-amber-500" aria-hidden />;
      200+ case "waiting_for_input":
      201+ return <MessageCircleQuestionIcon className="size-3.5 text-indigo-500" aria-hidden />;
      202+ case "failed":
      203+ return <CircleAlertIcon className="size-3.5 text-destructive" aria-hidden />;
      204+ case "complete":
      205+ return <CheckCircle2Icon className="size-3.5 text-emerald-500" aria-hidden />;
      206+ }
      207+}
      208+
      209+export const OpenThreadActivityStatus = memo(function OpenThreadActivityStatus({
      210+ status,
      211+ variant = "pill",
      212+}: {
      213+ readonly status: OpenThreadActivityPresentation | null;
      214+ readonly variant?: "pill" | "toolbar";
      215+}) {
      216+ const [nowMs, setNowMs] = useState(() => Date.now());
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium components/OpenThreadActivityStatus.tsx:216

      For a non-live status with endedAt: null (e.g. failed), the elapsed duration is computed against the stale mount-time nowMs instead of the current time, yielding a wrong or missing duration. The useEffect only refreshes nowMs while isLive is true, so any phase with a null endedAt that isn't classified as live never updates the timestamp used as the end time. Consider refreshing nowMs for any status whose endedAt is null, not just live phases.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/OpenThreadActivityStatus.tsx around line 216:
      
      For a non-live status with `endedAt: null` (e.g. `failed`), the elapsed duration is computed against the stale mount-time `nowMs` instead of the current time, yielding a wrong or missing duration. The `useEffect` only refreshes `nowMs` while `isLive` is true, so any phase with a null `endedAt` that isn't classified as live never updates the timestamp used as the end time. Consider refreshing `nowMs` for any status whose `endedAt` is `null`, not just live phases.
      @@ -782,7 +797,15 @@
      782797 previous: DerivedWorkLogEntry,
      783798 next: DerivedWorkLogEntry,
      784799 ): boolean {
      785- if (previous.activityKind !== "tool.updated" && previous.activityKind !== "tool.completed") {
      800+ if (
      801+ previous.activityKind !== "tool.started" &&
      802+ previous.activityKind !== "tool.updated" &&
      803+ previous.activityKind !== "tool.completed"
      804+ ) {
      786805 return false;
      787806 }
      788- if (next.activityKind !== "tool.updated" && next.activityKind !== "tool.completed") {
      807+ if (
      808+ next.activityKind !== "tool.started" &&
      809+ next.activityKind !== "tool.updated" &&
      810+ next.activityKind !== "tool.completed"
      811+ ) {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium src/session-logic.ts:807

      shouldCollapseToolLifecycleEntries now allows a tool.started row to collapse into a following tool.started row, so two consecutive identical tool starts without a toolCallId are merged into a single work-log entry. Concurrent or repeated identical tool calls silently lose one in-progress entry before either completion arrives. The next check should exclude tool.started so starts only collapse into a later tool.updated or tool.completed, not into another start.

         if (
      -    next.activityKind !== "tool.started" &&
           next.activityKind !== "tool.updated" &&
           next.activityKind !== "tool.completed"
         ) {
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/session-logic.ts around lines 807-811:
      
      `shouldCollapseToolLifecycleEntries` now allows a `tool.started` row to collapse into a following `tool.started` row, so two consecutive identical tool starts without a `toolCallId` are merged into a single work-log entry. Concurrent or repeated identical tool calls silently lose one in-progress entry before either completion arrives. The `next` check should exclude `tool.started` so starts only collapse into a later `tool.updated` or `tool.completed`, not into another start.
      @@ -0,0 +70,21 @@
      70+ input: DeriveOpenThreadActivityInput,
      71+): OpenThreadActivityPresentation | null {
      72+ const activeTurnId = input.session?.activeTurnId ?? input.latestTurn?.turnId ?? null;
      73+ const latestActivity = latestUsefulActivity(input.activities, activeTurnId);
      74+ const base = {
      75+ latestActivity,
      76+ };
      77+
      78+ // A settled server snapshot is authoritative. Local dispatch flags, stale
      79+ // pending activities, and a lagging latest turn must not resurrect work after
      80+ // a reconnect confirms that the session has stopped.
      81+ if (input.session?.status === "error") {
      82+ return {
      83+ ...base,
      84+ phase: "failed",
      85+ label: "Failed",
      86+ startedAt: input.latestTurn?.startedAt ?? input.latestTurn?.requestedAt ?? null,
      87+ endedAt: input.latestTurn?.completedAt ?? input.session.updatedAt,
      88+ };
      89+ }
      90+ if (input.session?.status === "ready" || input.session?.status === "idle") {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium components/OpenThreadActivityStatus.tsx:90

      When session.status is "idle" and there is no latestTurn (e.g., a freshly created session that has never dispatched a turn), deriveOpenThreadActivityPresentation returns a presentation with phase "complete" and label "Complete". This renders a persistent "Complete" status badge for a thread where no work has ever run. The "ready" || "idle" branch at line 90 returns unconditionally without checking for a settled turn. An idle session with no latestTurn should return null instead of synthesizing a completion.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/OpenThreadActivityStatus.tsx around line 90:
      
      When `session.status` is `"idle"` and there is no `latestTurn` (e.g., a freshly created session that has never dispatched a turn), `deriveOpenThreadActivityPresentation` returns a presentation with phase `"complete"` and label `"Complete"`. This renders a persistent "Complete" status badge for a thread where no work has ever run. The `"ready" || "idle"` branch at line 90 returns unconditionally without checking for a settled turn. An `idle` session with no `latestTurn` should return `null` instead of synthesizing a completion.
      @@ -0,0 +42,21 @@
      42+
      43+function latestUsefulActivity(
      44+ activities: ReadonlyArray<OrchestrationThreadActivity>,
      45+ turnId: string | null,
      46+): string | null {
      47+ let latest: OrchestrationThreadActivity | null = null;
      48+ for (const activity of activities) {
      49+ if (turnId !== null && activity.turnId !== null && activity.turnId !== turnId) {
      50+ continue;
      51+ }
      52+ if (
      53+ latest === null ||
      54+ activity.createdAt > latest.createdAt ||
      55+ (activity.createdAt === latest.createdAt &&
      56+ (activity.sequence ?? -1) > (latest.sequence ?? -1))
      57+ ) {
      58+ latest = activity;
      59+ }
      60+ }
      61+ return latest?.summary ?? null;
      62+}
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium components/OpenThreadActivityStatus.tsx:43

      latestUsefulActivity selects the newest activity by createdAt first, only using sequence as a tie-breaker. When provider events arrive with out-of-order timestamps (e.g. sequence 4 has an earlier createdAt than sequence 3), the function returns the sequence-3 summary instead of sequence 4, so the status HUD displays stale activity. Since sequence is the canonical ordering, it should be compared first, with createdAt only as a fallback tie-breaker.

      Suggested change
      43-function latestUsefulActivity(
      44- activities: ReadonlyArray<OrchestrationThreadActivity>,
      45- turnId: string | null,
      46-): string | null {
      47- let latest: OrchestrationThreadActivity | null = null;
      48- for (const activity of activities) {
      49- if (turnId !== null && activity.turnId !== null && activity.turnId !== turnId) {
      50- continue;
      51- }
      52- if (
      53- latest === null ||
      54- activity.createdAt > latest.createdAt ||
      55- (activity.createdAt === latest.createdAt &&
      56- (activity.sequence ?? -1) > (latest.sequence ?? -1))
      57- ) {
      58- latest = activity;
      59- }
      60- }
      61- return latest?.summary ?? null;
      62-}
      43+function latestUsefulActivity(
      44+ activities: ReadonlyArray<OrchestrationThreadActivity>,
      45+ turnId: string | null,
      46+): string | null {
      47+ let latest: OrchestrationThreadActivity | null = null;
      48+ for (const activity of activities) {
      49+ if (turnId !== null && activity.turnId !== null && activity.turnId !== turnId) {
      50+ continue;
      51+ }
      52+ if (
      53+ latest === null ||
      54+ (activity.sequence ?? -1) > (latest.sequence ?? -1) ||
      55+ (activity.sequence === latest.sequence &&
      56+ activity.createdAt > latest.createdAt)
      57+ ) {
      58+ latest = activity;
      59+ }
      60+ }
      61+ return latest?.summary ?? null;
      62+}
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/OpenThreadActivityStatus.tsx around lines 43-62:
      
      `latestUsefulActivity` selects the newest activity by `createdAt` first, only using `sequence` as a tie-breaker. When provider events arrive with out-of-order timestamps (e.g. sequence 4 has an earlier `createdAt` than sequence 3), the function returns the sequence-3 summary instead of sequence 4, so the status HUD displays stale activity. Since `sequence` is the canonical ordering, it should be compared first, with `createdAt` only as a fallback tie-breaker.
      @@ -1015,4 +1057,21 @@
      1057+ ) : null}
      10151058 </>
      10161059 );
      10171060 }
      10181061
      1062+function useMessageTaskSelection() {
      1063+ const selectionContainerRef = useRef<HTMLDivElement>(null);
      1064+ const [selectedQuote, setSelectedQuote] = useState<string | null>(null);
      1065+ const [selectionAnchorRect, setSelectionAnchorRect] = useState<SelectionAnchorRect | null>(null);
      1066+ const selectionTimerRef = useRef<number | null>(null);
      1067+ const captureSelection = useCallback(() => {
      1068+ if (selectionTimerRef.current !== null) window.clearTimeout(selectionTimerRef.current);
      1069+ selectionTimerRef.current = window.setTimeout(() => {
      1070+ selectionTimerRef.current = null;
      1071+ const container = selectionContainerRef.current;
      1072+ if (!container) return;
      1073+ const selection = readSelectionWithin(container);
      1074+ if (selection) {
      1075+ setSelectedQuote(selection.quote);
      1076+ setSelectionAnchorRect(selection.anchorRect);
      1077+ }
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium chat/MessagesTimeline.tsx:1073

      When the user collapses the text selection (e.g., by clicking inside the message), captureSelection does not clear selectedQuote and selectionAnchorRect, so the old SelectionActionBar stays visible and can act on stale text and coordinates. The useEffect cleanup also schedules no debounced clear on unmount, compounding the staleness. In the null branch of captureSelection, call clearSelection so state resets when readSelectionWithin returns nothing.

            const selection = readSelectionWithin(container);
      -      if (selection) {
      -        setSelectedQuote(selection.quote);
      -        setSelectionAnchorRect(selection.anchorRect);
      -      }
      +      if (selection) {
      +        setSelectedQuote(selection.quote);
      +        setSelectionAnchorRect(selection.anchorRect);
      +      } else {
      +        clearSelection();
      +      }
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/chat/MessagesTimeline.tsx around lines 1073-1077:
      
      When the user collapses the text selection (e.g., by clicking inside the message), `captureSelection` does not clear `selectedQuote` and `selectionAnchorRect`, so the old `SelectionActionBar` stays visible and can act on stale text and coordinates. The `useEffect` cleanup also schedules no debounced clear on unmount, compounding the staleness. In the `null` branch of `captureSelection`, call `clearSelection` so state resets when `readSelectionWithin` returns nothing.
      @@ -0,0 +1,19 @@
      1+import type { OrchestrationMessage } from "@v12/contracts";
      2+
      3+const ROLE_LABELS = {
      4+ user: "User",
      5+ assistant: "Assistant",
      6+ system: "System",
      7+} as const;
      8+
      9+/**
      10+ * Rehydrates a fork in a fresh provider session without changing the message
      11+ * stored or rendered by V12. Provider-native sessions are not shared between
      12+ * branches, so the copied transcript is supplied as context on the first turn.
      13+ */
      14+export function buildForkContinuationInput(input: {
      15+ readonly history: ReadonlyArray<OrchestrationMessage>;
      16+ readonly nextRequest: string;
      17+}): string {
      18+ const transcript = input.history
      19+ .map((message) => `${ROLE_LABELS[message.role]}:\n${message.text}`)
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium orchestration/forkContinuation.ts:19

      buildForkContinuationInput serializes each history message using only message.text, dropping message.attachments entirely. Forks created after image or file-based turns send the new provider session an incomplete transcript, so it cannot continue from attachments that are still visible in the fork's history. Consider including attachment content (or at least a placeholder reference) in the serialized transcript so multi-modal context survives the fork.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/orchestration/forkContinuation.ts around line 19:
      
      `buildForkContinuationInput` serializes each history message using only `message.text`, dropping `message.attachments` entirely. Forks created after image or file-based turns send the new provider session an incomplete transcript, so it cannot continue from attachments that are still visible in the fork's history. Consider including attachment content (or at least a placeholder reference) in the serialized transcript so multi-modal context survives the fork.
      @@ -1851,0 +2117,21 @@
      2117+ }
      2118+ if (workEntry.itemType === "web_search") return "web";
      2119+ return "other";
      2120+}
      2121+
      2122+function workEntryCategoryClass(workEntry: TimelineWorkEntry): string {
      2123+ switch (workEntryCategory(workEntry)) {
      2124+ case "command":
      2125+ return "border-s-sky-500/45 bg-sky-500/[0.025]";
      2126+ case "file-read":
      2127+ return "border-s-cyan-500/45 bg-cyan-500/[0.025]";
      2128+ case "file-change":
      2129+ return "border-s-amber-500/45 bg-amber-500/[0.025]";
      2130+ case "web":
      2131+ return "border-s-indigo-500/45 bg-indigo-500/[0.025]";
      2132+ case "other":
      2133+ return "border-s-border/50";
      2134+ }
      2135+}
      2136+
      2137+function workEntryStatusLabel(workEntry: TimelineWorkEntry): string | null {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium chat/MessagesTimeline.tsx:2137

      workEntryStatusLabel returns "Succeeded" for every entry with toolLifecycleStatus === "completed", but completed entries in this codebase can still represent tool failures (e.g., detail: "File not found..."). This causes SimpleWorkEntryRow to show a Succeeded label next to a failure indicator. Consider deriving the label from the existing failure/success helpers rather than lifecycle status alone.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/chat/MessagesTimeline.tsx around line 2137:
      
      `workEntryStatusLabel` returns `"Succeeded"` for every entry with `toolLifecycleStatus === "completed"`, but completed entries in this codebase can still represent tool failures (e.g., `detail: "File not found..."`). This causes `SimpleWorkEntryRow` to show a `Succeeded` label next to a failure indicator. Consider deriving the label from the existing failure/success helpers rather than lifecycle status alone.
    8. @@ -316,15 +316,15 @@
      316- T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
      317- T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
      318- T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
      319- T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
      316+ V12_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
      317+ V12_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
      318+ V12_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
      319+ V12_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }}
      320320 strategy:
      321321 fail-fast: false
      322322 matrix:
      323323 include:
      324324 - label: macOS arm64
      325- runner: blacksmith-12vcpu-macos-26
      325+ runner: macos-15
      326326 platform: mac
      327327 target: dmg
      328328 arch: arm64
      329329 - label: macOS x64
      330- runner: blacksmith-12vcpu-macos-26
      330+ runner: macos-15

      macOS runner OS version downgraded

      Medium Severity

      Both macOS matrix rows replace blacksmith-12vcpu-macos-26 with macos-15 instead of macos-26. Ubuntu and Windows keep the same OS version from their Blacksmith labels, so this looks like an accidental downgrade. Release packaging then runs on older Xcode/SDK tooling than the previous macOS 26 build environment.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c0eb2bac658f0afbf7788b4a2c68c834c7fd6fe7. Configure [here](https://www.cursor.com/dashboard/bugbot).
    9. Closing this accidental PR in favor of #4047. This PR's head tracked the fork's long-lived main branch, so unrelated V12 development kept leaking into the diff. The replacement is rebuilt from current upstream main and contains only the sidebar pinning changes.

    10. @@ -146,18 +57,8 @@
      146- setLogicalProjectDraftThreadId(logicalProjectKey, projectRef, currentRouteTarget.draftId, {
      147- threadId: latestActiveDraftThread.threadId,
      148- createdAt: latestActiveDraftThread.createdAt,
      149- runtimeMode: latestActiveDraftThread.runtimeMode,
      150- interactionMode: latestActiveDraftThread.interactionMode,
      151- ...(hasBranchOption ? { branch: options?.branch ?? null } : {}),
      152- ...(hasWorktreePathOption ? { worktreePath: options?.worktreePath ?? null } : {}),
      153- ...(hasEnvModeOption ? { envMode: options?.envMode } : {}),
      154- ...(hasStartFromOriginOption ? { startFromOrigin: options?.startFromOrigin } : {}),
      155- });
      156- return Promise.resolve();
      157- }
      158-
      15957 const draftId = newDraftId();
      16058 const threadId = newThreadId();
      16159 const createdAt = new Date().toISOString();
      16260 const initialEnvMode = options?.envMode ?? environmentSettings.defaultThreadEnvMode;
      16361 return (async () => {
      62+ if (currentRouteTarget?.kind === "draft") {
      63+ await materializeDraftThread(currentRouteTarget.draftId);
      64+ }
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium hooks/useHandleNewThread.ts:62

      When the current route is a content-bearing draft and the backend is unavailable, materializeDraftThread rejects and the rejection propagates out of useNewThreadHandler, so the rest of the callback never runs: no new local draft is created and no navigation occurs. Creating the destination draft and navigating to it are entirely local operations, so an environment-offline materialization failure should not block leaving the current draft. Consider wrapping the materializeDraftThread call in a try/catch (or .catch) so that local draft creation and navigation proceed regardless of whether the server-side thread could be created.

      Suggested change
      62- if (currentRouteTarget?.kind === "draft") {
      63- await materializeDraftThread(currentRouteTarget.draftId);
      64- }
      62+ if (currentRouteTarget?.kind === "draft") {
      63+ try {
      64+ await materializeDraftThread(currentRouteTarget.draftId);
      65+ } catch {
      66+ // Materialization is best-effort here; local draft creation and
      67+ // navigation must still proceed when the backend is unavailable.
      68+ }
      69+ }
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/hooks/useHandleNewThread.ts around lines 62-64:
      
      When the current route is a content-bearing draft and the backend is unavailable, `materializeDraftThread` rejects and the rejection propagates out of `useNewThreadHandler`, so the rest of the callback never runs: no new local draft is created and no navigation occurs. Creating the destination draft and navigating to it are entirely local operations, so an environment-offline materialization failure should not block leaving the current draft. Consider wrapping the `materializeDraftThread` call in a try/catch (or `.catch`) so that local draft creation and navigation proceed regardless of whether the server-side thread could be created.
      @@ -0,0 +59,21 @@
      59+
      60+ const materialization = (async () => {
      61+ const trimmedPrompt = composerDraft?.prompt.trim() ?? "";
      62+ const result = await createThread({
      63+ environmentId: draftSession.environmentId,
      64+ input: {
      65+ threadId: draftSession.threadId,
      66+ projectId: draftSession.projectId,
      67+ title: trimmedPrompt.length > 0 ? truncate(trimmedPrompt) : "Draft",
      68+ modelSelection: resolveDraftModelSelection(draftId),
      69+ runtimeMode: draftSession.runtimeMode,
      70+ interactionMode: draftSession.interactionMode,
      71+ branch: draftSession.branch,
      72+ worktreePath: draftSession.worktreePath,
      73+ createdAt: draftSession.createdAt,
      74+ },
      75+ });
      76+ if (result._tag === "Failure") {
      77+ throw squashAtomCommandFailure(result);
      78+ }
      79+ useComposerDraftStore.getState().markDraftThreadPromoting(draftId, threadRef);
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High hooks/useMaterializeDraftThread.ts:79

      When a populated draft is materialized, the user's composer content (prompt, images, terminal contexts, annotations, review comments) is permanently deleted instead of being migrated to the new server thread. createThread only persists thread metadata (title, model, modes), not the composer content. Then markDraftThreadPromoting triggers finalizePromotedDraftThread, which removes both the draft-session metadata and draftsByThreadKey[draftId] — discarding all unsent content the user had entered. Consider copying the composer draft state to the scoped server-thread key before removing the draft-session entry, so the content survives the promotion.

      Also found in 1 other location(s)

      apps/web/src/hooks/useHandleNewThread.ts:65

      The handler always installs a fresh draftId with setLogicalProjectDraftThreadId, but only materializes the draft currently in the route. If project A already has an unpromoted content-bearing draft while the user is viewing a server thread (or a draft for another project), starting a new thread for A replaces A&#39;s logical-project mapping; setLogicalProjectDraftThreadId then deletes the prior unpromoted draft session and its composer state. The previous implementation explicitly found and reused getDraftSessionByLogicalProjectKey, so this change can silently discard an unfinished draft. The existing draft for logicalProjectKey must be preserved/reused or materialized before replacement.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/hooks/useMaterializeDraftThread.ts around line 79:
      
      When a populated draft is materialized, the user's composer content (prompt, images, terminal contexts, annotations, review comments) is permanently deleted instead of being migrated to the new server thread. `createThread` only persists thread metadata (title, model, modes), not the composer content. Then `markDraftThreadPromoting` triggers `finalizePromotedDraftThread`, which removes both the draft-session metadata and `draftsByThreadKey[draftId]` — discarding all unsent content the user had entered. Consider copying the composer draft state to the scoped server-thread key before removing the draft-session entry, so the content survives the promotion.
      
      Also found in 1 other location(s):
      - apps/web/src/hooks/useHandleNewThread.ts:65 -- The handler always installs a fresh `draftId` with `setLogicalProjectDraftThreadId`, but only materializes the draft currently in the route. If project A already has an unpromoted content-bearing draft while the user is viewing a server thread (or a draft for another project), starting a new thread for A replaces A's logical-project mapping; `setLogicalProjectDraftThreadId` then deletes the prior unpromoted draft session and its composer state. The previous implementation explicitly found and reused `getDraftSessionByLogicalProjectKey`, so this change can silently discard an unfinished draft. The existing draft for `logicalProjectKey` must be preserved/reused or materialized before replacement.
      
      @@ -682,3 +682,8 @@
      682682 );
      683683 }
      684684
      685+/** Whether the composer contains user-authored content worth materializing as a thread. */
      686+export function hasComposerDraftUserContent(draft: ComposerThreadDraftState | null): boolean {
      687+ return Boolean(
      688+ draft &&
      689+ (draft.prompt.length > 0 ||
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium src/composerDraftStore.ts:689

      hasComposerDraftUserContent checks draft.prompt.length > 0, so a prompt containing only whitespace is treated as user content. useMaterializeDraftThread trims the prompt before materialization, which means a draft with only spaces passes the user-content check and gets materialized as a server thread titled "Draft", and shows a "Draft" badge in the sidebar. Consider checking the trimmed prompt instead so whitespace-only drafts are treated as empty.

      Suggested change
      689- (draft.prompt.length > 0 ||
      689+ draft.prompt.trim().length > 0 ||
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/composerDraftStore.ts around line 689:
      
      `hasComposerDraftUserContent` checks `draft.prompt.length > 0`, so a prompt containing only whitespace is treated as user content. `useMaterializeDraftThread` trims the prompt before materialization, which means a draft with only spaces passes the user-content check and gets materialized as a server thread titled "Draft", and shows a "Draft" badge in the sidebar. Consider checking the trimmed prompt instead so whitespace-only drafts are treated as empty.
    11. Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.

      There are 9 total unresolved issues (including 5 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 dd9d094708c79cb2c243e4bc6403e6196106041b. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +54,21 @@
      54+ const threadKey = scopedThreadKey(threadRef);
      55+ const existing = materializationsInFlight.get(threadKey);
      56+ if (existing) {
      57+ return existing;
      58+ }
      59+
      60+ const materialization = (async () => {
      61+ const trimmedPrompt = composerDraft?.prompt.trim() ?? "";
      62+ const result = await createThread({
      63+ environmentId: draftSession.environmentId,
      64+ input: {
      65+ threadId: draftSession.threadId,
      66+ projectId: draftSession.projectId,
      67+ title: trimmedPrompt.length > 0 ? truncate(trimmedPrompt) : "Draft",
      68+ modelSelection: resolveDraftModelSelection(draftId),
      69+ runtimeMode: draftSession.runtimeMode,
      70+ interactionMode: draftSession.interactionMode,
      71+ branch: draftSession.branch,
      72+ worktreePath: draftSession.worktreePath,
      73+ createdAt: draftSession.createdAt,
      74+ },

      Worktree mode lost after materialize

      Medium Severity

      useMaterializeDraftThread creates a server thread from a local draft, but only forwards branch and worktreePath. Draft envMode and startFromOrigin never reach the server thread. After navigate-away, ChatView treats the row as a server thread and drops draftThreadEnvMode, so a worktree-configured draft can send as local on return.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit dd9d094708c79cb2c243e4bc6403e6196106041b. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +47,21 @@
      47+ const draftSession = store.getDraftSession(draftId);
      48+ const composerDraft = store.getComposerDraft(draftId);
      49+ if (!draftSession || draftSession.promotedTo || !hasComposerDraftUserContent(composerDraft)) {
      50+ return false;
      51+ }
      52+
      53+ const threadRef = scopeThreadRef(draftSession.environmentId, draftSession.threadId);
      54+ const threadKey = scopedThreadKey(threadRef);
      55+ const existing = materializationsInFlight.get(threadKey);
      56+ if (existing) {
      57+ return existing;
      58+ }
      59+
      60+ const materialization = (async () => {
      61+ const trimmedPrompt = composerDraft?.prompt.trim() ?? "";
      62+ const result = await createThread({
      63+ environmentId: draftSession.environmentId,
      64+ input: {
      65+ threadId: draftSession.threadId,
      66+ projectId: draftSession.projectId,
      67+ title: trimmedPrompt.length > 0 ? truncate(trimmedPrompt) : "Draft",

      Weak title for non-text drafts

      Low Severity

      Materialization titles the thread from a trimmed prompt only, otherwise "Draft". hasComposerDraftUserContent also treats images and contexts as enough to materialize, so image- or context-only drafts become generically named sidebar threads instead of the richer titles used on first send.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit dd9d094708c79cb2c243e4bc6403e6196106041b. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +60,21 @@
      60+ const materialization = (async () => {
      61+ const trimmedPrompt = composerDraft?.prompt.trim() ?? "";
      62+ const result = await createThread({
      63+ environmentId: draftSession.environmentId,
      64+ input: {
      65+ threadId: draftSession.threadId,
      66+ projectId: draftSession.projectId,
      67+ title: trimmedPrompt.length > 0 ? truncate(trimmedPrompt) : "Draft",
      68+ modelSelection: resolveDraftModelSelection(draftId),
      69+ runtimeMode: draftSession.runtimeMode,
      70+ interactionMode: draftSession.interactionMode,
      71+ branch: draftSession.branch,
      72+ worktreePath: draftSession.worktreePath,
      73+ createdAt: draftSession.createdAt,
      74+ },
      75+ });
      76+ if (result._tag === "Failure") {
      77+ throw squashAtomCommandFailure(result);
      78+ }
      79+ useComposerDraftStore.getState().markDraftThreadPromoting(draftId, threadRef);
      80+ return true;
      cursor[bot](GitHub profile, opens in a new tab)commented

      Send fails after draft materialize

      Medium Severity

      useMaterializeDraftThread creates an empty server thread and sets promotedTo, but the draft route only switches to server mode when threadHasStarted is true. Empty materialized shells never qualify, so returning to the draft route still renders as a local draft. Send then retries bootstrap.createThread for the same id, which the server rejects as a duplicate, so the message never sends.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit dd9d094708c79cb2c243e4bc6403e6196106041b. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -146,18 +57,8 @@
      146- setLogicalProjectDraftThreadId(logicalProjectKey, projectRef, currentRouteTarget.draftId, {
      147- threadId: latestActiveDraftThread.threadId,
      148- createdAt: latestActiveDraftThread.createdAt,
      149- runtimeMode: latestActiveDraftThread.runtimeMode,
      150- interactionMode: latestActiveDraftThread.interactionMode,
      151- ...(hasBranchOption ? { branch: options?.branch ?? null } : {}),
      152- ...(hasWorktreePathOption ? { worktreePath: options?.worktreePath ?? null } : {}),
      153- ...(hasEnvModeOption ? { envMode: options?.envMode } : {}),
      154- ...(hasStartFromOriginOption ? { startFromOrigin: options?.startFromOrigin } : {}),
      155- });
      156- return Promise.resolve();
      157- }
      158-
      15957 const draftId = newDraftId();
      16058 const threadId = newThreadId();
      16159 const createdAt = new Date().toISOString();
      16260 const initialEnvMode = options?.envMode ?? environmentSettings.defaultThreadEnvMode;
      16361 return (async () => {
      62+ if (currentRouteTarget?.kind === "draft") {
      63+ await materializeDraftThread(currentRouteTarget.draftId);
      64+ }
      cursor[bot](GitHub profile, opens in a new tab)commented

      Silent New Chat materialize failure

      Medium Severity

      useNewThreadHandler awaits materializeDraftThread with no try/catch before creating the next draft. A failed create rejects the New Chat action with no toast, while ChatView's blocker path surfaces the same failure. Users can see New Chat do nothing when materialization fails.

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

Sign in to join this conversation.