Skip to content

fix(kiro): fix empty session list and support new file-based format (~May 2026)#230

Open
Sean10 wants to merge 2 commits into
vakovalskii:mainfrom
Sean10:fix/kiro-session-support
Open

fix(kiro): fix empty session list and support new file-based format (~May 2026)#230
Sean10 wants to merge 2 commits into
vakovalskii:mainfrom
Sean10:fix/kiro-session-support

Conversation

@Sean10

@Sean10 Sean10 commented Jun 8, 2026

Copy link
Copy Markdown

Problem

Two separate issues with Kiro CLI session support:

1. Sessions not showing at all (old format)

scanKiroSessions() was silently failing with ENOBUFS when calling execFileSync('sqlite3', ...). The default 1MB buffer is exhausted when the database contains many sessions (e.g. 1595+ rows × ~500 bytes each). The try/catch swallowed the error and returned an empty array.

Additionally, loadKiroDetail() only handled assistant.Response but ~89% of assistant turns use assistant.ToolUse (same structure, different key), so conversation content was missing.

2. Sessions from ~May 2026 not visible (new format)

Kiro CLI changed its storage format. New sessions are stored under ~/.kiro/sessions/cli/ as per-session files:

  • <uuid>.json — metadata: session_id, cwd, title, created_at, updated_at
  • <uuid>.jsonl — events, one per line: {version, kind, data}
    • Prompt → user message (data.content[].kind==='text')
    • AssistantMessage → assistant reply
    • ToolResults → tool call results (skipped in preview)

Changes

Commit 1 — fix: fix(kiro): add maxBuffer and support ToolUse format in session parsing

  • Add maxBuffer: 50 * 1024 * 1024 to both scanKiroSessions and loadKiroDetail execFileSync calls (matches the pattern used by all other sqlite3 calls in the file)
  • Handle assistant.ToolUse in addition to assistant.Response in loadKiroDetail

Commit 2 — feat: feat(kiro): support new session format introduced in ~May 2026

  • Add KIRO_SESSIONS_DIR constant pointing to ~/.kiro/sessions/cli/
  • Add scanKiroCliSessions() — scans .json metadata files
  • Add loadKiroCliDetail() — parses .jsonl event files
  • Wire both into all dispatch points: loadSessions, getSessionDetail, getSessionPreview, searchFullText, getSessionReplay

Old SQLite-based sessions remain fully supported alongside the new format.

Testing

  • Verified scanKiroCliSessions() returns 122 sessions including today's sessions
  • Verified loadKiroCliDetail() correctly parses user/assistant messages from .jsonl
  • Verified old scanKiroSessions() now returns 1595 sessions (was failing silently before)
  • All 153 existing tests pass

Sean10 added 2 commits June 8, 2026 18:00
- Add maxBuffer: 50MB to scanKiroSessions execFileSync call to prevent
  ENOBUFS error when database has many sessions (1595+ rows exceeded
  the default 1MB buffer limit, causing silent failure and empty results)
- Add maxBuffer: 50MB to loadKiroDetail execFileSync call for consistency
- Fix loadKiroDetail to handle assistant.ToolUse in addition to
  assistant.Response (ToolUse is the dominant format, ~89% of turns)
Kiro CLI changed its storage from SQLite (conversations_v2) to
per-session files under ~/.kiro/sessions/cli/:
  - <uuid>.json  — metadata: session_id, cwd, title, created_at, updated_at
  - <uuid>.jsonl — events: {version, kind, data} per line
    kinds: Prompt (user), AssistantMessage (assistant), ToolResults

Add scanKiroCliSessions() and loadKiroCliDetail() to handle the new
format, and wire them into all existing dispatch points (loadSessions,
getSessionDetail, getSessionPreview, searchFullText, getSessionReplay).
Old SQLite-based sessions remain fully supported.
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.

1 participant