Skip to content

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

Closed
maxktz wants to merge 3 commits into
pingdotgg:mainfrom
maxktz:fix/thread-branch
Closed

maxktz wants to merge 3 commits into
pingdotgg:mainfrom
maxktz:fix/thread-branch

Conversation

@maxktz

@maxktz maxktz commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

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 for commit 9d80ade. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 30, 2026
Comment thread apps/web/src/components/SidebarV2.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Reviewed by Cursor Bugbot for commit 388c89e. Configure here.

Comment thread apps/web/src/components/SidebarV2.tsx
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 30, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 30, 2026 06:00

Dismissing prior approval to re-evaluate 9d80ade

@juliusmarminge

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants