fix(kiro): fix empty session list and support new file-based format (~May 2026)#230
Open
Sean10 wants to merge 2 commits into
Open
fix(kiro): fix empty session list and support new file-based format (~May 2026)#230Sean10 wants to merge 2 commits into
Sean10 wants to merge 2 commits into
Conversation
- 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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Two separate issues with Kiro CLI session support:
1. Sessions not showing at all (old format)
scanKiroSessions()was silently failing withENOBUFSwhen callingexecFileSync('sqlite3', ...). The default 1MB buffer is exhausted when the database contains many sessions (e.g. 1595+ rows × ~500 bytes each). Thetry/catchswallowed the error and returned an empty array.Additionally,
loadKiroDetail()only handledassistant.Responsebut ~89% of assistant turns useassistant.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 replyToolResults→ tool call results (skipped in preview)Changes
Commit 1 — fix:
fix(kiro): add maxBuffer and support ToolUse format in session parsingmaxBuffer: 50 * 1024 * 1024to bothscanKiroSessionsandloadKiroDetailexecFileSynccalls (matches the pattern used by all other sqlite3 calls in the file)assistant.ToolUsein addition toassistant.ResponseinloadKiroDetailCommit 2 — feat:
feat(kiro): support new session format introduced in ~May 2026KIRO_SESSIONS_DIRconstant pointing to~/.kiro/sessions/cli/scanKiroCliSessions()— scans.jsonmetadata filesloadKiroCliDetail()— parses.jsonlevent filesloadSessions,getSessionDetail,getSessionPreview,searchFullText,getSessionReplayOld SQLite-based sessions remain fully supported alongside the new format.
Testing
scanKiroCliSessions()returns 122 sessions including today's sessionsloadKiroCliDetail()correctly parses user/assistant messages from.jsonlscanKiroSessions()now returns 1595 sessions (was failing silently before)