Skip to content

Add CR-6 agent review, PR questions and review instructions (#325) - #422

Merged
BunsDev merged 1 commit into
mainfrom
cr6-review
Oct 28, 2026
Merged

BunsDev merged 1 commit into
mainfrom
cr6-review

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

CR-6 for #319, per #325: the native AI review and PR-question slice of Code Review, built on Phase 1's isolation proof.

What it does

  • code-review:agent, a local-only main channel (status, instructions, start, stop). A review or a question runs the installed Claude Code CLI under the person's own login on a snapshot of the PR's diff. Main reads everything itself through gh (GET only): identity, the repository by id, the pull request, every files page, then the pull request again so the head and target are proven to have held across the reads. A moved head or target refuses the start and the pane offers Reload.
  • Confinement in code and in the real process environment: the fixed argv --safe-mode --restricted --tools Read --strict-mcp-config --mcp-config {"mcpServers":{}} --disable-slash-commands --setting-sources "" --permission-mode dontAsk --permission-prompts none --no-session-persistence, no permission tool (a prompt that arrives anyway is refused and counted), and an environment without GH_*, GITHUB_*, MODEX_*, AWS_*, the other provider's keys, or anything named like a token or secret. The CLI's cwd is a 0700 snapshot directory holding only main's own files; it is removed when the run ends.
  • Records before execution: each run is written to review-agent/state.json before the CLI spawns; a crash leaves a record the next start marks unknown. Nothing is ever re-run or retried. One run per PR, two at once.
  • Findings as claims: read from the reply's final json block, bound to CR-5 line anchors only where every named line is in an included patch's head side, otherwise shown as unverified or without a location. Omitted files (binary, too large, over budget, over the file cap, no patch) are listed per run. A run shows "Outdated" once the PR's head or base differs. "Add to review draft" exists only for anchored findings at the current head and feeds CR-7's review draft; nothing reaches GitHub without CR-7's preview and submit.
  • R3 instructions: one versioned text per Mac; the popover states the scope ("every pull request you review in Modex, on any repository, saved on this Mac only"); each run records the instructions version it used.
  • UI: C27 Review panel with Start/Stop and the model select (C59), C28/C56 instructions popover, "Claude's review" in the overview, C57 Ask about this pull request, C54 Add to chat. C82 stays open; the panel states the confinement in words.

Mock evidence (no model, no network, synthetic gh and claude)

  • Unit (pnpm test, apps/desktop): 2025 tests, 0 failed, 17 skipped (platform-gated). New test/code-review-agent.test.ts (15) plus extensions to the Claude backend, contract and drain tests.
  • E2E e2e/code-review-agent.spec.ts (5 passed) in real Electron with a synthetic claude that answers the probes, records each run's argv and environment, and plays fail / hang / scripted-reply modes: instructions scope and versioning across reload; Start as the only trigger, the exact confined argv with MODEX_HOME, GH_CONFIG_DIR and GH_TOKEN unset, snapshot cleanup, failure shown, no second start after reload; scripted findings anchored and unverified, Add to review draft, head move refused then Outdated; question with Add to chat; Stop, busy from main, crash → unknown with nothing replayed. code-review-regressions.spec.ts now proves opening the panel and popover starts nothing.
  • Full E2E suite: 477 cases, 470 passed, 7 skipped, 0 failed (16.2 min), on the build before a code review's fixes; unit, agent and regression specs reran green on the fixed build.
  • Native isolation, opt-in (MODEX_CR6_NATIVE=1, Claude Code 2.1.312 under a sandbox-exec guard against a scripted loopback provider): 6 passed, including a new case that runs the shipped REVIEW_CONFINEMENT_ARGS imported from the build. Only Read advertised; injected Bash, Write, WebFetch, MCP, outside and symlink reads all denied; no write, hook or MCP marker.

Live evidence

None. No authenticated Claude Code run against a real pull request was made. The open gate is one authorized smoke on a repository Val names, recording the argv used, the snapshot's file list, the reply, the bound findings and the absence of any GitHub write.

Docs

docs/design/code-review.md (new "CR-6 agent review and questions" section, inventory rows for C27/C28/C54/C56/C57/C59, open decision 7 note), docs/status.md, docs/reviews/2026-10-28-cr6-native-review.md.

Checkpoint

  • Full SHA: fecdfcfb3dd9b5496798d562b6b6b65c7952dc38 (signed) on cr6-review, cut from main at 6c9000f.
  • Remaining gates: authorized live smoke; C82 decision; CI on this PR.
  • Next action: review and queue; then the live smoke when Val names a repository.

🤖 Generated with Claude Code

Main gains a local-only `code-review:agent` channel. A review or a question runs
the installed Claude Code CLI under the person's own login on a snapshot of the
pull request's diff that main reads itself through gh (GET only, repository by
id, pull request, every files page, then the pull request again to prove the
head and target held). The run is recorded before the CLI starts; the CLI is
confined to `--safe-mode --restricted --tools Read` with no permission tool and
an environment stripped of gh, GitHub, Modex and other credentials; the snapshot
is removed when the run ends. Findings bind to CR-5 line anchors only where the
named lines are in an included patch; otherwise they are shown as unverified.
Runs are bound to the head they read, marked outdated when it moves, stopped
explicitly, and read as unknown after a crash; nothing is retried or posted.
Review instructions are one versioned text per Mac whose scope the popover
states; each run records the version it used.

Renderer: Review panel (C27), instructions popover (C28/C56), "Claude's review"
in the overview with coverage, reply, findings and trail, "Add to review draft"
for anchored findings, Ask about this pull request (C57), Add to chat (C54).

Evidence: unit (code-review-agent.test.ts and friends), E2E over a synthetic
claude and gh (code-review-agent.spec.ts), the opt-in native isolation test
extended with the shipped argv. No authenticated live run is recorded; that and
C82 stay open. See docs/reviews/2026-10-28-cr6-native-review.md.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 28, 2026 9:46am UTC

Request Review

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main d717bb0 cr6-review fecdfcf +/-
65% 66% +1%
View coverage of the 10 most impacted files.
File main d717bb0 cr6-review fecdfcf +/-
apps/desktop/sr...eview/writes.ts 0% 86% +86%
apps/desktop/sr...gent-service.ts 0% 93% +93%
apps/desktop/sr...rite-service.ts 0% 97% +97%
apps/desktop/sr...review-write.ts 0% 100% +100%
apps/desktop/sr...review-agent.ts 0% 100% +100%
apps/desktop/sr...gent/records.ts 0% 100% +100%
apps/desktop/sr...gent/context.ts 0% 100% +100%
apps/desktop/sr...ons/write-gh.ts 0% 100% +100%
apps/desktop/sr...ent/findings.ts 0% 100% +100%
apps/desktop/sr...ge-preflight.ts 0% 100% +100%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

This branch was successfully deployed

1 active deployment
Preview — fecdfcfb Deployed Oct 28, 2026 by vercel[bot]
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.

1 participant