Skip to content

fix(agent-manager): stabilize PR review comments - #13272

Merged
marius-kilocode merged 6 commits into
mainfrom
fix-long-code-references-in-pr-comments
Aug 21, 2026
Merged

fix(agent-manager): stabilize PR review comments#13272
marius-kilocode merged 6 commits into
mainfrom
fix-long-code-references-in-pr-comments

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

The Agent Manager PR review panel did not provide enough context for comments that refer to code below the commented line, and periodic PR refreshes could close open comments, reset scroll, or unmount the panel when GitHub returned a transient empty result.

This change keeps a compact GitHub-style hunk window, then appends verified lines from the active worktree when the hunk ends at the comment. It keeps the agent payload wider than the card while preserving valid unified-diff metadata. The panel now stores comment expansion, resolved-group, send, error, and scroll state per managed worktree, and stable thread IDs keep cards bound to their own threads through regrouping.

Transient empty PR lookups no longer replace a known PR on the same branch. Comment fetch failures retain the last visible comment list, while branch changes still clear stale PR state. Regression coverage covers real file context reads, mtime invalidation, hunk parsing, remount state retention, regrouping, polling, and the bridge cache behavior.

Before/after

The before comparison supplied for this work showed the old panel rendering the whole hunk, showing collapsed unmodified-line rows, and omitting the code the comment referred to. The after image is the reproducible Agent Manager PR comment Storybook state from this branch: the card uses a compact diff window, continues with trailing context, and keeps the comment actions visible.

After: compact PR comment with trailing context and stable actions

@marius-kilocode
marius-kilocode force-pushed the fix-long-code-references-in-pr-comments branch from 1cf7c05 to a9e9570 Compare August 20, 2026 11:22
@kilo-code-bot

kilo-code-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/pr-panel-comments-200-chromium-linux.png
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/pr-panel-comments-chromium-linux.png
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/pr/am-pr-utils.ts
  • packages/kilo-vscode/src/agent-manager/types.ts
Previous Review Summaries (2 snapshots, latest commit 58c6d68)

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

Previous review (commit 58c6d68)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (7 files)
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/pr-panel-comments-200-chromium-linux.png
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/pr-panel-comments-chromium-linux.png
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts
  • packages/kilo-vscode/src/agent-manager/pr/pr-comment-context.ts
  • packages/kilo-vscode/tests/unit/pr-comment-context.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRPanel.tsx

Previous review (commit e56a7a9)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts 208 Keeping a known PR on empty lookup can hide a later real no-PR after a branch switch because the poller hashes :none before the bridge swallows it
packages/kilo-vscode/src/agent-manager/pr/pr-comment-context.ts 35 Review-comment paths are joined onto the worktree without a containment check

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/pr/PRPanel.tsx 105 next?.total treats a successful empty comment list as missing
Files Reviewed (21 files)
  • .changeset/pr-comments-github-style.md - 0 issues
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/pr-panel-comments-200-chromium-linux.png - 0 issues
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/pr-panel-comments-chromium-linux.png - 0 issues
  • packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts - 0 issues
  • packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/pr/am-pr-utils.ts - 0 issues
  • packages/kilo-vscode/src/agent-manager/pr/pr-comment-context.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/types.ts - 0 issues
  • packages/kilo-vscode/tests/fixtures/pr-comments-render.tsx - 0 issues
  • packages/kilo-vscode/tests/unit/am-pr-status-bridge.test.ts - 0 issues
  • packages/kilo-vscode/tests/unit/pr-comment-context.test.ts - 0 issues
  • packages/kilo-vscode/tests/unit/pr-status-merge.test.ts - 0 issues
  • packages/kilo-vscode/tests/unit/review-comments-pr.test.ts - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRCommentCard.tsx - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRComments.tsx - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/PRPanel.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-comment-payload.ts - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-comment-state.ts - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-panel.css - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-types.ts - 0 issues
  • packages/kilo-vscode/webview-ui/diff-viewer/PRCommentDiff.tsx - 0 issues
  • packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx - 0 issues

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 304.6K · Output: 19.1K · Cached: 272.8K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode force-pushed the fix-long-code-references-in-pr-comments branch from e56a7a9 to 3f770e6 Compare August 20, 2026 12:23
@marius-kilocode
marius-kilocode force-pushed the fix-long-code-references-in-pr-comments branch from c7c19c0 to 58c6d68 Compare August 20, 2026 12:31
@marius-kilocode
marius-kilocode merged commit 4fd330f into main Aug 21, 2026
25 checks passed
@marius-kilocode
marius-kilocode deleted the fix-long-code-references-in-pr-comments branch August 21, 2026 08:39
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