Local code review in the session file-changes panel (code_review) - #197
Local code review in the session file-changes panel (code_review)#197serxa wants to merge 2 commits into
Conversation
Browser panel for reviewing on-disk git worktrees with line-anchored, two-way review comments before anything is committed or pushed. Adds the code_review config section, ReviewStore + migration, the gitreview gateway and /api/review routes, and the web review panel folded into the session file-changes view. Rebased onto current main: the code_review migration is numbered v045 (main took v040-v044), and CodeReviewConfig.from_dict routes through @_coerced like every other config section so string env values coerce to their declared types. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5639691 to
ec9bcdc
Compare
Rebased onto current
|
Human line comments are now staged as drafts (pending) instead of each injecting
its own turn into the target session. A "Submit review" action delivers the whole
review — an optional overall summary + all pending comments — as a single turn,
GitHub-style.
- db: v046 adds code_review_comments.pending; ReviewStore.add_comment(pending),
list_pending_comments, mark_review_submitted
- routes: human comments stored pending (no per-comment inject);
POST /api/reviews/{id}/submit builds one batched message + one engine.run
- web: pending "draft" badge on staged comments; "Submit review (N)" bar with an
optional summary box, in the worktree + file views
- tests: staging (no inject), batched submit (one turn), agent reply unaffected
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Added batched review submission (commit 660192d): human line comments are now staged as drafts; a "Submit review" action delivers the whole review — optional summary + all pending comments — to the target session as one turn instead of one turn per comment.
Full suite 3204 passed (1 pre-existing unrelated xmemory failure); |
Local code review inside the session's file-changes panel (
code_review)Review code before it's committed or pushed, from inside a session's file-changes panel (Chat → the Files button). A session can attach one or more git worktrees; their diffs (vs a base ref) and line-anchored comment threads show in the panel. Off by default; enabled per-install via config.
Why
Reviewing an agent's in-progress changes meant reading raw
git diffin a terminal — no way to point at a specific line and discuss it inside Nerve. This adds a two-way, line-anchored review loop for local (uncommitted) code, organized around "this session ↔ these worktree(s)".What it does
worktree+base_ref+target_session_id) → threads (file + line + side) → comments (stagedpendinguntil submitted).Config (off by default)
Only files inside a configured repo root (or one of its git worktrees) are served, path-traversal guarded. Every route requires the existing web-UI auth.
Changes
CodeReviewConfig(enabled + repo roots + max file size)v045(reviews / threads / comments) +v046(commentpendingflag);ReviewStore(session filter, pending staging, batched submit)gitreview.py(worktree enumeration, working-tree diffs, file-at-ref, path guard) reusingcompute_file_diff;routes/reviews.py—/api/review/*reads,/api/reviews/*CRUD, andPOST /api/reviews/{id}/submit(one batched turn to the session)test_reviews.py— store (session filter, pending/submit), git helpers (incl. traversal guard), routes (staging does not inject; submit delivers one turn)Backend changes are additive (new tables/columns/routes/config); migrations create/alter only the code-review tables.