You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug][Storage] Sessions created before the JSONL→SQLite cutover disappear from the UI after updating — legacy JSONL transcripts are never imported #2260
After updating Maka to the build where SQLite became the sole operational
session store, every session created before the cutover disappeared from the
UI. The session list only shows sessions created after the update.
The old data is not deleted — the legacy transcript files are still on
disk, byte-for-byte intact. The new storage layer simply never reads them.
Evidence (data layer, from a real upgrade on macOS)
Legacy transcript file still exists, intact: ~/Library/Application Support/Maka/workspaces/default/sessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl
— schemaVersion: 1, opens with a legacy-header record, then user/turn
message records. (In the affected install it contains a full turn: user
message, turn_state, token_usage, system_note.)
But the session is absent from the new SQLite store: runtime.sqlite → session_messages returns 0 rows for that session_id; the id appears in neither session_metadata nor session_catalog_projection. The UI therefore has nothing to list.
Schema migrations ran on first launch, but imported nothing: operational_schema_migrations (runtime|9, session_metadata|21, …) all
applied at 1785904471629, which is exactly the first launch after the
update. The migration machinery ran; no legacy-session import was part of
it.
Root cause (source layer)
refactor(storage): make SQLite the sole operational authority #1994refactor(storage): make SQLite the sole operational authority
made SQLite the only session store. Its README documents that several
legacy file stores are not imported (e.g. pre-existing Electron
safeStorage credential files "are not imported; affected users must
re-authenticate"), but for session transcripts it removes the JSONL path
without adding a one-time JSONL→SQLite importer.
In the shipped 0.1.5 bundle (dist/main/), grepping for jsonl finds no
session-transcript reading code at all — the new store only reads SQLite.
Startup (app-lifecycle.ts) calls backfillSessionProjects, but that only
backfills project grouping for sessions that already exist in SQLite; it
never scans sessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl.
The only remaining JSONL handling is packages/core/src/foreign-session.ts
/ packages/storage/src/foreign-session-store.ts (importing Claude Code
/ Codex external transcripts) — not Maka's own legacy transcripts.
So the upgrade path is: JSONL tree → (nothing) → SQLite. Silent invisibility
of intact user data.
Expected behavior
On upgrade, legacy schemaVersion: 1 JSONL sessions should be migrated into
SQLite (session_metadata + session_messages) so they stay visible — or at
minimum surfaced with an explicit import path / notice. Intact data must not
become silently invisible.
Suggested fix (any of)
One-time importer at first launch after cutover: scan sessions/*/session.jsonl, parse legacy-header + message records,
insert into session_metadata / session_messages, and mark the
migration done (schema-version bump or a durable one-time flag) so it runs
exactly once and is idempotent.
If full transcript import is too risky, import at least the session
metadata + last message so the session appears in the list and can be
opened/exported.
Add a "import legacy sessions" action / notice for installs that still
carry a sessions/ tree.
Repro / verification commands (maintainers)
# 1. Legacy transcript still on disk, intact
ls "~/Library/Application Support/Maka/workspaces/default/sessions/"
head -1 "~/Library/Application Support/Maka/workspaces/default/sessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl"# 2. But the new store does not contain it
sqlite3 "~/Library/Application Support/Maka/workspaces/default/runtime.sqlite" \
"SELECT COUNT(*) FROM session_messages WHERE session_id='b156d249-dbd1-4ddb-ae16-a801a9fe9526';"# → 0
sqlite3 "~/Library/Application Support/Maka/workspaces/default/runtime.sqlite" \
"SELECT COUNT(*) FROM session_metadata WHERE session_id='b156d249-dbd1-4ddb-ae16-a801a9fe9526';"# → 0# 3. Migrations ran on first launch, none imported the legacy tree
sqlite3 "~/Library/Application Support/Maka/workspaces/default/runtime.sqlite" \
"SELECT * FROM operational_schema_migrations;"# all applied_at ≈ first launch after update
Environment
Maka version: 0.1.5 (desktop, CFBundleShortVersionString = 0.1.5; also
reproduced from source at upstream/main HEAD 07c1e680)
OS: macOS, Apple Silicon (arm64)
Updated via auto-updater from an earlier 0.1.x build
What happened
After updating Maka to the build where SQLite became the sole operational
session store, every session created before the cutover disappeared from the
UI. The session list only shows sessions created after the update.
The old data is not deleted — the legacy transcript files are still on
disk, byte-for-byte intact. The new storage layer simply never reads them.
Evidence (data layer, from a real upgrade on macOS)
Legacy transcript file still exists, intact:
~/Library/Application Support/Maka/workspaces/default/sessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl—
schemaVersion: 1, opens with alegacy-headerrecord, then user/turnmessage records. (In the affected install it contains a full turn: user
message,
turn_state,token_usage,system_note.)But the session is absent from the new SQLite store:
runtime.sqlite→session_messagesreturns 0 rows for thatsession_id; the id appears in neithersession_metadatanorsession_catalog_projection. The UI therefore has nothing to list.Schema migrations ran on first launch, but imported nothing:
operational_schema_migrations(runtime|9, session_metadata|21, …) allapplied at
1785904471629, which is exactly the first launch after theupdate. The migration machinery ran; no legacy-session import was part of
it.
Root cause (source layer)
refactor(storage): make SQLite the sole operational authoritymade SQLite the only session store. Its README documents that several
legacy file stores are not imported (e.g. pre-existing Electron
safeStorage credential files "are not imported; affected users must
re-authenticate"), but for session transcripts it removes the JSONL path
without adding a one-time JSONL→SQLite importer.
fix(scripts): drop session-bundle imports deleted with the JSONL session treeexplicitly deletes the remaining JSONL-session importcode rather than replacing it with a migration.
dist/main/), grepping forjsonlfinds nosession-transcript reading code at all — the new store only reads SQLite.
app-lifecycle.ts) callsbackfillSessionProjects, but that onlybackfills project grouping for sessions that already exist in SQLite; it
never scans
sessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl.packages/core/src/foreign-session.ts/
packages/storage/src/foreign-session-store.ts(importing Claude Code/ Codex external transcripts) — not Maka's own legacy transcripts.
So the upgrade path is: JSONL tree → (nothing) → SQLite. Silent invisibility
of intact user data.
Expected behavior
On upgrade, legacy
schemaVersion: 1JSONL sessions should be migrated intoSQLite (
session_metadata+session_messages) so they stay visible — or atminimum surfaced with an explicit import path / notice. Intact data must not
become silently invisible.
Suggested fix (any of)
sessions/*/session.jsonl, parselegacy-header+ message records,insert into
session_metadata/session_messages, and mark themigration done (schema-version bump or a durable one-time flag) so it runs
exactly once and is idempotent.
metadata + last message so the session appears in the list and can be
opened/exported.
carry a
sessions/tree.Repro / verification commands (maintainers)
Environment
CFBundleShortVersionString = 0.1.5; alsoreproduced from source at
upstream/mainHEAD07c1e680)Related
work (metadata only; message transcripts stayed in JSONL until refactor(storage): make SQLite the sole operational authority #1994)