Skip to content

feat(vs-code): Agent Manager - Code diff hunks to add context to comments in the PR view panel - #13071

Merged
cosi-conda merged 34 commits into
mainfrom
feature/pr-actions-diff-hunk
Aug 12, 2026
Merged

feat(vs-code): Agent Manager - Code diff hunks to add context to comments in the PR view panel#13071
cosi-conda merged 34 commits into
mainfrom
feature/pr-actions-diff-hunk

Conversation

@cosi-conda

@cosi-conda cosi-conda commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Issue

In VS Code Agent Manager:

  • Add code diff hunks to add context to comments in the PR view panel
  • Add resolve conversation / unresolve conversation actions to the PR comments
  • Add "Jump to comments" functionality to the top
  • Add floating button to scroll to the top for lengthy PRs

Implementation

  • PR status poller polls every 15 seconds
  • Pull diffHunk from PR status poller
  • Implement resolve/unresolve comment gh actions
  • Show error message when resolving fails: "Failed to resolve thread." / "Failed to unresolve thread."
  • Added new components to render diff hunk with comments called DiffHunk and CommentCard
  • Added scroll detection to PR panel
  • Match diff colors with code diff (layer) panel
  • Resolved comments have lower opacity than unresolved comments
  • Added changeset md

Follow-up Tasks

  • Restart workflows
  • Approve PR
  • Merge PR
  • Auto-resolve comments

Screenshots / Video

Before:
image

After:
Screenshot 2026-08-11 at 9 58 05 AM
Screenshot 2026-08-11 at 10 02 57 AM

Validating state updates:

comments.mov

Show comments as green if all are resolved suggestions:
image

Various themes:

Screen.Recording.2026-08-11.at.10.35.41.AM.mov

How to Test

Manual/local verification

  1. bun run extension
  2. Open Agent Manager
  3. Ensure you have gh auth via gh auth login
  4. Create a worktree if none exist, and import a PR
  5. Click "Open" on import, or click on an existing worktree to see the associate PR button on the right-hand-side, which opens the panel in the screenshot.
  6. Scroll to the bottom to view code diff with comments.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

@cosi-conda cosi-conda changed the title Feature/pr actions diff hunk feat(vs-code): Agent Manager - Code diff hunks to add context to comments in the PR view panel Aug 11, 2026
@cosi-conda
cosi-conda marked this pull request as ready for review August 11, 2026 20:53
Comment thread packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts
Comment thread packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx
Comment thread packages/kilo-vscode/webview-ui/agent-manager/pr/PRSummary.tsx Outdated
Comment thread packages/kilo-vscode/src/agent-manager/pr/PRActions.ts
@kilo-code-bot

kilo-code-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 4 Issues Found | Recommendation: Address before merge

Incremental review of changes since the previous review (328dbd37d2ba0a; the branch also merged latest main). The new commits resolve the previous pr-panel.css WARNING (all: unset now re-adds cursor: pointer and a :focus-visible outline). The comment resolve/unresolve flow was reworked from optimistic state to a pending + spinner model, which introduces one new race and one new type-safety cast; the poller now reads GraphQL totalCount, introducing a count-consistency edge case.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 83 Immediate refreshPR races the async resolve/unresolve mutation — the refresh fetch usually returns stale thread state, so the loading spinner persists until the next 15s poll; trigger poller.refresh() from the bridge's mutation success callback instead

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 86 New unnecessary as never cast on the refreshPR message (type already exists in the union; same message is posted without a cast in AgentManagerApp.tsx)
packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts 529 total uses totalCount (all threads) while unresolved counts only the first 100 fetched threads — counts can disagree on PRs with >100 review threads
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 81 as never bypasses type checking on the resolve/unresolve message (carried forward, verified still present)

Fix these issues in Kilo Cloud

Files Reviewed (4 files)
  • packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx - 3 issues (2 new, 1 carried forward)
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRSummary.tsx - previous suggestion verified resolved
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-panel.css - previous WARNING verified resolved
Previous Review Summaries (4 snapshots, latest commit 7d2ba0a)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 7d2ba0a)

Status: 4 Issues Found | Recommendation: Address before merge

Incremental review of changes since the previous review (328dbd37d2ba0a; the branch also merged latest main). The new commits resolve the previous pr-panel.css WARNING (all: unset now re-adds cursor: pointer and a :focus-visible outline). The comment resolve/unresolve flow was reworked from optimistic state to a pending + spinner model, which introduces one new race and one new type-safety cast; the poller now reads GraphQL totalCount, introducing a count-consistency edge case.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 83 Immediate refreshPR races the async resolve/unresolve mutation — the refresh fetch usually returns stale thread state, so the loading spinner persists until the next 15s poll; trigger poller.refresh() from the bridge's mutation success callback instead

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 86 New unnecessary as never cast on the refreshPR message (type already exists in the union; same message is posted without a cast in AgentManagerApp.tsx)
packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts 529 total uses totalCount (all threads) while unresolved counts only the first 100 fetched threads — counts can disagree on PRs with >100 review threads
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 81 as never bypasses type checking on the resolve/unresolve message (carried forward, verified still present)

Fix these issues in Kilo Cloud

Files Reviewed (4 files)
  • packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx - 3 issues (2 new, 1 carried forward)
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRSummary.tsx - previous suggestion verified resolved
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-panel.css - previous WARNING verified resolved

