Skip to content

fix(vscode): preserve inline review drafts across diff refreshes#10846

Merged
marius-kilocode merged 2 commits into
mainfrom
rune-airship
Jun 3, 2026
Merged

fix(vscode): preserve inline review drafts across diff refreshes#10846
marius-kilocode merged 2 commits into
mainfrom
rune-airship

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Inline review comments could disappear while they were still being written because diff refreshes replace disposable annotation DOM nodes. The same loss could happen when moving between Agent Manager sidebar and fullscreen review surfaces.

Preserve unfinished drafts and edits in lightweight in-memory composer metadata outside the textarea DOM. Diff renderers restore that metadata whenever annotations are rebuilt, Agent Manager review surfaces share the active composer during view transitions, and context changes clear transient state so drafts cannot leak between worktrees. Typing remains non-reactive, avoiding diff rerenders on every keystroke.

@marius-kilocode marius-kilocode enabled auto-merge June 3, 2026 09:21
@kilo-code-bot

kilo-code-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The implementation is clean and correct. Key design observations:

  • trackText attaches a fresh "input" listener to each new textarea DOM node. Since Pierre discards the old textarea element, the old listener and its closure are eligible for GC along with the discarded node — no accumulation.
  • dispatchEvent(new Event("input", { bubbles: true })) in speech insertion correctly ensures speech-inserted text propagates through the trackText listener to update meta.text.
  • annotationsForFile side-effects (writing back to composer().draft/composer().edit) are intentional and consistent — the function is called during render and uses the stable draftMeta/editMeta refs as the source of truth.
  • Context change clears are layered defensively: AgentManagerContent clears via selection change, and DiffPanel/FullScreenDiffView clear via sessionKey change. The double-clear when both fire is harmless.
  • Tests exercise real buildFileAnnotations and ReviewComposer behaviour without mocking.
Files Reviewed (6 files)
  • .changeset/steady-review-drafts.md
  • packages/kilo-vscode/tests/unit/review-comments.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/DiffPanel.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/FullScreenDiffView.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/review-annotation-speech.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/review-annotations.ts

Reviewed by claude-4.6-sonnet-20260217 · 666,067 tokens

Review guidance: REVIEW.md from base branch main

@imanolmzd-svg

Copy link
Copy Markdown
Contributor

Does this change cover the diff view that opens from sidebar chat as well?

@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

The core fix applies to the sidebar-chat Changes view as well

@marius-kilocode marius-kilocode merged commit 66f053a into main Jun 3, 2026
19 of 21 checks passed
@marius-kilocode marius-kilocode deleted the rune-airship branch June 3, 2026 10:59
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