Skip to content

Conversation

@forketyfork
Copy link
Owner

@forketyfork forketyfork commented Feb 7, 2026

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.

  • Click-to-comment: click any diff line to open an inline editing box; submit with Enter, cancel with Escape
  • Persistence: comments saved to .architect/diff_comments.json relative to the repo root, surviving overlay close/reopen
  • Send to agent: green button in the title bar detects whether an agent is running in the focused terminal; pastes directly if a process is active, otherwise shows a dropdown to start claude/codex/gemini
  • Delete button: each saved comment has an "x" button on the right side to delete it directly without opening the editor
  • Animated transitions: comment editor smoothly expands/collapses on open/cancel (200ms/150ms), submitting morphs the editor into the saved comment with height/color interpolation (300ms), and a warm amber glow confirms the save (500ms)
  • Rendering fixes: rewrote fillRoundedRect and drawRoundedBorder in primitives.zig to eliminate overdraw artifacts with semi-transparent colors
  • Hand cursor: mouse cursor changes to pointer when hovering commentable diff lines, file headers, comment boxes, delete buttons, and send button

Changed files

File Changes
src/ui/components/diff_overlay.zig Comment model, click handling, text input, inline rendering, persistence, send button, dropdown, delete button, animations
src/ui/types.zig session_status on SessionUiInfo, SendDiffComments action variant
src/app/ui_host.zig Wire session status and views into makeUiHost
src/app/runtime.zig Handle SendDiffComments action with optional delayed send
src/gfx/primitives.zig Rewritten fillRoundedRect and drawRoundedBorder
src/anim/easing.zig Added easeOutCubic easing function
src/c.zig Exported SDL_GetRenderClipRect
README.md Added feature to list
docs/architecture.md Updated DiffOverlayComponent description

Test plan

  • Open diff overlay (Cmd+D) in a git repo with changes
  • Click a diff line — inline comment editor expands smoothly from the line
  • Type text, press Enter — editor morphs into the saved comment (height shrinks, colors transition green to amber, text crossfades), then a warm amber glow confirms the save
  • Press Escape or click Cancel — editor collapses smoothly
  • Click existing saved comment — opens for editing with expand animation
  • Hover the "x" button on a saved comment — cursor changes to pointer, button highlights
  • Click the "x" button — comment is deleted and content shifts up
  • Close and reopen diff overlay — saved comments are restored from .architect/diff_comments.json
  • "Send to agent" button appears when unsent comments exist
  • With agent running: click sends formatted file:line: text to terminal and closes overlay
  • Without agent: dropdown appears; selecting an agent starts it and sends comments after delay
  • Verify hand cursor on commentable lines, buttons, comment boxes, and delete buttons
  • Verify rounded rect buttons render cleanly without corner artifacts

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.
@forketyfork forketyfork requested a review from Copilot February 7, 2026 08:20
Copy link

Copilot AI left a 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 UiAction into 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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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.
@forketyfork forketyfork merged commit 765ab9f into main Feb 8, 2026
4 checks passed
@forketyfork forketyfork deleted the feat/diff-review-comments branch February 8, 2026 09:30
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