Skip to content

feat(vcs): let Git worktrees and Jujutsu workspaces coexist - #22

Merged
NicholasZolton merged 2 commits into
mainfrom
NicholasZolton/assess-jujutsu-support
Sep 30, 2026
Merged

NicholasZolton merged 2 commits into
mainfrom
NicholasZolton/assess-jujutsu-support

Conversation

@NicholasZolton

@NicholasZolton NicholasZolton commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Moving a project to Jujutsu needs to be gradual: existing Git worktree threads must keep working while new threads use Jujutsu workspaces. Cleanup, restart, rewind, and publishing must preserve the original workspace backend and its work.

Selectively port upstream #13816, preserving the fork's configured workspace layout, discovery, review authorization, and provider behavior. Record workspace ownership in shared Git config, recover through the original backend, and preserve recreation refs before removal. Resolve Jujutsu revisions before Git history reads and explicitly synchronize named refs for hosting operations.

Checkpoints include new files up to 10 MiB and report unexpected exclusions in thread activities. Web, desktop, and mobile expose Jujutsu-aware source-control actions and an inheritable VCS-agent-hints setting; hints refresh for existing/resumed sessions and Codex compaction. New isolated threads inherit the project backend automatically.

Test plan

  • Three real SQLite/Git/Jujutsu integration scenarios: mixed-backend turns/rewind and exclusions, cleanup/restart/resume, and publishing with stale Git refs and project overrides, against local jj 0.45.1.
  • 646 focused server tests across provider, checkpoint, workflow, review, discovery, PR-discovery, settlement, server, and migration integration suites after integrating latest fork main.
  • 256 web source-control/settings, mobile review/context, client-runtime action, and shared Git-helper tests (902 focused tests total).
  • Server, web, mobile, and desktop typechecks.
  • Targeted formatting/lint and wiki metadata/link validation. The new Jujutsu installer passes zizmor; the existing CI workflow retains its pre-existing findings, with local-action syntax advice on the added setup step.
  • Post-merge macOS arm64 desktop artifact rebuilt from /Users/nicholas/Documents/Projects/t3code. Verified that /Applications/T3 Code (Alpha).app resolves to the rebuilt app, packaged as version 0.0.44 with t3codeCommitHash: 103232e31592.
  • Interactive UI pass and before/after screenshots: the built-in Browser panel reports unavailable; Nicholas authorized proceeding without them.

Rollout note

Merged into fork main at 103232e31592. The normal local checkout and this OpenCode session are on main; the desktop artifact is ready for the next app restart. GitHub CI jobs were still queued when the PR merged; the completed verification above was run locally.

Requires a Git-colocated main checkout and jj >= 0.42.0 on each server host. Secondary Jujutsu workspaces need no .git. Existing Git threads remain Git after cleanup/recreation and phase out as they finish. Remote runtime deployment is a separate coordinated restart.

Implemented with GPT-6.1 Sol (openai/gpt-6.1-sol) in the OpenCode harness.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 06:16
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL labels Sep 30, 2026
@NicholasZolton
NicholasZolton merged commit 103232e into main Sep 30, 2026
8 of 17 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Jujutsu status failures are masked as clean state, and several repository identity, configuration-write, and mobile terminology paths remain incorrect.

Review effort: Balanced
Findings: 2 High severity · 1 Medium severity · 2 Low severity

Open (5)
What changed in this PR

Ports Jujutsu support while preserving existing Git worktrees and enabling gradual, backend-aware migration.

Changes:

  • Adds Jujutsu detection, workspace lifecycle, checkpoints, diffs, remotes, and publishing.
  • Propagates VCS terminology and agent hints across server, web, and mobile.
  • Adds CI setup and architecture/user documentation.
