The review gate builds the synthetic merge in a temporary worktree whose
path was interpolated raw into Runner(shell=True) commands: paths with
spaces or shell metacharacters were split by the shell, so git's worktree
admin entry could survive cleanup (criterion 7 violation; CWD was also
misleading on failure).
- shlex.quote the worktree path in 'git worktree add --detach' and
'git worktree remove --force'; SHA validation is unchanged.
- sanitize the mkdtemp prefix token ('owner/name' -> 'owner-name'), so a
repo name with separators/punctuation cannot make mkdtemp fail.
- hermetic real-git tests: temp root containing a space and '$'
constructs and cleans up completely (dir gone + absent from 'git
worktree list --porcelain'); repo token with separators builds a
single-component prefix and cleans up.
Review gate: replaces the arbitrary repo_dir test target with a
review_workspace seam that builds a clean temporary git worktree from
the configured clone, fetches the exact base/head SHAs, and constructs
a real synthetic merge of the reviewed head onto the reviewed base.
Verdicts pin repo, PR, head SHA, and base SHA; tests + git diff --check
run inside the workspace with an explicit base..HEAD range; a merge
conflict yields a deterministic BOUNCE with conflicted-file evidence and
the suite is never run against a fallback checkout; no workspace
configured fails closed to NEEDS_GUIDANCE. Worktrees/refs are cleaned up
on success, conflict, timeout, and exceptions; the configured clone and
worker issue worktrees are never mutated.
Policy: before applying any verdict the PR is re-read and the verdict is
refused (outcome=stale/PAIR_MOVED, zero side effects) if the head OR
base moved after evaluation — the new pair stays eligible for a fresh
review. Client: normalized PR shape gains base_sha (REVIEW_CLONE_DIR is
the new config knob). Hermetic tests build local temp repos proving
clean merge, conflict, moved head/base, no shared-checkout mutation,
correct command cwd/range, and cleanup on failure (no network).