fix(cli): import cloud sessions before validation - #11223
Conversation
| return { data: { id: "ses_local" } } | ||
| }, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
WARNING: expect inside mock will be silently swallowed
The expect(input.sessionId).toBe("ses_cloud") assertion sits inside the mocked import function. When importCloudSession is called, it invokes this mock — but the call site wraps the whole thing with .catch(() => undefined) (see thread.ts line 38). If this assertion throws (e.g. the wrong session ID is passed), the error is caught and id becomes undefined, causing an early return with fork.ok = false. The test then only fails on the later expect(seen).toEqual(["ses_local"]) with a confusing message rather than pointing directly at the bad session ID.
Consider moving the assertion out of the mock and instead capturing the received sessionId in a variable, then asserting after the await:
let importedId: string | undefined
mock.module("@kilocode/sdk/v2", () => ({
createKiloClient: () => ({
kilo: {
cloud: {
session: {
import: async (input: { sessionId: string }) => {
importedId = input.sessionId
return { data: { id: "ses_local" } }
},
},
},
},
}),
}))
// ... after `await mod.KiloTuiThreadDaemon.attach(...)`
expect(importedId).toBe("ses_cloud")Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)Mock-heavy test: The new test uses 5
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Reviewed by claude-4.6-sonnet-20260217 · 676,008 tokens Review guidance: REVIEW.md from base branch |
…ssion-import # Conflicts: # packages/opencode/src/cli/cmd/tui/thread.ts # packages/opencode/src/kilocode/cli/cmd/tui/thread.ts # packages/opencode/test/kilocode/cli/tui/thread.test.ts
|
thanks! |
…ion-import fix(cli): import cloud sessions before validation
Summary
--cloud-forksessions before validating the local session ID in TUI startup.Fixes #11222
Signed-off-by: gpt-5.5 on behalf of matt