Skip to content

storage: one undecodable legacy session file permanently breaks sessions:list and onboarding snapshot #1418

Closed

Description

@Astro-Han

Summary

SqliteSessionStore runs importLegacySessionMetadataTree in its constructor and every store operation awaits the resulting ready promise (packages/storage/src/session-store.ts:99 + ensureReady). The import is intentionally fail-atomic — scan/decode completes before the transaction begins (packages/storage/src/session-metadata-transfer.ts:24-28) — and only tolerates ENOENT. A single permanently undecodable session.jsonl therefore rejects ready on every launch: sessions:list and onboarding:getSnapshot fail forever, and the renderer only shows a generic "刷新会话列表失败" toast with no actionable detail.

Evidence

Observed live: a profile containing sessions/947ea80c-…/session.jsonl whose first line is a turn_state record instead of a SessionHeader → both IPC handlers throw Invalid legacy session header … malformed fields on every launch, leaving the sidebar empty.

Impact

Any user with one corrupted legacy session file (crash/kill mid-write, or test pollution from pre-isolation dev runs) loses the session list and onboarding snapshot permanently, with no recovery path short of finding and deleting the file by hand.

Direction (not prescriptive)

Keep the atomic transaction, but quarantine-and-report undecodable files: skip them, name them in an actionable error or diagnostics surface, and let the rest of the catalog import. The renderer surface for that report is a product decision.

Activity

  1. Astro-Han commented on Jul 24, 2026

    @Astro-Han
    ContributorAuthor

    Fixed by #1426 — malformed legacy headers are skipped (not tombstoned) so one corrupt session.jsonl no longer breaks sessions:list/onboarding; the reported turn_state first-record case is covered by tests. The diagnostics-surface part of the issue direction is left as a separate product decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions