Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-session-list-all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kilocode/cli": patch
---

Fix `kilo session list --all` crashing with "undefined is not an object" instead of listing sessions across all projects.
2 changes: 1 addition & 1 deletion packages/opencode/src/cli/cmd/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const SessionListCommand = effectCmd({
handler: Effect.fn("Cli.session.list")(function* (args) {
// kilocode_change start
const sessions = args.all
? [...Session.listGlobal({ roots: true, limit: args.maxCount, search: args.search })]
? yield* Session.Service.use((svc) => svc.listGlobal({ roots: true, limit: args.maxCount, search: args.search }))
: yield* Session.Service.use((svc) => svc.list({ roots: true, limit: args.maxCount, search: args.search }))
// kilocode_change end

Expand Down
16 changes: 16 additions & 0 deletions packages/opencode/test/cli/smokes/read-only.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ describe("opencode read-only commands (smoke)", () => {
60_000,
)

// kilocode_change start
// `session list --all` lists sessions across all projects via the global
// listing path (KiloSession.listGlobal). Regression: the handler used to
// spread the Effect returned by Session.listGlobal instead of yielding it,
// crashing the formatter with "undefined is not an object".
cliIt.live(
"session list --all: exits 0",
({ opencode }) =>
Effect.gen(function* () {
const r = yield* opencode.spawn(["session", "list", "--all"])
opencode.expectExit(r, 0, "session list --all")
}),
60_000,
)
// kilocode_change end

// `stats` aggregates token usage from the session DB. Empty DB → all zeros.
cliIt.live(
"stats: exits 0",
Expand Down
Loading