File Description
wiki/​upstream-integration.md Records the selective upstream port.
wiki/​log.md Logs the compatibility update.
packages/​shared/​src/​vcs.ts Defines shared VCS terminology.
packages/​shared/​src/​git.ts Preserves VCS metadata in streamed status.
packages/​shared/​src/​git.test.ts Tests status metadata merging.
packages/​shared/​package.json Exports the VCS helper.
packages/​contracts/​src/​settings.ts Adds configurable VCS agent hints.
packages/​contracts/​src/​provider.ts Carries per-turn VCS hints.
packages/​contracts/​src/​git.ts Adds VCS status metadata.
docs/​user/​source-control.md Documents Jujutsu usage.
docs/​README.md Links Jujutsu internals.
docs/​internals/​jujutsu.md Documents architectural constraints.
apps/​web/​src/​shared/​hooks/​useGitStatus.ts Exposes VCS-aware status.
apps/​web/​src/​settings/​model.ts Models the hint setting.
apps/​web/​src/​components/​settings/​SourceControlSettings.tsx Adds global hint controls.
apps/​web/​src/​components/​settings/​ProjectSettings.tsx Adds project overrides.
apps/​web/​src/​components/​git/​useGitActions.ts Routes VCS-aware actions.
apps/​web/​src/​components/​git/​GitResetDialog.tsx Adapts reset terminology.
apps/​web/​src/​components/​git/​GitPublishDialog.tsx Adapts publishing terminology.
apps/​web/​src/​components/​git/​GitPullDialog.tsx Adapts pull terminology.
apps/​web/​src/​components/​git/​GitInitDialog.tsx Supports Jujutsu initialization.
apps/​web/​src/​components/​git/​GitCreateBranchDialog.tsx Supports bookmark creation.
apps/​web/​src/​components/​git/​GitCommitDialog.tsx Adapts commit terminology.
apps/​web/​src/​components/​git/​GitActionDialogs.tsx Propagates VCS context.
apps/​web/​src/​components/​git/​ChangedFilesList.tsx Uses VCS-aware labels.
apps/​web/​src/​components/​chat/​WorktreeSetupCard.tsx Updates setup presentation.
apps/​web/​src/​components/​ThreadPanel.tsx Propagates thread VCS state.
apps/​web/​src/​components/​ReviewPanel.tsx Adapts review terminology.
apps/​web/​src/​components/​GitStatusPanel.tsx Adds Jujutsu-aware controls.
apps/​web/​src/​components/​GitStatusButton.tsx Reflects VCS state.
apps/​web/​src/​components/​GitStatusBadge.tsx Reflects VCS state.
apps/​web/​src/​components/​GitInitPopup.tsx Offers Jujutsu setup.
apps/​web/​src/​components/​GitBranchSelector.tsx Supports bookmark terminology.
apps/​web/​src/​components/​GitBranchIndicator.tsx Displays VCS-aware refs.
apps/​web/​src/​components/​GitBranchActionButton.tsx Adapts ref actions.
apps/​web/​src/​App.tsx Integrates VCS-aware UI state.
apps/​server/​src/​vcs/​VcsTypes.ts Defines driver interfaces.
apps/​server/​src/​vcs/​VcsProcess.ts Provides VCS command execution.
apps/​server/​src/​vcs/​VcsDriverRegistry.ts Detects and selects drivers.
apps/​server/​src/​vcs/​VcsStatusBroadcaster.ts Streams VCS-aware status.
apps/​server/​src/​vcs/​VcsProjectConfig.ts Resolves project VCS selection.
apps/​server/​src/​vcs/​VcsGit.ts Implements the Git driver.
apps/​server/​src/​vcs/​VcsCommandService.ts Routes VCS commands.
apps/​server/​src/​vcs/​WorkspaceOwnership.ts Persists workspace backend ownership.
apps/​server/​src/​vcs/​JjWorkspaceIdentity.ts Resolves Jujutsu workspace identity.
apps/​server/​src/​jj/​JjTypes.ts Defines Jujutsu-specific types.
apps/​server/​src/​jj/​JjStatus.ts Implements Jujutsu status.
apps/​server/​src/​jj/​JjReviewDiff.ts Produces Jujutsu review diffs.
apps/​server/​src/​jj/​JjRemotes.ts Handles Jujutsu remotes and publishing.
apps/​server/​src/​jj/​JjRepo.ts Resolves colocated repositories.
apps/​server/​src/​jj/​JjRevisions.ts Resolves Jujutsu revisions.
apps/​server/​src/​jj/​JjProcess.ts Runs Jujutsu commands.
apps/​server/​src/​jj/​JjOperations.ts Implements Jujutsu operations.
apps/​server/​src/​vcs/​JjCheckpoints.ts Captures and restores checkpoints.
apps/​server/​src/​jj/​JjChangeAttribution.ts Attributes Jujutsu changes.
apps/​server/​src/​sourceControl/​SourceControlRepositoryService.ts Adds Jujutsu publishing paths.
apps/​server/​src/​serverRuntimeStartup.ts Registers VCS services.
apps/​server/​src/​project/​RepositoryIdentityResolver.ts Resolves Jujutsu repository identity.
apps/​server/​src/​provider/​Layers/​OpenCodeAdapter.ts Injects VCS agent hints.
apps/​server/​src/​provider/​Layers/​CodexAdapter.ts Refreshes Codex VCS hints.
apps/​server/​src/​orchestration/​Layers/​ProviderCommandReactor.ts Resolves hints per turn.
apps/​server/​src/​orchestration/​Layers/​CheckpointReactor.ts Reports checkpoint exclusions.
apps/​server/​src/​orchestration/​ThreadCommandDispatcher.ts Propagates backend selection.
apps/​server/​src/​jj/​JjWorkspaces.ts Manages Jujutsu workspaces.
apps/​server/​src/​git/​GitWorkflowService.ts Routes mixed-backend lifecycle operations.
apps/​server/​src/​git/​GitStatus.ts Integrates driver status.
apps/​server/​src/​git/​GitWorktreeService.ts Preserves Git worktree behavior.
apps/​server/​src/​git/​GitReviewDiff.ts Resolves VCS-aware revisions.
apps/​server/​src/​git/​Git.ts Integrates VCS services.
apps/​server/​src/​checkpointing/​CheckpointService.ts Delegates checkpoint operations.
apps/​server/​src/​__tests__/​testServerHarness.ts Supports VCS integration tests.
apps/​mobile/​src/​features/​settings/​settings.ts Models mobile VCS settings.
apps/​mobile/​src/​features/​settings/​SettingsSourceControlScreen.tsx Adds mobile hint controls.
apps/​mobile/​src/​features/​review/​reviewModel.ts Adds VCS-aware review labels.
apps/​mobile/​src/​features/​review/​ReviewSections.tsx Renders VCS terminology.
apps/​mobile/​src/​features/​threads/​worktree-setup-card.tsx Adds setup terminology support.
apps/​mobile/​src/​features/​threads/​ThreadGitControls.tsx Adds Jujutsu-aware controls.
apps/​mobile/​src/​features/​threads/​GitOverviewSheet.tsx Adapts mobile status UI.
apps/​mobile/​src/​features/​threads/​ThreadDetailScreen.tsx Resolves thread terminology.
apps/​mobile/​src/​features/​projects/​ProjectsScreen.tsx Adds Jujutsu project actions.
apps/​mobile/​src/​features/​newThread/​NewThreadScreen.tsx Inherits project backends.
apps/​mobile/​src/​features/​more/​MoreScreen.tsx Exposes source-control settings.
apps/​mobile/​src/​components/​CloneRepositoryDialog.tsx Supports VCS-aware cloning.
apps/​mobile/​src/​app/​RootNavigator.tsx Registers source-control navigation.
.github/​workflows/​ci.yml Installs Jujutsu for CI.
.github/​actions/​setup-jj/​action.yml Defines pinned Jujutsu installation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +75 to +82
const write = (key: string, value: string) =>
JjProcess.colocatedGitCommand(
process,
"JjRemotes.writeBookmarkUpstreamConfig",
{ gitDir, cwd: input.cwd },
["config", key, value],
{ allowNonZeroExit: true, timeoutMs: 10_000 },
).pipe(Effect.ignore);
Comment on lines +308 to +318
const readings = yield* Effect.all({
change: driver.currentChange(input.cwd),
segment: driver.currentSegment(input.cwd),
}).pipe(Effect.option);

if (readings._tag === "None") {
return { isRepo: true, vcs: { kind: "jj" as const }, ...EMPTY_LOCAL_STATUS };
}

const refName = yield* resolveWorkspaceRefName(driver, input.cwd, readings.value.segment);
const files = readings.value.change.fileStats
Comment on lines +128 to +129
export function resolveRepositoryRootFromMarkers(cwd: string): string | null {
let current = cwd;
Comment on lines +127 to +129
function workingTreeSubtitle(terminology: VcsTerminology): string {
return `Tracked, staged, and untracked ${terminology.workspaceNoun} changes`;
}
Comment on lines 17 to +18
export interface WorktreeSetupCardProps {
vcsTerminology?: VcsTerminology;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants