fix(jetbrains): improve session diff rendering - #12862
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of
The Files Reviewed (9 files)
Previous Review Summaries (5 snapshots, latest commit 450b8a2)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 450b8a2)Status: 4 Issues Found | Recommendation: Address before merge Overview
Incremental review of Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (4 files)
Previous review (commit 4c6bcf5)Status: 4 Issues Found | Recommendation: Address before merge Overview
Incremental review of the three commits since Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (6 changed files)
Targeted re-verification of prior findings: Previous review (commit f09e628)Status: 2 Issues Found | Recommendation: Address before merge Overview
Incremental review of the whole-file diff pipeline added since Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (22 files)
Previous review (commit bfab19c)Status: No Issues Found | Recommendation: Merge All three previous findings are resolved in the new commits: Files Reviewed (7 files)
Previous review (commit 6414e64)Status: 3 Issues Found | Recommendation: Address before merge Overview
The JetBrains session/diff fixes are well-structured: unified-diff parsing lives in the backend, DTOs carry defaults for RPC compatibility, threading follows the EDT/coroutine rules, the layout reconcile converges instead of looping, and the new tests exercise real implementation. No memory leaks found — the row cache is pruned on update and no new listeners or subscriptions outlive their scope. The one blocker is that the PR ships a test it introduced ( Fix these issues in Kilo Cloud Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Files Reviewed (44 files)
Reviewed by kimi-k3 · Input: 155.1K · Output: 15.8K · Cached: 1.1M Review guidance: REVIEW.md from base branch |
Add on-demand full-content diff loading for the JetBrains diff editor tab while keeping inline turn cards hunk-bounded. Adds a full/file query path to the CLI session diff endpoint and a diffFile RPC that matches the requested path so multi-file turns are not collapsed to a single entry.
Roll back the CLI diff full/file server changes and rebuild whole-file diffs entirely in the JetBrains plugin: the backend reads the working-tree file and reverse-applies the existing hunk patch to recover the full before side, falling back to the hunk view when the tree has drifted. Works against any pinned CLI with no server change.
…back The diff editor tab now shows whole-file diffs (with collapsible unchanged regions) for modified files, while inline session cards stay hunk-bounded. diffSides resolves full before/after with a safe precedence: 1. Authoritative: query the CLI's snapshot diff (full=true&file=...), which reads the exact turn's before/after from snapshot commits via git show and is correct even for historical/reverted turns. 2. Fallback: reverse-apply the hunk patch onto the working-tree file locally, so it works against the current pinned CLI until the new one is released. 3. Hunk view: if neither yields full content (drift/binary/added/deleted), render the existing patch. The CLI change is minimal and additive: full-content logic lives in the kilo-owned diff-full.ts (DiffFull.detail); shared files only gain thin kilocode_change hooks (FileDiff before/after, Snapshot.diffFile, the summary full/file branch, and the diff query fields).
When the diff editor tab falls back to reconstructing sides from the hunk patch, the content is just the concatenated hunk bodies, so IntelliJ numbered the gutter from 1 instead of the real file positions. DiffPatchReconstruct now records, in lockstep with the content it builds, the 0-based source-file line for each reconstructed document line (following the @@ headers and jumping across elided inter-hunk gaps). diffRequest attaches these via the public DiffUserDataKeysEx.LINE_NUMBER_CONVERTOR so the gutter matches the file, mirroring what the inline card already shows. Full authoritative content is untouched since it already starts at line 1.
The binary branch returned an object without before/after while the normal branch included them, so the result was a union and callers could not read before/after without narrowing (the diff-full test failed typecheck). Return before/after as undefined for binary files so the shape is uniform; JSON still omits the undefined keys, so serialized output is unchanged.
# Conflicts: # packages/opencode/src/snapshot/index.ts
…e edits Two correctness fixes for the diff editor's full-file view plus diagnostics: - Open inline/turn/edit diffs against the session's own directory (SessionController.sessionDirectory) instead of the active workspace directory, so authoritative snapshot lookup and local reconstruction resolve against the repo where the session actually ran. - Scope single Edit/Patch diffs to their message: message() now parses the "tool:<sessionId>:<messageId>" token in addition to "turn:", so the authoritative snapshot query is scoped to that edit. A single edit's intermediate state cannot be rebuilt from the final working tree, so it requires the authoritative per-message snapshot. Also adds a dev-only working-tree resolver: when kilo.dev.worktree.root is set, resolve() re-roots a stored diff's file path onto the running worktree by matching the longest existing path suffix, so cross-worktree dev sessions can still reconstruct locally. In production resolve() returns the direct path only. Adds info logging around diffSides/authoritative/detail to make full-vs-hunk decisions observable.
- Add a revertDto overload for the regenerated GlobalSessionRevert model so the backend compiles against the post-merge OpenAPI client. - Resolve the bun executable from BUN_BINARY/BUN, PATH, ~/.bun/bin, and common Homebrew locations in GenerateOpenApiSpecTask, so IDE-launched Gradle (which runs with a stripped PATH) can generate the OpenAPI spec in repo-CLI mode.
Pinned CLI generation exposes GlobalSession.revert as SessionRevert, while the local repo CLI client can generate a separate GlobalSessionRevert model. Avoid importing the repo-only type so pinned builds keep compiling, while still mapping the regenerated repo-CLI shape through reflective getters when present.
Lockfile still listed 7.4.17; package.json is pinned to 7.4.20.
# Conflicts: # packages/kilo-jetbrains/build-tasks/src/main/kotlin/GenerateOpenApiSpecTask.kt
…rains-pixel-icons
fix(jetbrains): improve session diff rendering
Issue
No linked issue. Fixes user-reported JetBrains session rendering and diff-viewer problems.
Context
This PR collects JetBrains UI fixes for session transcript rendering and diff presentation:
Implementation
Tradeoff: multi-hunk patch reconstruction collapses inter-hunk gaps and line numbers restart in the reconstructed side-by-side content. This avoids the client-side VCS dependency and fixes the all-green raw-patch fallback.
Screenshots / Video
Diff render bug for turns
How to Test
Manual/local verification
Executed by agent:
./gradlew :frontend:test --tests ai.kilocode.client.session.ui.SessionLayoutTest./gradlew :frontend:test --tests ai.kilocode.client.diff.DiffPatchReconstructTest --tests ai.kilocode.client.diff.KiloDiffEditorContentTest./gradlew typecheckReviewer test steps
Blocked checks and substitute verification
./gradlew :frontend:test --tests ai.kilocode.client.session.ui.SessionMessageListPanelTestwas run and still fails on the pre-existing unrelatedtest rollback banner shortens duplicate file names with parentsassertion. Substitute verification: the focusedSessionLayoutTest, focused diff tests, andtypecheckall pass.Checklist
Get in Touch
Kilo team internal PR.