Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add support for jujutsu VCS #743

Closedponbac(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/743/headopened View on GitHub

What Changed

Why

UI Changes

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

Add Jujutsu VCS backend support alongside existing Git backend

  • Introduces a jj (Jujutsu) VCS backend throughout the stack, alongside the existing git backend, by adding VcsBackend, VcsRefKind, VcsRef, and related schemas in packages/contracts/src/vcs.ts.
  • Adds server-side VcsCore, VcsManager, VcsProcess, and VcsResolver services that detect and dispatch to git or jj backends; jj support requires a colocated Git workspace and uses jj log/jj workspace root commands.
  • Replaces the branch/worktreePath data model with vcsBackend/refName/refKind/workspacePath across orchestration events, projection threads, DB schema, and app state; a new migration (014_ProjectionThreadsVcsMetadata) backfills existing rows.
  • Updates the branch selector, branch toolbar, and Git actions control in the web app to be backend-aware, displaying bookmarks for jj and branches for git, and routing VCS API calls through a new api.vcs.* namespace.
  • Risk: the branch/worktreePath fields are removed from the projection and orchestration schemas; legacy event payloads are normalized via normalizeLegacyThreadVcsMetadata, but any client or stored event not handled by that normalization may lose branch data.
📊 Macroscope summarized 4dc48c8. 40 files reviewed, 31 issues evaluated, 6 issues filtered, 5 comments posted

🗂️ Filtered Issues

apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 237: The listThreadSessionRows SQL query fetches provider_session_id and provider_thread_id columns, but the ProjectionThreadSessionDbRowSchema (derived from ProjectionThreadSession) does not include these fields. Consequently, these fields are stripped during decoding and are not present on the row object. Furthermore, the mapping logic in the loop explicitly constructs the session object without these properties. This results in the OrchestrationSession objects in the snapshot missing the providerSessionId and providerThreadId data, which are typically critical for session management and provider interactions. [ Out of scope ]
apps/server/src/orchestration/decider.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 328: In thread.turn.start, the runtimeMode and interactionMode settings from the command are ignored if the thread already has values for them. The logic readModel...?.runtimeMode ?? command.runtimeMode prioritizes the existing thread state. Since thread.create populates these fields, they will effectively always exist on the thread, making it impossible for the thread.turn.start command to override them for a specific turn (e.g., forcing a turn to be non-interactive). The command parameters should likely take precedence over the stored default. [ Out of scope ]
apps/server/src/orchestration/projector.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 301: The normalizeLegacyThreadVcsMetadata helper function logic for determining refKind is flawed when branch is explicitly null. The check hasLegacyBranch = input.branch !== undefined evaluates to true for null values, causing refKind to default to "branch" even when the intention is to clear the branch. This results in the thread being updated with refName: null but refKind: "branch", leaving the data in an inconsistent state. [ Out of scope ]
apps/server/src/vcs/Layers/VcsCore.ts — 0 comments posted, 2 evaluated, 1 filtered
  • line 376: Critical data loss risk in removeWorkspace. The function executes a recursive directory deletion (rm) on input.path even when jj workspace forget fails with a "no such workspace" error (suppressed in lines 376-381). If a caller provides an incorrect path (e.g., due to a typo or API misuse), jj will correctly report that no such workspace exists, but the code will interpret this as "workspace already forgotten" and proceed to delete the directory at input.path. This allows deletion of arbitrary non-workspace directories on the filesystem. [ Out of scope ]
apps/web/src/components/BranchToolbar.tsx — 0 comments posted, 1 evaluated, 1 filtered
  • line 77: The setThreadBranch callback relies on serverThread.vcsBackend to determine whether to send refKind: "bookmark" (for jj) or "branch" (for git). However, it also calls setThreadBranchAction (imported from the store), which optimistically updates the local thread state. The setThreadBranch action in store.ts (visible in references) unconditionally sets vcsBackend to "git" and does not accept a backend parameter. [ Cross-file consolidated ]
packages/contracts/src/vcs.ts — 1 comment posted, 7 evaluated, 1 filtered
  • line 62: The schema definition attempts to reuse fields by spreading ...VcsInputBase.fields, but VcsInputBase is an Effect Schema instance (created via Schema.Struct), which does not expose a .fields property. As a result, the spread operation contributes nothing, and the VcsCreateWorkspaceInput schema will miss the cwd and backend properties. This causes the decoder to strip cwd from the input (or error on excess properties), leading to missing data at runtime. Use Schema.extend(VcsInputBase, Schema.Struct({ ... })) to correctly compose the schemas. [ Out of scope (triage) ]
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. 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: 130cef4e-2e28-4607-98fb-8a355fd9b36f

      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
      • Post copyable unit tests in a comment

      Tip

      Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Share your feedback on Discord.


      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.
    3. Why close this @ponbac?

      Accidentally targeted the upstream from my fork.

      I still really want this feature but I realized that vibing it together is not the right approach. Doing this properly requires quite extensive knowledge of the codebase and will involve both product and architectural decisions, which is probably something for @juliusmarminge and @t3dotgg to decide upon.

      Regardless, I will probably pick this up again soon and give it a proper try.

Sign in to join this conversation.