Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep thread branch metadata consistent #4926

Closedmaxktz(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/4926/headopened View on GitHub

What Changed

  • save the checked-out branch when creating a thread without touching the branch picker
  • consistently omit the default branch from sidebar rows while keeping custom branches visible

Why

The branch picker displayed the current branch without persisting it. This made equivalent threads look different depending on whether the default branch had been explicitly reselected.

Checklist

  • This PR is small and focused
  • I explained what changed and why
Show AI summary

New draft-thread bootstraps now derive their persisted branch with resolveBranchToolbarValue, using the live checkout from Git status while preserving explicit new-worktree base selections. Sidebar V2 resolves the persisted branch through listRefs, so default-branch rows keep their existing branch-free presentation whether or not the dropdown was touched. The tooltip continues to render the persisted branch directly.

Focused verification passed: web typecheck, formatting, lint, BranchToolbar.logic.test.ts, and Sidebar.logic.test.ts.


Note

Low Risk UI-only branch display and draft bootstrap metadata; no auth or server contract changes. Extra listRefs queries per local branch-backed row are bounded and project-scoped via query caching.

Overview Aligns persisted thread branch with what the branch toolbar shows, and sidebar branch labels with the rule that default branches stay hidden.

Chat bootstrap — Draft thread creation no longer always saves activeThreadBranch. It now uses resolveBranchToolbarValue (env mode, worktree path, thread branch, live Git ref) so a untouched picker still records the checked-out branch.

Sidebar V2 — Card rows use resolveSidebarBranchLabel instead of always showing thread.branch. Local (non-worktree) threads load listRefs (cached per project, limit: 2) to detect the default branch; worktrees rely on gitStatus.isDefaultRef. The label stays blank while that resolution is pending.

Sidebar.logic — Adds resolveSidebarBranchLabel with unit tests.

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

Note

Fix thread branch metadata consistency in sidebar and new thread creation

  • Sidebar rows now hide the branch label when the thread's branch matches the default branch, using a new resolveSidebarBranchLabel helper in Sidebar.logic.ts. The label is also suppressed until the default branch is determined.
  • New thread creation in ChatView.tsx now uses resolveBranchToolbarValue to resolve the branch instead of reading activeThreadBranch directly, aligning the created thread's branch with what the toolbar shows.
  • Behavioral Change: listRefs may now be called in sidebar rows to determine the default branch when a thread has a branch but no worktree path.
Macroscope summarized 9d80ade.
    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: 33611b40-e003-46e3-802c-601838ab8c7e

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

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

      Approvability

      Verdict: Approved 9d80ade

      This PR fixes thread branch metadata consistency by reusing an existing tested function and adding simple UI logic to hide redundant default branch labels. Changes are self-contained, use established patterns, and include unit tests.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      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 388c89e3bf9b8d462eac27f6ba6c8e3f3e9525e9. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. Closing as part of the open-PR backlog sweep (wave 1).

      Reason: Thread branch metadata; later #4986 records checkout branch so PR badges show. Related: #4986

      Reopen if this is still wanted and you’re willing to rebase onto current main.

    6. juliusmarminge closed this

Sign in to join this conversation.