Skip to content

feat(git): VS Code-style branch sync control#3075

Open
TheIcarusWings wants to merge 2 commits into
pingdotgg:mainfrom
TheIcarusWings:t3code/git-sync-control
Open

feat(git): VS Code-style branch sync control#3075
TheIcarusWings wants to merge 2 commits into
pingdotgg:mainfrom
TheIcarusWings:t3code/git-sync-control

Conversation

@TheIcarusWings

@TheIcarusWings TheIcarusWings commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Adds an ahead/behind indicator with one-click fetch/pull/push/publish/sync
next to the branch in the composer toolbar, plus the standalone RPCs behind it.

- contracts: vcs.fetch / vcs.push / vcs.sync RPCs + GitDivergedError
- server: GitVcsDriverCore.fetchCurrentBranch + syncCurrentBranch (fast-forward
  pull / push / publish chosen by ahead-behind; diverged history -> typed
  GitDivergedError unless mode:"rebase", which runs pull --rebase and aborts
  cleanly on conflict). Standalone push reuses the stacked-action driver call so
  upstream + push-remote (fork) resolution stays shared.
- client: wsRpcClient vcs.{fetch,push,sync}, action-manager ops, action hooks
- web: GitSyncControl component wired into the branch toolbar
- tests: real-git integration tests for ahead/behind/diverged/rebase/publish/fetch

Also extracts RPC_REQUIRED_SCOPE into its own module with a completeness test
asserting every WsRpcGroup method declares an auth scope, so a missing scope
fails in tests instead of at runtime.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 13, 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

Run ID: 7dad0a05-7acc-45cb-a72f-92b81090cd3c

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 and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Jun 13, 2026

@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 and found 2 potential issues.

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 c365aaa. Configure here.

Comment thread apps/web/src/components/GitSyncControl.tsx
Comment thread apps/web/src/components/BranchToolbarBranchSelector.tsx
@macroscopeapp

macroscopeapp Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new feature with new UI components (GitSyncControl), new RPC endpoints (fetch/push/sync), and new git operations including rebase handling for diverged branches. New user-facing features with this scope warrant human review.

You can customize Macroscope's approvability policy. Learn more.

- Fetch toast no longer claims "Up to date" — vcs.fetch only updates
  remote-tracking refs, so the branch may now be ahead/behind. Title is now
  "Fetched" with an accurate description; the badge reflects the real state.
- Branch picker is disabled while a sync action (fetch/push/pull/sync) is in
  flight on the same cwd, preventing a checkout/create-ref from racing the git
  operation. Shares SYNC_BUSY_ACTIONS with GitSyncControl.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

please add screenshots and/or videos

@TheIcarusWings

Copy link
Copy Markdown
Contributor Author

Screenshots of the sync control in the composer toolbar, captured from a local run against a scratch repo with a remote (and a "teammate" clone to create the behind/diverged states).

Up to date (muted check + Fetch button, always available):
up to date

Ahead of upstream (click to push):
ahead

Behind upstream (click to fast-forward pull):
behind

Diverged (one click runs fetch, then pull/push):
diverged sync

No upstream (publish + set upstream):
publish

Diverged sync is fast-forward-safe: instead of force-pushing, Sync surfaces a clear error and offers an explicit rebase:
diverged toast

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

Labels

size:XL 500-999 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