Add version control command center#3177
Conversation
- Query open change requests across supported remotes - Surface actionable branch rows only when local branch is behind the MR/PR base - Pass remote repository context to GitHub, GitLab, and Azure DevOps CLIs
…ol-panel-work # Conflicts: # apps/web/src/components/ChatView.tsx # apps/web/src/environmentApi.ts # apps/web/src/environments/runtime/service.threadSubscriptions.test.ts # packages/client-runtime/src/wsRpcClient.ts
- Extract shared source control panel state and API wiring - Move VS Code project scope and subagent parent resolution into runtime helpers - Add tests for presentation state and subagent control resolution
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: Needs human review Diff is too large for automated approval analysis. A human reviewer should evaluate this PR. You can customize Macroscope's approvability policy. Learn more. |
- Treat same-name remotes as publish/pull upstreams - Split sync-state logic into shared web module - Cover publish target behavior with tests and docs
- Add `forceRefresh` support to query runners and runtime execution - Refresh cached SWR atoms before resolving so panel data stays current - Cover first-run and cached-refresh behavior with runtime tests
- Move sync refresh feedback into a compact spinner icon - Keep the banner for non-refresh sync messages
- Sum merged working-tree row stats across both sides - Keep default compare ref on the repository default branch - Restrict diverged merge sync to the checked-out branch - Surface tracked discard failures and rename sources - Move shared panel logic into the logic module
- Infer rename status for numstat fallback entries - Align diverged merge sync guard and disabled state - Clarify aggregate working-tree stats and date buckets
…ol-panel-work # Conflicts: # apps/desktop/src/electron/ElectronMenu.ts # apps/server/src/sourceControl/AzureDevOpsCli.ts # apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts # apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts # apps/server/src/sourceControl/GitHubCli.ts # apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts # apps/server/src/sourceControl/GitHubSourceControlProvider.ts # apps/server/src/sourceControl/GitLabCli.ts # apps/server/src/sourceControl/SourceControlProvider.ts # apps/server/src/vcs/VcsStatusBroadcaster.ts # apps/server/src/ws.ts # apps/web/src/components/ChatView.tsx # apps/web/src/components/Sidebar.logic.ts # apps/web/src/hooks/useHandleNewThread.ts
There was a problem hiding this comment.
Effect Service Conventions: one finding in DesktopBackendManager.ts. See inline comment.
Posted via Macroscope — Effect Service Conventions
- Resolve each tooltip anchor from its own file row - Preserve panel-boundary geometry for left-aligned cards
- Keep working-file tooltip refs stable across renders - Limit nested-hover preservation to the triggering row - Cover scoped nested-tooltip detection with focused tests
- Track each tooltip's active parent trigger - Scope synthetic provider closes to hovered nested actions
- Record per-environment routing and failure isolation - Describe scoped rich cards and nested action tooltips
…ol-panel-work # Conflicts: # apps/web/src/components/SidebarV2.tsx
- Reconcile web panel state before preserving mutation failures - Pass Azure organizations and stable API versions to avatar queries - Cover both fixes with focused tests and update source control docs
- Omit missing or unparseable branch and stash timestamps - Add focused native model coverage and update feature docs
- Preserve warning-like hook output as failure diagnostics\n- Keep successful commits authoritative even when hooks print warnings\n- Cover successful and failed commit output handling
Preserve authoritative errors and ignore stale detail and snapshot loads. Harden selected-file Git paths, temporary indexes, commit parsing, compare direction, and Azure organization routing. Add focused regression coverage across web, mobile, and server.
Discard paginated branch commits when their request or comparison base is stale. Track settled native snapshot requests so failed initial loads expose their error and retry controls instead of remaining on the loading screen.
- Add an in-place retry for failed native initial snapshots - Ignore interrupted web branch-commit pagination requests
- Ignore refresh callbacks retained from a previous checkout - Require request generation and cwd identity before accepting state
PR id: 3177
PR url: #3177
PR title: Add version control command center
PR target: pingdotgg/t3code:main
PR head: Quicksaver:split/version-control-panel-work
Summary
Adds a Git-backed Version Control command center to the web right panel and a native mobile route. It is scoped to the active project/repository cwd, works from draft or existing conversations once repository context is available, and keeps Git operations server-authoritative across browser, desktop, VS Code, and remote clients.
The panel focuses on actionable repository work rather than being a full Git dashboard: dirty working trees, local branch sync state, stashes, remotes, sibling worktrees, likely fork branches, and open change-request bases.
What Changed
SOURCE_CONTROL.mdas the branch-specific behavior and validation reference for the Version Control panel.SourceControlPanelServiceRPC support for snapshots, branch/stash/commit/compare data, selected-file commit and stash flows, discard operations, branch actions, remote actions, and provider-derived PR/MR base checks.VcsStatusBroadcasterandVcsLocalWatch, including ref-counted local watchers,.git/event filtering, gitignore-aware suppression, explicit local refreshes, and sibling worktree watcher retention.ActionableandRemotessections, working-tree file selection, inline diffs, branch/stash/commit rows, searchable compare bases, guarded destructive actions, context menus, manual fetch controls, and a conservative five-minute Actionable remote fetch.expectedBranchwrite guards, and environment/thread/cwd-scoped panel state.glab mr list --repoinstead of an ambiguous scheme-less host/path locator, without duplicating a configured base-URL path prefix already present in the remote path.mainormaster.stash@{n}renumbering after stash create/drop operations does not show details for the wrong stash.HEAD.7.1API version instead of ambient CLI detection and a preview version.Why
T3 Code needs a compact place to answer "what repository work needs attention now?" without forcing users into a full external Git UI. This change keeps the surface decision-oriented: commit or stash selected changes, inspect branch sync state, publish or sync branches, review stashes, and notice when a PR/MR base has moved.
The server-owned design keeps behavior consistent across clients and avoids browser-side Git execution, while the periodic fetch and local watchers keep the panel current without introducing a high-frequency polling loop.
Validation
expo/virtual/envshared-store resolution failure.13782and web5742authenticated and rendered the Version Control panel with liveActionableandRemotesdata from the throwaway repository. The installed iOS dev client reached this worktree's Metro server, but integrated native verification remained blocked before application code loaded because Metro could not resolve the existingexpo/virtual/envvirtual module through the shared pnpm-store layout; serve-sim also timed out, so simulator evidence was captured through XcodeBuildMCP.13782and web5742rendered the Version Control panel with live throwaway repository data, including the final late-review follow-up. A rebuilt iOS dev client reached the worktree Metro server on both attempts, but the integrated native pass was blocked before application code loaded because Metro could not resolve the existingexpo/virtual/envvirtual module through the shared pnpm-store layout. Web typecheck remains blocked by unrelated branch-selector, model-picker, preview, and atom-registry errors; mobile typecheck remains blocked by the linked markdown package's missing React/JSX resolution, with no errors reported from the changed Version Control files.SourceControlPanelServicetests; all passed. Targeted formatting/lint, server typecheck, and diff checks passed, with only six pre-existing Effect suggestions in unrelated orchestration code. A fixed-port Playwright pass committed onlycommit-warning-success.txtfrom the throwaway repository through a successful pre-commit hook that printedCannot find native binding; the panel advanced from 11 to 12 commits ahead and refreshed from six to five working-tree files without surfacing a false failure.@t3tools/mobile-markdown-textpackage's missing React/JSX resolution and broad pre-existing downstream JSX errors. A compatibleT3 Code Devclient was installed, but integrated iOS Simulator verification was blocked before application code loaded because Metro could not resolve its existingexpo/virtual/envmodule through the worktree's shared pnpm symlink layout, including after a frozen install and client-env-disabled retry.generated-by-hook.txt, and preserved the commit failure message.SourceControlPanelServiceand GitLab provider tests; all passed. Server package typecheck, targeted lint, formatting, and diff checks passed. An isolated fixed-port web/server environment started successfully, but integrated browser assertions were unavailable because Playwright's profile was locked by another active session and the fallback controlled browser rejected its session credential before timing out.SourceControlPanelService, VCS broadcasting and Git driver behavior, provider base detection and error handling, self-hosted GitLab CLI behavior, and desktop context-menu integration.SourceControlPanelServicetests and all 12 native Version Control model tests; both passed. The server package typecheck, targeted formatting/lint, mobile native static checks, and diff checks also passed. Mobile package typecheck remains unavailable because its linked@t3tools/mobile-markdown-textpackage cannot resolve React/JSX types and triggers broad pre-existing failures outside the changed files.SourceControlPanelServiceandGitVcsDriverCoretests plus 14 focused native Version Control model/request tests; all passed. Server typecheck, targeted lint, formatting, and diff checks also passed. The mobile package typecheck remains unavailable in this checkout because its linked@t3tools/mobile-markdown-textpackage cannot resolve React or@t3tools/shared/skillInlineTokens, producing unrelated pre-existing JSX/type failures across the mobile package.pnpm exec vp checkpassed with 0 errors and 9 existing warnings in unrelated web files.pnpm exec vp run typecheckpassed.pnpm exec vp run lint:mobilepassed its available static checks; optional SwiftLint, ktlint, and detekt checks were skipped because those tools are not installed.13782, web client on5742, and disposable throwaway repository verified that an intentional selected-file commit failure surfaces throughvcs.panel.commitStagedwithout staging either file; after removing the failing hook, the selected-only commit succeeded, included onlyselected.txt, leftdeselected.txtunstaged, and left the real index empty.[literal].txtbesideliteral1.txt: discarding the bracketed path left the neighbor modified, and stashing the bracketed path produced a stash containing only[literal].txtwhile the neighbor remained modified.Proof
Note
High Risk
Large surface area touching server-side Git mutations, multi-client sync, and provider/auth integrations; incorrect refresh or metadata sequencing could show stale repo state or overwrite thread branch info.
Overview
Adds a Git-backed Version Control command center on the web right panel and a native mobile route, driven by new server
SourceControlPanelRPCs and documented inSOURCE_CONTROL.md/BRANCH_DETAILS.md.Web and chat integration mounts a singleton
source-controlsurface per environment/cwd (including multi-environment federated panels), with cached snapshots, incremental vs full refresh, thread metadata routing viaexpectedBranch, and cwd-scoped file previews for sibling worktrees.Mobile wires
VersionControlandVersionControlDiffstack routes from Git menus, a controller/view that mirrors Actionable/Remotes (selection, commit/stash/discard, branches, stashes, remotes), cwd-scoped snapshot sequencing, working-tree enrichment, anduseAtomQueryRunnerforceRefreshfor panel queries.Server and providers extend panel services, VCS watchers (
.git/filtering, worktrees), sanitized error causes (ErrorCause.ts), and provider paths—including Azure DevOps PR listing and commit avatars scoped to the remote organization and Commits API 7.1; commit author avatars are opt-in per provider setting.Desktop context menus now honor explicit
separatoritems and still insert a separator before the first destructive action when the menu does not start with one.Cross-cutting behavior called out in the new docs: conservative automatic
git fetch --all, selected-file commits via a temporary index, literal pathspecs, mutation-then-reconcile error handling, and focused unit/Playwright coverage expectations.Reviewed by Cursor Bugbot for commit 30153d1. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Version Control command center panel to web and mobile
SourceControlPanelServiceon the server with comprehensive RPC endpoints for VCS panel operations, wired into the WebSocket layer with scope-based auth.getCommitAvatarUrlto GitHub, GitLab, Azure DevOps, and Bitbucket providers, with per-provider settings inServerSettingsto control avatar display.git.ts,ipc.ts,rpc.ts) with new schemas for change groups, worktree change sets, remotes, branch details, stash, and commit summaries.VcsStatusBroadcaster, including sibling worktree discovery and ref-counted watcher lifecycle management.source-controlsurface torightPanelStore, with migration preserving existing cwd overrides.Macroscope summarized 30153d1.