Repository navigation
fix(cli): surface real --cloud-fork import failure reasons #12388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
johnnyeric
merged 15 commits into
Kilo-Org:main
from
rakshith1928:fix/cloud-import-error-reporting
Aug 13, 2026
Merged
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
89cb35e
test(cli): add failing importCloudSession regression tests
rakshith1928 d321dfe
fix(cli): throw on cloud session import failures
rakshith1928 a143c7f
fix(kilocode): surface cloud-fork import failure reason in TUI thread…
rakshith1928 7b53ca9
fix(cli): surface cloud-fork import failure reason at shared call sites
rakshith1928 b8c8a10
docs: add changeset and kilocode_change annotations for cloud-fork im…
rakshith1928 dbbd2ba
Merge upstream/main into fix/cloud-import-error-reporting
rakshith1928 c99ce90
refactor(cli): dedupe cloud-fork import error reporting
rakshith1928 afecbf2
Merge remote-tracking branch 'upstream/main' into fix/cloud-import-er…
rakshith1928 f3f8401
fix(cli): extract { error } reason from cloud-session import failures
rakshith1928 ea9c65f
Merge branch 'main' into fix/cloud-import-error-reporting
rakshith1928 bb92ad1
Merge branch 'main' into fix/cloud-import-error-reporting
rakshith1928 5cc68b5
Merge branch 'main' into fix/cloud-import-error-reporting
rakshith1928 1157c73
fix(cli): reorder reportCloudImportError last in cloud-session import
rakshith1928 36b316b
chore: add run.ts import fix
rakshith1928 9a465cb
fix(cli): resolve merge conflicts in attach, run, tui for deferred cl…
rakshith1928 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@kilocode/cli": patch | ||
| --- | ||
|
|
||
| Surface the underlying reason when `kilo --cloud-fork` fails to import a cloud session (HTTP status, server message, or fetch error) in both the user-visible message and the DEBUG log stream. |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { describe, expect, test } from "bun:test" | ||
| import { importCloudSession } from "../../src/kilocode/cloud-session" | ||
|
|
||
| type ImportResult = { data?: unknown; error?: unknown } | ||
|
|
||
| const client = (imp: (params: { sessionId: string }) => Promise<ImportResult>) => | ||
| ({ kilo: { cloud: { session: { import: imp } } } }) as Parameters<typeof importCloudSession>[0] | ||
|
|
||
| describe("importCloudSession", () => { | ||
| test("returns local id on success", async () => { | ||
| const c = client(async () => ({ data: { id: "ses_local" } })) | ||
| const id = await importCloudSession(c, "ses_cloud") | ||
| expect(id).toBe("ses_local") | ||
| }) | ||
|
|
||
| test("throws when server returns HTTP error", async () => { | ||
| const c = client(async () => ({ | ||
| data: undefined, | ||
| error: { name: "GatewayError", message: "session not found", status: 404 }, | ||
| })) | ||
| await expect(importCloudSession(c, "ses_cloud")).rejects.toThrow("session not found") | ||
| }) | ||
|
|
||
| test("throws when data.id is missing", async () => { | ||
| const c = client(async () => ({ data: {} })) | ||
| await expect(importCloudSession(c, "ses_cloud")).rejects.toThrow() | ||
| }) | ||
|
|
||
| test("propagates thrown fetch exceptions", async () => { | ||
| const c = client(async () => { | ||
| throw new Error("network down") | ||
| }) | ||
| await expect(importCloudSession(c, "ses_cloud")).rejects.toThrow("network down") | ||
| }) | ||
| }) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUGGESTION: Consider consolidating the duplicated try/catch pattern
The try/catch +
log.debug("failed to import cloud session", { err })+UI.error(\Failed to import session from cloud: ${errorMessage(err)}`)sequence is repeated near-verbatim across four call sites, three of which are shared upstream files (run.ts,attach.ts,thread.ts). Since each site's only real difference is the exit mechanism (process.exit,process.exitCode,shutdownAndExit), a small helper here (e.g.importCloudSessionOrThrowthat logs before rethrowing, or a shareddescribeCloudImportError(err)formatter) could shrink the diff each shared file carries against upstream — this repo's stated top priority for files outsidekilocode`-named paths.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done — addressed in commit 7138f93. Extracted a shared
eportCloudImportError(err)\ helper in \packages/opencode/src/kilocode/cloud-session.ts\ that logs the failure at DEBUG, prints the real reason via \UI.error, then rethrows. The four call sites now delegate to it and keep their own exit semantics, so the three shared upstream files only carry a single marked import instead of a duplicated try/catch — shrinking the diff against upstream as suggested.