Skip to content

Add Jujutsu repository support for /codex:review - fixes #215#292

Open
masterzen wants to merge 5 commits intoopenai:mainfrom
masterzen:masterzen/add-support-for-jj-vcs
Open

Add Jujutsu repository support for /codex:review - fixes #215#292
masterzen wants to merge 5 commits intoopenai:mainfrom
masterzen:masterzen/add-support-for-jj-vcs

Conversation

@masterzen
Copy link
Copy Markdown

What?

Add end-to-end support for reviewing changes in Jujutsu (jj) (see https://github.com/jj-vcs/jj) repositories, not just Git repositories. This fixes #215.

This stack teaches the review flow how to:

  • detect whether the current repository is Git or Jujutsu and route review behavior accordingly
  • collect review context from jj repositories for both working-copy and branch-based reviews
  • resolve review targets in jj terms, including default-base detection and explicit --base handling
  • scope branch reviews to the fork point with the chosen base so reviews focus on branch-owned changes
  • run plain /codex:review through the native review API for jj repositories by sending Jujutsu-specific review instructions
  • cover the new behavior with backend, VCS-detection, and runtime tests

Why?

The goal is to make /codex:review and /codex:adversarial-review work as a first-class feature in jj repositories instead of assuming Git semantics.

Without this, review support is incomplete in several important ways:

  • repositories using jj cannot rely on the same default review workflow as Git repositories
  • review context can be framed in Git terms that do not match how jj users reason about their work
  • branch reviews risk including unrelated changes from the base branch instead of only the branch’s own delta
  • repository detection can choose the wrong VCS in nested or colocated layouts, which undermines the whole review flow

This change closes that gap so users can review jj work with the same command, while getting review targets and context that match Jujutsu concepts.

Notes

There are still some limitations:

  • Plain /codex:review in jj repos uses the native review API, but it does so through a custom review target with Jujutsu-specific instructions rather than Git-specific structured target types.
  • Plain native review does not accept custom focus text, so focused review prompts still need the adversarial-review path.
  • Default base detection is using an heuristic when trunk() is unavailable and depends on common bookmark names.
  • For large diffs that fall back to summary-based review input, the guidance is intentionally sandbox-safe and avoids asking the reviewer to inspect the repo by running jj commands itself.

masterzen added 5 commits May 3, 2026 13:58
Introduce jj.mjs with Jujutsu-native implementations of all
VCS operations: detection, workspace root, working tree state,
review target resolution, and diff collection (working copy
and range modes).

Add vcs.mjs as a dispatch layer that auto-detects jj vs git
and routes all VCS calls to the appropriate backend. Update
codex-companion.mjs and workspace.mjs to import through
vcs.mjs so jj repos use jj-native commands throughout.

The native Codex reviewer only understands git, so jj repos
fall back to the context-collection review path which uses
our jj backend for diff gathering.

JJ-Change-Id: vqqkyxznqrqn
Test detectVcs for .jj/.git directory detection, colocated
repo preference, upward directory walking, caching, and the
error case when neither VCS is found.

JJ-Change-Id: qvrvvyzosxlu
Cover working copy and range review context collection,
ANSI stripping, self-collect fallback for large diffs,
custom --base revset support, and review context shape
parity with the git backend.

JJ-Change-Id: qrqqnnstvsqq
Detect default jj review bases from available bookmarks when trunk() is unavailable, diff branch reviews from the fork point/common ancestor instead of the live base bookmark tip, and keep self-collect guidance sandbox-safe. Add coverage for nested VCS root detection and the new jj review-context cases.

JJ-Change-Id: pqrxknwuxups
Route plain /codex:review for jj repositories through the native review/start API using a custom target with jj-specific instructions, instead of falling back to the prompt-built turn/start path. Add runtime coverage for the outgoing native review payload.

JJ-Change-Id: knywmwzwwrlt
@masterzen masterzen requested a review from a team May 3, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support jujutsu (jj) workspaces

1 participant