Local code review in the session file-changes panel (code_review)#197
Draft
serxa wants to merge 2 commits into
Draft
Local code review in the session file-changes panel (code_review)#197serxa wants to merge 2 commits into
serxa wants to merge 2 commits into
Conversation
A browser panel to review on-disk git worktrees before anything is committed or pushed, with line-anchored comment threads that route into a Nerve session and back. Gated by config (default off); repo roots are configurable. - config: CodeReviewConfig (enabled + repo roots + max_file_bytes) - db: migration v040 + ReviewStore (reviews / threads / comments) - gateway: gitreview helpers (worktree enumeration, working-tree diffs, file-at-ref, path-traversal guard) reusing compute_file_diff; /api/review/* and /api/reviews/* routes. Human comments inject into the review's target session via a detached engine.run; agent replies mark the thread answered. - web: /review page with a line-anchored diff renderer, inline comment threads (reply/resolve), worktree picker, changed-files list, full-file view, and a target-session selector. - tests: ReviewStore, git helpers (incl. traversal guard), and routes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the standalone /review panel with a per-session model: a session can attach one or more git worktrees, whose diffs (vs a base ref) and line-anchored comment threads show in the Chat file-changes panel. Human comments route into that session; the agent replies back on the thread. - backend: list_reviews gains a target_session_id filter; GET /api/reviews?session= - web: session-scoped reviewStore; FileChangesPanel gains an "Attached worktrees" section (attach picker + git changed-files + line-anchored ReviewDiff + threads); the Files button is always available; remove the /review route, NavRail entry, ReviewPage - tests: session-filter coverage Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 topoint 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
then browse its working-tree diff vs a base ref + a full-file view.
posts back onto the thread (marking it answered). The agent can also originate threads to point
the human at a line.
worktree+base_ref+target_session_id) → threads (file + line + side)→ comments, persisted in the DB.
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)v040+ReviewStore(reviews / threads / comments; reviews filterable by session)gitreview.py(worktree enumeration, working-tree diffs, file-at-ref, path guard)reusing
compute_file_diff;routes/reviews.py—/api/review/*(repos/changed/diff/file) and/api/reviews/*CRUD (with?session=filter), with the comment→session injectgit changed-files, a line-anchored diff renderer with inline comment threads (reply/resolve); the
Files button is always available so a fresh session can attach a worktree
test_reviews.py— store (incl. session filter), git helpers (incl. traversal guard), routesBackend changes are additive (new tables/routes/config); the migration creates new tables only.