-
Notifications
You must be signed in to change notification settings - Fork 2
Add inline review comments to diff overlay #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Issue: Users need a way to annotate diff lines with review comments and send them to AI coding agents running in Architect terminals, enabling a code-review-like workflow. Solution: Added click-to-comment on any diff line in the ⌘D overlay with inline editing boxes that push content down. Comments persist in `.architect/diff_comments.json` per repo and survive close/reopen. A green "Send to agent" button detects whether an agent is running via foreground process detection — pasting directly if so, or showing a dropdown to start claude/codex/gemini first. Also rewrote fillRoundedRect and drawRoundedBorder in primitives.zig to eliminate overdraw artifacts with semi-transparent colors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds an inline diff commenting workflow to the ⌘D diff overlay, including persistence and the ability to send collected comments to an agent via the focused terminal.
Changes:
- Introduces inline comment UI (edit/submit/cancel), hover cursor updates, and persistence to
.architect/diff_comments.json. - Adds a “Send to agent” flow (direct paste or agent-start dropdown) wired through
UiActioninto runtime with optional delayed send. - Updates rounded-rect rendering primitives to reduce semi-transparent overdraw artifacts.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ui/types.zig | Adds session status to UI info and a new SendDiffComments UI action payload. |
| src/ui/components/diff_overlay.zig | Implements inline comment creation/editing, persistence, “send to agent” UI, and cursor behavior. |
| src/gfx/primitives.zig | Reworks rounded-rect fill/border algorithms to reduce artifacts. |
| src/app/ui_host.zig | Plumbs session view status into SessionUiInfo. |
| src/app/runtime.zig | Handles SendDiffComments action and delayed comment sending after starting an agent. |
| docs/architecture.md | Documents the new diff overlay inline comment flow and agent dispatch. |
| README.md | Adds the feature to the public feature list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 758ce80514
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fixes rendering performance, correctness, and robustness issues identified in code review for the inline review comments feature. - Compute y_pos incrementally in render loop instead of O(n) per row - Render comment boxes for above-viewport rows before skipping - Extract renderRowComments helper for reuse - Free previous pending_comment_send before overwriting - Escape control chars < 0x20 as \u00XX in JSON persistence - Set text cursor when hovering over editing comment input area - Document heap ownership on SendDiffCommentsAction fields - Don't persist sent state to file so comments survive delivery failure
Add fluid animations for the comment editor lifecycle: smooth expand on open (200ms easeOutCubic), collapse on cancel (150ms easeInOutCubic), morph transition on submit with height/color interpolation (300ms), and a warm amber glow confirming the save (500ms). Add a delete button (x) on each saved comment for direct removal without opening the editor.
Instead of always waiting the full 2-second delay before pasting diff comments into an agent session, scan the terminal screen for known agent prompt characters (> for Gemini, ❯ for Claude, › for Codex). Comments are sent as soon as a prompt is detected, with the timeout kept as a fallback.
Previously, key repeat events (e.g. Escape) during the close animation leaked through to the terminal because the closing state only intercepted Cmd+D. Now all input events are consumed while the overlay animates out.
Scanning all visible rows caused false positives when previous agent output was still on screen. Now only the cursor's current row is checked, since the agent prompt always appears at the cursor position. Also fixes lint warnings by replacing forced optional unwraps with safe if-unwrap patterns in the comment editor.
Two issues caused Escape to reach the terminal during a hold gesture: repeat KEY_DOWN events were not consumed while holding, and the KEY_UP was sent after the flash animation reset the consumed state. Now all Escape events are consumed while the gesture is active, and the gesture stays alive until key release so the consumed flag is preserved.
…tion Move the canHandleEscapePress guard to only block KEY_DOWN (starting new gestures), not KEY_UP (cleanup). Previously, after a successful grid transition, canHandleEscapePress returned false for Grid mode, blocking the KEY_UP handler entirely and leaving the gesture active with the indicator stuck on screen. Also restrict KEY_UP handling to only run when a gesture is active to avoid spurious stop calls.
Terminal cell reading is unreliable for TUI agents like Claude Code that use Ink/React framework — prompt characters like ❯ store as codepoint 0x0000 in terminal cells despite being visually rendered. Switch to hasForegroundProcess() which reliably detects when the agent process has started, regardless of how it renders its UI.
Add ADR-013 documenting the pragmatic exception for synchronous I/O in UI overlays (git commands and small-file persistence). Update module boundary table to reflect new dependencies (ui/session_view_state in app layer, easeOutCubic in shared utilities), add diff_comments.json to the storage table, and note inline review comments in the diff viewer component description.
Summary
Adds inline review comments to the diff overlay (Cmd+D), enabling a code-review workflow where users annotate diff lines and dispatch comments to AI agents.
.architect/diff_comments.jsonrelative to the repo root, surviving overlay close/reopenfillRoundedRectanddrawRoundedBorderinprimitives.zigto eliminate overdraw artifacts with semi-transparent colorsChanged files
src/ui/components/diff_overlay.zigsrc/ui/types.zigsession_statusonSessionUiInfo,SendDiffCommentsaction variantsrc/app/ui_host.zigmakeUiHostsrc/app/runtime.zigSendDiffCommentsaction with optional delayed sendsrc/gfx/primitives.zigfillRoundedRectanddrawRoundedBordersrc/anim/easing.zigeaseOutCubiceasing functionsrc/c.zigSDL_GetRenderClipRectREADME.mddocs/architecture.mdDiffOverlayComponentdescriptionTest plan
.architect/diff_comments.jsonfile:line: textto terminal and closes overlay