Skip to content

Restore cloud session diffs on import - #10948

Merged
iscekic merged 12 commits into
mainfrom
feat/session-diff-portability
Jun 8, 2026
Merged

Restore cloud session diffs on import#10948
iscekic merged 12 commits into
mainfrom
feat/session-diff-portability

Conversation

@iscekic

@iscekic iscekic commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Restore synced cloud session diffs during session import so imported sessions bring their filesystem changes back into the target workspace.
  • Extract diffs from the new top-level sessionDiff / session_diff payloads while keeping the legacy message-summary fallback.
  • Persist restored diffs into session_diff storage after import so imported sessions keep local diff metadata.

Notes

  • Restoration is best-effort: patch diffs use git apply --3way, file snapshots are constrained to the target workspace, and restore/storage failures are logged without blocking the session database import.
  • The shared opencode route change is limited to wiring Storage into the HTTP API layer; the restore logic lives under Kilo-owned paths to keep the upstream diff small.

Comment thread packages/opencode/src/kilocode/session-portability/session-diff-restore.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

All previously flagged issues are resolved. The incremental diff (since 0c28e05f03bb86858645bd8759c64ac012d048e0) contains a single commit that bumps two live-test timeouts in prompt.test.ts from 3,000ms to 10,000ms to accommodate slower Windows CI — no issues.

Resolved Suggestions (all fixed)
File Issue Status
packages/opencode/src/kilocode/session-portability/cumulative-diff.ts appendSessionDiffs didn't handle next being a proper prefix of existing ✅ Fixed
packages/opencode/src/session/summary.ts msgDiffs computed unconditionally even when unused ✅ Fixed
packages/opencode/src/kilocode/session-portability/session-diff-restore.ts Missing windowsHide on Bun.spawnSync ✅ Fixed
packages/opencode/src/kilocode/session-portability/session-diff-restore.ts Misleading async/await on synchronous restoreSessionDiffs ✅ Fixed
packages/opencode/src/kilocode/session-portability/session-diff-restore.ts Path traversal guard incomplete ✅ Fixed
packages/opencode/src/kilocode/session-portability/cumulative-diff.ts mergeSessionDiffs duplicated base entries when local was a superset of base ✅ Fixed
Files Reviewed (incremental — 1 file changed)
  • packages/opencode/test/session/prompt.test.ts — timeout bump for Windows CI, no issues

Reviewed by claude-4.6-sonnet-20260217 · 500,276 tokens

Review guidance: REVIEW.md from base branch main

@iscekic iscekic self-assigned this Jun 5, 2026
@iscekic
iscekic requested a review from eshurakov June 5, 2026 13:32
Comment thread packages/opencode/src/kilocode/session-portability/cumulative-diff.ts Outdated
@iscekic
iscekic force-pushed the feat/session-diff-portability branch from da53950 to a6a3ce6 Compare June 8, 2026 14:12
Comment thread packages/opencode/src/session/summary.ts Outdated
@iscekic
iscekic enabled auto-merge (squash) June 8, 2026 15:13
@iscekic
iscekic merged commit 6ee090b into main Jun 8, 2026
21 checks passed
@iscekic
iscekic deleted the feat/session-diff-portability branch June 8, 2026 15:44
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
* feat(cli): restore cloud session diffs on import

* fix(cli): hide git diff restore subprocesses

* fix(cli): harden session diff path guard

* test(cli): keep diff restore test synchronous

* test(cli): normalize diff restore line endings

* fix(cli): preserve imported diffs across session forks

* chore: remove session ingest findings doc

* fix(cli): avoid duplicate cumulative session diffs

* test(cli): isolate session export test failures

* fix(cli): preserve cumulative cloud fork diffs

* fix(cli): avoid cumulative diff prefix duplication
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