feat(cli): import cloud transcript on create_session - #13483
Merged
Conversation
Provide the helper's effect services from the group context so the HTTP import handler keeps the base request graph. Map the tagged helper errors via Effect.match instead of matchEffect.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summaries (2 snapshots, latest commit f068331)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit f068331)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (8 files)
Fix these issues in Kilo Cloud Previous review (commit 605f41e)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (8 files)
Reviewed by grok-4.6 · Input: 54.7K · Output: 10.4K · Cached: 278.8K Review guidance: REVIEW.md from base branch |
eshurakov
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #9624
Context
Kilo Code can now continue a session from the cloud. A connected client can ask the CLI to open an
existing cloud session locally, and the CLI downloads that session and opens it instead of starting
a new empty session. When the client does not ask, the CLI starts a new session exactly as before.
Implementation
The
create_sessioncommand accepts an optionalcloneFromKiloSessionIdstring. When it is set,the sender imports the cloud session in-process, attaches it, and defers the workspace file restore
and the session-diff storage writes until after the attach succeeds; a failed attach removes the
imported session with no restore or storage side effects. When it is absent, the sender creates a
fresh session exactly as before, import failures map to fixed wire error literals, and a clone
request with no import seam is rejected instead of falling back to a fresh create.
Files
packages/opencode/src/kilo-sessions/remote-sender.ts— adds thecloneFromKiloSessionIdfield, theimportFromCloudseam option, the clone branch with import-then-attach-then-finalize ordering, the wire error literal map, and attach-failure rollback.The cloud-session import logic moves out of the HTTP handler into a shared in-process helper that
fails with four typed errors: unauthorized, upstream (carrying the status and error), bad-request,
and internal. The helper persists the session and its messages and parts, restores workspace files,
and writes the session-diff storage keys. The
cloudSessionImportroute now delegates to the helperand keeps its existing HTTP status mapping, so old callers see no change.
Files
packages/opencode/src/kilocode/server/import-cloud-session-in-process.ts— new helper withimportSession,importSessionWithoutRestore,finalizeSessionImport, and the four tagged errors.packages/opencode/src/kilocode/server/httpapi/handlers/kilo-gateway.ts—cloudSessionImportlazily imports the helper, provides the request-scoped services, and maps the typed errors to the same HTTP statuses.The heartbeat capabilities object gains an optional
sessionCloneflag sent astrue. A consumercan use the flag to tell a capable CLI from an old one, and CLIs that omit it stay wire-compatible.
Files
packages/opencode/src/kilo-sessions/remote-protocol.ts— addssessionCloneto the capabilities schema.packages/opencode/src/kilo-sessions/remote-ws.ts— sendscapabilities: { attachments: true, sessionClone: true }on fresh and degraded heartbeats.Production wires the import seam to the in-process helper through a dynamic import and the app
runtime. The dynamic import keeps the HTTP handler graph out of the remote-sender module graph, and
the import runs through the app runtime.
Files
packages/opencode/src/kilo-sessions/kilo-sessions.ts— adds theimportFromCloudseam that dynamically imports the helper, runsimportSessionWithoutRestore, and returns the session plus afinalizeclosure that runsfinalizeSessionImport.Tests: 2 test files updated —
remote-sender.test.tsadds 5 clone-path cases,remote-ws.test.tsupdates the capability assertion.Generated: none.
Screenshots / Video
Visual Changes: N/A
How to Test
Manual/local verification
Verification: no E2E report attached. The mobile/cloud surface carries the runtime verification; this PR is CLI wire only.
Reviewer test steps
create_sessionwithcloneFromKiloSessionIdset to a real cloud session id. Confirm the CLI imports and attaches that session, then restores its workspace files.create_sessionwithout the clone field. Confirm the CLI still creates a fresh session.Blocked checks and substitute verification
None.
Human steps
None.
Notes
None.
Checklist
Fixes #9624)Get in Touch
N/A