Repository navigation
Chat with the agent about a review, beside the diff - #210
Closed
NikhilVerma wants to merge 1 commit into
Closed
NikhilVerma wants to merge 1 commit into
NikhilVerma wants to merge 1 commit into
Conversation
Asking the agent about a note used to put a one-off reply under that note. Now each review has one conversation in a pane beside the diff. A question typed there, or asked from a note, joins it, and the agent sees the earlier turns and the walkthrough stop on screen. Codiff keeps the turns in memory and sends them again with each question, so agent runs stay stateless. Replies stream in, and their links to files open the walkthrough stop, the diff or the editor. Chat turns may read the repository but never write to it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
NikhilVerma
marked this pull request as ready for review
December 4, 2026 12:08
Member
|
This is awesome, very nice work. But to be honest, I wanna kind of go the other direction - rip out AI besides the walkthroughs from Codiff and simplify. It's still best to ask directly in the chat with the context, instead of a new one each time. I'm going to close this for now as I don't think this is the direction I want to take Codiff in, but I will consider it. It's open source, so feel free to maintain your own fork! |
Contributor
Author
|
Thank you! yes I totally get it. This change was inspired by the need to review a lot of PRs (because of agents doing all the production). So I needed a way to quickly chat with lots of prs without needing to check out their branches. I'll keep it as a fork for now! 👍 |
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.
What this does
Today you can ask the agent about a line by writing a note and pressing Ask. The answer appears under that one note, and the agent remembers nothing from one note to the next.
This PR turns that into one chat per review, in a pane beside the diff. You can type a question there, or press Ask on a note as before. Either way the question joins the same conversation, the reply streams in, and the agent sees your earlier questions and the walkthrough stop you are reading.
Replies link to code. Clicking a link to a changed file takes you to its walkthrough stop or to the file in the diff. A link to any other file opens it in your editor.
codiff-review-chat.mp4
How it works
The principle is that Codiff owns the conversation, not the agent CLI. Agent runs stay stateless, as they are for walkthroughs, and Codiff sends the earlier turns again with each question. That keeps the chat out of each CLI's own saved history, and it works the same way for every backend.
A chat store (
core/app/hooks/useReviewChat.ts) keeps the turns in memory, one conversation per repository and review source. Nothing is written to disk. The store lives outside React state, so a streaming reply redraws the pane and not the diff.Each request carries the question, the finished turns, the code it points at, and the walkthrough stop on screen.
electron/review-chat.cjs(renamed fromreview-assist.cjs) builds the prompt. For a question on a line it marks the exact lines with>and adds six lines of context each side, so "this" means the right code.Streaming reuses the
onPartialTextoption Pi already had. Codex, Claude Code and OpenCode now call it too. The reply is still one JSON object, soreadPartialReplyreads the growingreplystring out of the cut-off JSON. The main process sends the text so far to the window with the turn's id.The pane (
core/app/components/ReviewChatPane.tsx) renders replies with the existingReadOnlyMarkdownView, and resizes with the existinguseResizableSidebar.File links are handled in
core/lib/review-chat-links.ts. The Markdown view only keeps web addresses as link targets. So before a reply is drawn, each link to a repository file is rewritten to an address on the reserved.invaliddomain, and a click reads it back. A file link then can't be opened as a web page.The inline reply under a note is removed, so there is one way to ask.
Reading beyond the diff
Before this change the chat prompt told the agent to use only the diff. Now a chat turn may read and search the repository, and never write.
Read,GrepandGlob. No allow rule is added, so indontAskmode it reads inside the repository and refuses paths outside it. I checked this with theclaudecommand: a repository file was read, and/etc/hostswas refused.read,grep,globandlistafter its deny-all rule.Testing
vp checkpasses andvp test runpasses (1466 tests).Known limits
AI assistance
This PR was written primarily with Claude Code, including the code, the tests and this description. I directed the design and tested it in the app.
banana banana banana
🤖 Generated with Claude Code