Skip to content

fix(cli): list sessions across all projects instead of crashing - #13896

Merged
marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
esc:fix/session-list-all
Sep 7, 2026
Merged

marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
esc:fix/session-list-all

Conversation

@esc

@esc esc commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What

kilo session list --all crashes with Error: Unexpected error — undefined is not an object (evaluating 'f.id.length') in table format, or 'L.time.updated' with --format json. Exit code 1. Plain kilo session list works fine.

Root cause

The --all branch of the list handler spread the result of Session.listGlobal(): [...Session.listGlobal({ roots: true, ... })].

listGlobal returns an Effect, and an Effect's Symbol.iterator is the single-shot generator adapter meant for yield* inside Effect.gen — so the spread produces a 1-element array containing an internal Effect wrapper, not session rows. The formatters then dereference .id / .time.updated on that wrapper and crash.

The flag was added in 93ce148 when listGlobal was still a synchronous generator (spreading was correct then). When the non---all branch was later migrated to yield* Session.Service.use(...), the --all branch was missed.

Fix

Yield the service method instead, mirroring the non---all branch: yield* Session.Service.use((svc) => svc.listGlobal({ roots: true, ... })).

svc.listGlobal self-provides Database.Service, so no extra wiring is needed.

Verification

Adds a session list --all case to the read-only CLI smoke suite — it fails on the old code and passes with the fix. Also verified end-to-end from source against a database with sessions in multiple projects: table and JSON output both render correctly.

@kilo-code-bot

kilo-code-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .changeset/fix-session-list-all.md
  • packages/opencode/src/cli/cmd/session.ts
  • packages/opencode/test/cli/smokes/read-only.test.ts

Reviewed by grok-4.6 · Input: 171.6K · Output: 5.7K · Cached: 135.2K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 7bcd136 into Kilo-Org:main Sep 7, 2026
32 checks passed
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