You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Composes with #1049 (contextual bottom panel umbrella). This issue ships the persistence layer + the codelens / inline-thread input surface for review comments. The bottom-panel surface where the queue is displayed and acted on is owned by #1049, which structures the panel as a contextual surface that morphs by active editor. The two view shapes for the queue (per-builder scoped in Code Review mode + cross-builder roll-up in Attention mode) live as two modes under #1049; this issue powers both. See "Where this fits in the contextual panel" below.
Follow-up to #789.#789 ships the inject-on-click codelens behavior in the unified diff editor (> Send to builder PTY injects path/file.ts:L42-L58 into the builder's prompt buffer, user types feedback inline, submits with Enter). This issue layers a structured review-comment mode on top: instead of typing in the PTY, the user composes a comment in an inline comment thread mounted at the line/hunk, the comment goes into a per-builder queue, and a Submit review action packages all queued comments and forwards them to the builder PTY as a single batched message. The PTY-injection model from #789 stays — this is a complementary surface, not a replacement.
Why this is a separate surface, not an extension of #789
The PTY-injection model is frictionless — click, the reference is there, you keep typing as you would have anyway. It works well for one-off reactions ("revert this", "rename to X").
The structured-comment model is sustained — there's a discrete "I am writing a review comment" moment that ends with submit. It works well for sentence-or-paragraph feedback over multiple hunks during a single review session, especially when you want to think about the whole diff before submitting.
Both coexist on the diff editor: the codelens shows exactly one entry per file/hunk header at a time — either the comment entry or the inject entry, controlled by an editor-level toggle (comment is the default). The right-click context menu on file/hunk headers always exposes both actions regardless of the codelens mode, so the non-default flow is always one menu away without flipping the editor mode.
The two surfaces never merge state.#789 clicks fire-and-forget into the PTY — they never enter the queue and never appear in the panel view below. #1037 clicks always enter the queue and are only "spent" via Submit Review. The user's mental model: "if I see it in the panel, I haven't submitted it yet; if I sent it via #789, it's already in the PTY history."
Behavior change for #789's existing flow. Today (post-#789 / pre-#1037), the > Send to builder PTY codelens is the only codelens on the diff and is shown unconditionally. After #1037 lands with codev.diffCodelensMode defaulting to "comment", the inject codelens is hidden by default — users who prefer the frictionless inject either toggle the diff editor to forward mode once (the preference persists per workspace) or use the right-click context menu which always exposes both actions. Cmd/Ctrl+K B (the existing #789 keyboard shortcut) continues to inject regardless of the codelens mode.
Proposed mechanic
Codelens entry on each file / hunk header: exactly one entry, matching the current diff codelens mode — > Comment for builder in comment mode (default), > Send to builder PTY in forward mode. An editor title-bar toggle button on the unified diff editor flips between the two modes; the choice persists per workspace as codev.diffCodelensMode: "comment" | "forward".
Right-click context menu on file/hunk headers always exposes both Codev: Comment for builder and Codev: Send to builder PTY regardless of the codelens mode.
Comment-mode click (codelens or context menu) mounts an inline comment thread at the line using VSCode's comments API (vscode.comments.createCommentController + CommentThread). Forward-mode click (codelens or context menu) injects the reference into the active builder's PTY per vscode: inject file/hunk reference into builder PTY from the unified-diff editor (codelens) #789's existing behavior.
User types in the thread input (VSCode's native input, supports markdown, multi-line, paragraph-length feedback).
Submit on the thread adds the comment to a per-builder pending-comments queue.
Submit review action (palette command + status-bar button + per-builder action in the panel view) packages all pending comments for the active builder into a single batched message and writes it to the builder PTY's prompt buffer. The user reviews the packaged message and presses Enter to send.
Queue clears after successful submit. Pending comments persist across VSCode restarts via worktree-local file (see persistence below).
Under #1049 the bottom panel is one contextual tab that morphs by active editor; this issue powers the queue's display in two of #1049's four modes:
Code Review mode (active when the user has the unified diff editor open for a builder) — the panel shows THAT builder's pending-comments queue scoped to just one builder. Per-comment actions (Edit / Delete) and a Submit Review button for this builder. Source: .builders/<builder-id>/.codev/pending-comments.json.
Attention mode (fallback when no specific context matches) — the panel shows the cross-builder roll-up of all pending queues. Builder roots → comment children, same tree shape this issue previously described as a standalone tab. Per-builder Submit Review and Discard All actions; per-comment Edit and Delete actions. Source: every .builders/*/.codev/pending-comments.json file aggregated.
The panel skeleton, mode resolver, header, pin behavior, and the switch between modes are owned by #1049. This issue owns:
The codelens / inline-thread input surface (composing comments).
The persistence (.builders/<builder-id>/.codev/pending-comments.json per builder).
The data each mode renders (sub-tree of the panel content).
The standalone tab description that previously lived here is dropped — #1049 supersedes it.
Empty states per mode:
Code Review mode with no comments queued for the active builder — calm "No pending comments for <builder-id>. Open a hunk's > Comment for builder codelens to add one." plus a link to switch to Attention mode to see all builders.
Cross-window — multiple VSCode windows on the same machine all read the same .builders/<id>/.codev/pending-comments.json. File-watcher-based sync gives each window a consistent view at OS-event latency. An in-process bus is cheaper but only syncs within one VSCode process. Plan-gate decision #7 below picks.
Plan-gate decisions to lock
These are the design calls that affect the v1 shape — the plan should pick each before coding starts.
Codelens surface (locked: single-mode + editor toggle + always-on context menu). The diff editor's codelens shows exactly one entry per file/hunk header — > Comment for builder in comment mode (default), > Send to builder PTY in forward mode. An editor title-bar toggle button on the unified diff editor flips between modes; the choice persists as codev.diffCodelensMode (default "comment"). The right-click context menu on file/hunk headers always shows BOTH actions regardless of mode. Remaining sub-decisions for the plan to lock: title-bar button shape (single icon with tooltip-displayed mode, or two icons toggling), icon choices for each mode, and whether to also surface the toggle as a setting in the Codev sidebar or rely solely on the per-editor title-bar button + workspace setting.
Submit format: when packaging queued comments into the single PTY message, what's the wire format? Options:
One message with per-comment markdown sections (### packages/foo.ts:L42-L58\n\n<body>\n\n### ...)
Multiple PTY writes, one per comment, separated by a blank line (the builder receives them as a sequence)
A JSON envelope that the builder unpacks (requires builder-side parsing logic)
Edit / delete of queued comments: can the user edit a queued comment before submit? Delete one? Re-order them? Plan-gate picks. Cheapest: read-only queue, "submit or delete all" is the only action. Most flexible: per-comment edit/delete/reorder UI in the thread. Likely lean: per-comment edit + delete, no reorder.
Multi-comment threads (replies): VSCode's comments API supports replies within a thread. For v1, do replies on a queued comment turn into edits, or do they accumulate as separate queued comments under the same hunk? Probably "edits" for v1 simplicity; replies-as-separate is a follow-up.
Comment thread persistence across reloads: VSCode's CommentController is recreated on extension reactivation. After a reload, do queued comments re-mount as visible threads on the diff (requires diff editor to be re-opened on the same builder) or stay invisible until the user opens the diff again? Lean: re-mount when the diff is re-opened for that builder.
Sync mechanism between the inline threads, the status-bar counter, and the panel view: file watcher on .builders/*/.codev/pending-comments.json (cross-window safe, but OS-event latency and edge cases on Windows / network filesystems), or an in-process event bus from the queue write path (cheap, but only syncs within one VSCode process — multi-window users see stale state until next refresh). Plan-gate picks; if file-watcher is chosen, decide debounce window.
Acceptance criteria
The unified diff editor's codelens on each file/hunk header shows exactly one entry, matching the current codev.diffCodelensMode: > Comment for builder in comment mode (default), > Send to builder PTY in forward mode.
An editor title-bar toggle button on the unified diff editor switches between the two modes. State persists per workspace as codev.diffCodelensMode: "comment" | "forward", default "comment".
The right-click context menu on file headers and hunk headers always exposes BOTH Codev: Comment for builder and Codev: Send to builder PTY regardless of the codelens mode.
Comment-mode click (codelens or context menu) mounts a VSCode CommentThread at the line/hunk via vscode.comments.createCommentController.
Comment input supports markdown (VSCode native), multi-line, and a Submit button.
On submit, the comment is added to .builders/<id>/.codev/pending-comments.json (per-builder queue) — file is created on first use, gitignored via .builders/.gitignore (or wherever the convention places it).
A Codev: Submit Review palette command exists and is bound to a status-bar button when the current builder has pending comments. The button shows Codev: Submit (N) where N is the pending count.
Per-builder queue isolation: pending comments for builder A do NOT mix with builder B's. Opening multiple builder diffs simultaneously keeps the queues separate.
afx cleanup --project <id> removes the worktree, which removes the pending-comments file as a side effect (no separate cleanup needed).
Window reload / VSCode restart preserves the queue. Re-opening the same builder's diff after a reload re-mounts the queued comments as visible threads.
Status-bar counter, inline threads, and BOTH panel mode renderings stay consistent: an add / edit / delete / submit from any one of the surfaces is reflected in the others within the sync window picked at plan-gate decision High-Risk Change Management - Need for Selective Manual Review #7.
Per-architect-session global queue. Queues are per-builder. Mixing comments across builders into a single submit is explicitly out of scope.
Submitting to GitHub PR review as well. This is builder-side feedback only. Forwarding to a GitHub PR review (which would imply unifying with the issue thread / PR comments surface) is a separate concept entirely.
Resolving / unresolving threads after submit. Once submitted, the thread is dismissed and the comment is gone from the queue. Threading for follow-up discussion within VSCode is out of scope — the discussion lives in the builder PTY.
Markdown rendering of queued comments in the thread UI. VSCode provides the input; how the queued state is visually represented in the diff (collapsed thread vs full thread vs status-bar count) is a polish layer that can land iteratively.
The Files-not-yet-reviewed checklist that lives in the same Code Review mode panel slot. Sibling issue (separate area/vscode filing); needs its own persistence and is composed alongside this issue's queue inside the Code Review mode's body.
Suggested protocol
PIR. The implementation is non-trivial (vscode.comments API integration, persistence layer, per-builder queue management, status-bar integration, bottom-panel tree view, three-way sync between inline threads / status-bar / panel), and the seven plan-gate decisions above are real design surface that benefits from a locked plan before coding. The dev-approval gate is load-bearing because the multi-builder queue-isolation behavior and the three-way sync are best verified by running the worktree against two real builders and walking through the interaction by hand.
vscode: add review comments from the markdown preview pane (hover-+ per block, no editor mode-switch) #859 — review comments from the markdown preview pane (canvas-powered). Different surface (preview vs diff editor), different mechanism (artifact-canvas vs vscode.comments API), but conceptually adjacent. Possible future work to unify the persistence layer if it becomes confusing for users to have two separate review queues.
Why this is a separate surface, not an extension of #789
The PTY-injection model is frictionless — click, the reference is there, you keep typing as you would have anyway. It works well for one-off reactions ("revert this", "rename to X").
The structured-comment model is sustained — there's a discrete "I am writing a review comment" moment that ends with submit. It works well for sentence-or-paragraph feedback over multiple hunks during a single review session, especially when you want to think about the whole diff before submitting.
Both coexist on the diff editor: the codelens shows exactly one entry per file/hunk header at a time — either the comment entry or the inject entry, controlled by an editor-level toggle (comment is the default). The right-click context menu on file/hunk headers always exposes both actions regardless of the codelens mode, so the non-default flow is always one menu away without flipping the editor mode.
The two surfaces never merge state. #789 clicks fire-and-forget into the PTY — they never enter the queue and never appear in the panel view below. #1037 clicks always enter the queue and are only "spent" via
Submit Review. The user's mental model: "if I see it in the panel, I haven't submitted it yet; if I sent it via #789, it's already in the PTY history."Behavior change for #789's existing flow. Today (post-#789 / pre-#1037), the
> Send to builder PTYcodelens is the only codelens on the diff and is shown unconditionally. After #1037 lands withcodev.diffCodelensModedefaulting to"comment", the inject codelens is hidden by default — users who prefer the frictionless inject either toggle the diff editor to forward mode once (the preference persists per workspace) or use the right-click context menu which always exposes both actions.Cmd/Ctrl+K B(the existing #789 keyboard shortcut) continues to inject regardless of the codelens mode.Proposed mechanic
> Comment for builderin comment mode (default),> Send to builder PTYin forward mode. An editor title-bar toggle button on the unified diff editor flips between the two modes; the choice persists per workspace ascodev.diffCodelensMode: "comment" | "forward".Codev: Comment for builderandCodev: Send to builder PTYregardless of the codelens mode.commentsAPI (vscode.comments.createCommentController+CommentThread). Forward-mode click (codelens or context menu) injects the reference into the active builder's PTY per vscode: inject file/hunk reference into builder PTY from the unified-diff editor (codelens) #789's existing behavior.Submit reviewaction (palette command + status-bar button + per-builder action in the panel view) packages all pending comments for the active builder into a single batched message and writes it to the builder PTY's prompt buffer. The user reviews the packaged message and presses Enter to send.Persistence: per-builder queue, worktree-local file
Each builder's pending review comments live in
.builders/<id>/.codev/pending-comments.json. Schema (plan-gate may adjust):{ "version": 1, "builderId": "pir-859", "comments": [ { "id": "uuid", "createdAt": "2026-06-13T10:00:00Z", "file": "packages/vscode/src/views/builders.ts", "lineRange": { "start": 42, "end": 58 }, "diffContext": "...optional anchor for verification on apply...", "body": "the early return here is wrong because Y; suggest Z" } ] }The file:
codev/state/<id>_thread.md).gitignoreso it doesn't ship with the branch (it's local review state, not committed work)afx cleanupremoves the worktreeWhere this fits in the contextual panel (#1049)
Under #1049 the bottom panel is one contextual tab that morphs by active editor; this issue powers the queue's display in two of #1049's four modes:
Submit Reviewbutton for this builder. Source:.builders/<builder-id>/.codev/pending-comments.json.Submit ReviewandDiscard Allactions; per-commentEditandDeleteactions. Source: every.builders/*/.codev/pending-comments.jsonfile aggregated.The panel skeleton, mode resolver, header, pin behavior, and the switch between modes are owned by #1049. This issue owns:
.builders/<builder-id>/.codev/pending-comments.jsonper builder).The standalone tab description that previously lived here is dropped — #1049 supersedes it.
Empty states per mode:
<builder-id>. Open a hunk's> Comment for buildercodelens to add one." plus a link to switch to Attention mode to see all builders.Cross-window — multiple VSCode windows on the same machine all read the same
.builders/<id>/.codev/pending-comments.json. File-watcher-based sync gives each window a consistent view at OS-event latency. An in-process bus is cheaper but only syncs within one VSCode process. Plan-gate decision #7 below picks.Plan-gate decisions to lock
These are the design calls that affect the v1 shape — the plan should pick each before coding starts.
> Comment for builderin comment mode (default),> Send to builder PTYin forward mode. An editor title-bar toggle button on the unified diff editor flips between modes; the choice persists ascodev.diffCodelensMode(default"comment"). The right-click context menu on file/hunk headers always shows BOTH actions regardless of mode. Remaining sub-decisions for the plan to lock: title-bar button shape (single icon with tooltip-displayed mode, or two icons toggling), icon choices for each mode, and whether to also surface the toggle as a setting in the Codev sidebar or rely solely on the per-editor title-bar button + workspace setting.### packages/foo.ts:L42-L58\n\n<body>\n\n### ...)terminal-manageropen-terminal flow (matches vscode: inject file/hunk reference into builder PTY from the unified-diff editor (codelens) #789's behavior), or fail with a status-bar message, or queue the submit until a terminal opens?CommentControlleris recreated on extension reactivation. After a reload, do queued comments re-mount as visible threads on the diff (requires diff editor to be re-opened on the same builder) or stay invisible until the user opens the diff again? Lean: re-mount when the diff is re-opened for that builder..builders/*/.codev/pending-comments.json(cross-window safe, but OS-event latency and edge cases on Windows / network filesystems), or an in-process event bus from the queue write path (cheap, but only syncs within one VSCode process — multi-window users see stale state until next refresh). Plan-gate picks; if file-watcher is chosen, decide debounce window.Acceptance criteria
codev.diffCodelensMode:> Comment for builderin comment mode (default),> Send to builder PTYin forward mode.codev.diffCodelensMode: "comment" | "forward", default"comment".Codev: Comment for builderandCodev: Send to builder PTYregardless of the codelens mode.CommentThreadat the line/hunk viavscode.comments.createCommentController..builders/<id>/.codev/pending-comments.json(per-builder queue) — file is created on first use, gitignored via.builders/.gitignore(or wherever the convention places it).Codev: Submit Reviewpalette command exists and is bound to a status-bar button when the current builder has pending comments. The button showsCodev: Submit (N)where N is the pending count.afx cleanup --project <id>removes the worktree, which removes the pending-comments file as a side effect (no separate cleanup needed).Edit(opens inline thread),Delete(with confirm). Per-mode actions:Submit Reviewfor this builder.Submit Review,Discard All(with confirm). Per-comment actions:Edit,Delete.CommentThread.PanelModeContributorinterfaces (or whatever extension point vscode: contextual bottom panel that adapts to active editor (mode resolver + Attention fallback) #1049 settles on at its plan-gate); this issue's PR ships the contributors but the panel skeleton itself comes from vscode: contextual bottom panel that adapts to active editor (mode resolver + Attention fallback) #1049's PR.Out of scope
area/vscodefiling); needs its own persistence and is composed alongside this issue's queue inside the Code Review mode's body.Suggested protocol
PIR. The implementation is non-trivial (vscode.comments API integration, persistence layer, per-builder queue management, status-bar integration, bottom-panel tree view, three-way sync between inline threads / status-bar / panel), and the seven plan-gate decisions above are real design surface that benefits from a locked plan before coding. The dev-approval gate is load-bearing because the multi-builder queue-isolation behavior and the three-way sync are best verified by running the worktree against two real builders and walking through the interaction by hand.
Related