Previous review (commit 328dbd3)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of changes since the previous review (3746ae5328dbd3). The new commits resolve two previous suggestions: the changeset was added (.changeset/pr-comment-actions.md) and the clickable summary row is now a keyboard-accessible <button>. The as AgentManagerOutMessage cast removals in pr-status-bridge.ts were verified type-safe against CommentActionResultMessage. One new issue found in the button reset CSS; one previous suggestion (as never in PRComments.tsx) is verified still present at HEAD.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/pr-panel.css 569 all: unset on the new summary-row button removes the UA focus ring with no :focus-visible replacement (keyboard focus invisible), and its higher specificity overrides cursor: pointer from .am-pr-summary-row-link

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 81 as never bypasses type checking on the resolve/unresolve message (carried forward, verified still present)

Fix these issues in Kilo Cloud

Files Reviewed (4 files)
  • .changeset/pr-comment-actions.md - resolves previous changeset suggestion
  • packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts - cast removals verified type-safe; previous WARNING remains resolved
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRSummary.tsx - clickable div is now a button; previous a11y suggestion resolved
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-panel.css - 1 issue

Previous review (commit 3746ae5)

Status: No Issues Found | Recommendation: Merge

Incremental review of changes since the previous review (9fde6823746ae5). The previous WARNING on pr-status-bridge.ts is resolved: the missing-cwd path now posts a success: false result, so the webview reverts its optimistic resolved state and shows "Failed to resolve thread." / "Failed to unresolve thread." instead of silently staying stuck. Verified end-to-end against the CommentActionResultMessage type and the webview handler in PRComments.tsx. No new issues in the changed code.

Files Reviewed (1 file)
  • packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts - previous WARNING fixed; no new issues

Previous review (commit 9fde682)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts 96 Missing-cwd path returns without posting a failure result, leaving the webview's optimistic resolved state stuck with no error shown

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx 81 as never cast on postMessage bypasses type checking; the message already matches CommentActionMessage
packages/kilo-vscode/webview-ui/agent-manager/pr/PRSummary.tsx 69 "Jump to comments" is a clickable <div> with no keyboard/screen-reader access; SectionHeading uses a <button>
packages/kilo-vscode/src/agent-manager/pr/PRActions.ts 1 PR-level: user-facing feature with no .changeset entry
Files Reviewed (16 files)
  • packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts - GraphQL query gains id/diffHunk; no issues
  • packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/pr/PRActions.ts - 1 issue (PR-level changeset note); mutations use argv-based execFile (no shell injection), errors wrapped cleanly
  • packages/kilo-vscode/src/agent-manager/pr/am-pr-types.ts - moved + extended; no issues
  • packages/kilo-vscode/src/agent-manager/pr/am-pr-utils.ts - threadId/diffHunk parsing; no issues
  • packages/kilo-vscode/src/agent-manager/pr/pr-constants.ts - no issues
  • packages/kilo-vscode/src/agent-manager/types.ts - message type consolidation; no issues
  • packages/kilo-vscode/tests/unit/am-pr-status-bridge.test.ts - reasonable routing tests (gh layer mocked at module boundary)
  • packages/kilo-vscode/tests/unit/am-pr-utils.test.ts - updated imports + new parse cases; no issues
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx - reactive PRPanel props preserve scroll on poll updates; refresh-on-open is correct
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx - 1 issue; window message listeners are cleaned up in onCleanup (no leak)
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRPanel.tsx - scroll-to-top + jump-to-comments; no issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRSummary.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-panel.css - colors match the diff panel variables; no issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-types.ts - no issues
  • packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts - no issues

No memory leaks found: the per-comment window message listeners are removed via onCleanup, and no new long-lived subscriptions are introduced. The markdown/documentation image-format rule is not applicable (no .md files changed).

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 66.2K · Output: 4.3K · Cached: 237.3K

Review guidance: REVIEW.md from base branch main

@cosi-conda
cosi-conda marked this pull request as draft August 11, 2026 21:27
Comment thread packages/kilo-vscode/webview-ui/agent-manager/pr/pr-panel.css
@cosi-conda
cosi-conda marked this pull request as ready for review August 12, 2026 15:39
Comment thread packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx Outdated
Comment thread packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx Outdated
const threads = pr?.reviewThreads
const comments = parseComments((threads?.nodes ?? []) as GhThread[])
const totalCount = threads?.totalCount ?? comments.length
return { total: totalCount, unresolved: comments.filter((c) => !c.resolved).length, comments }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SUGGESTION]: total (from totalCount) and unresolved (from first 100 nodes) can disagree

totalCount counts all review threads, but unresolved is still computed only from the first 100 fetched nodes. On a PR with >100 threads the summary could show e.g. "103 comments" with a success status while unresolved threads exist beyond the first page (and comments passed to the webview is also capped at 100). Probably rare in practice, but worth either paginating (reviewThreads cursor) or clamping/annotating the cap so the counts stay consistent.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having over 100 threads seems very unlikely on a human reviewed PR

@cosi-conda
cosi-conda merged commit 7f92ecb into main Aug 12, 2026
24 checks passed
@cosi-conda
cosi-conda deleted the feature/pr-actions-diff-hunk branch August 12, 2026 16:37
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…ff-hunk

feat(vs-code): Agent Manager - Code diff hunks to add context to comments in the PR view panel
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.

2 participants