Skip to content

fix: make snapshot diffs resilient on Windows - #12583

Merged
marius-kilocode merged 2 commits into
Kilo-Org:mainfrom
noobezlol:agent/fix-windows-snapshot-diffs
Jul 28, 2026
Merged

fix: make snapshot diffs resilient on Windows#12583
marius-kilocode merged 2 commits into
Kilo-Org:mainfrom
noobezlol:agent/fix-windows-snapshot-diffs

Conversation

@noobezlol

Copy link
Copy Markdown
Contributor

Issue

Fixes #12474

Context

Snapshot generation requested effectively unlimited unified-diff context. On Windows, Git can emit malformed persisted patches for multi-hunk changes. The VS Code session diff source also allowed one parser exception to abort the complete diff response, leaving the Changes panel at 0 files changed even when other file patches were valid.

Implementation

  • Generate snapshot patches with bounded --unified=3 context.
  • Isolate patch parsing per file so one malformed persisted patch cannot hide valid files.
  • Preserve malformed text patches as summarized entries rather than discarding them.
  • Add regression coverage for distant bounded hunks and mixed malformed/valid session patches.
  • Add patch changesets for the CLI and VS Code extension.

Screenshots / Video

N/A — this changes snapshot generation and error recovery behavior without changing the UI layout.

How to Test

Manual/local verification

  • CLI snapshot regression suite: 9 passed.
  • VS Code session diff source suite: 13 passed.
  • CLI and VS Code typechecks passed.
  • Repository lint, formatting, Knip, annotations, changeset validation, and git diff --check passed.
  • The pre-push monorepo typecheck passed for all 22 non-JetBrains packages.

Reviewer test steps

  1. On Windows, create a session that modifies multiple files with distant hunks.
  2. Open the Changes panel and confirm all generated snapshot patches render.
  3. Replace one persisted file patch with malformed unified-diff text.
  4. Confirm other files remain visible and the malformed file is retained as a summarized entry.

Blocked checks and substitute verification

  • The JetBrains-only pre-push typecheck could not configure Gradle because the local /usr/lib/jvm/java-25-openjdk installation does not provide JAVA_COMPILER. This PR does not touch JetBrains code; the affected CLI and VS Code typechecks and targeted regression suites passed.
  • The full VS Code unit suite completed with 3,292 passing and 9 unrelated environment-sensitive failures. The changed session-diff source suite passes independently.

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

Get in Touch

GitHub: @noobezlol

@noobezlol
noobezlol marked this pull request as ready for review July 28, 2026 10:51
@kilo-code-bot

kilo-code-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • .changeset/safe-windows-snapshot-diffs.md
  • packages/kilo-vscode/src/diff/sources/session.ts
  • packages/kilo-vscode/tests/unit/diff-session-source.test.ts
  • packages/opencode/src/kilocode/snapshot/diff-full.ts
  • packages/opencode/test/kilocode/diff-full.test.ts

Reviewed by claude-sonnet-5 · Input: 32 · Output: 8.7K · Cached: 792.9K

Review guidance: REVIEW.md from base branch main

@marius-kilocode marius-kilocode left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fix! Verified end to end: new snapshots persist bounded hunks, and with a deliberately corrupted patch in session_diff storage the Changes panel keeps the file listed with its stats as a summarized entry instead of emptying to 0 files changed. Both layers do exactly what the description says. Nice work.

@marius-kilocode
marius-kilocode merged commit 1310c12 into Kilo-Org:main Jul 28, 2026
30 checks passed
@noobezlol

Copy link
Copy Markdown
Contributor Author

Hi! I'm noobezlol. I have 3 merged PRs and 6 open PRs. I think I qualify for the Contributor role, but I only see the inactive #kilo-dev-contributors channel. Is there another contributor channel or someone who can grant access? Thanks!

t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
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.

Changes panel shows 0 files for malformed snapshot diffs on Windows

2 participants