#7839·QwenPaw

[Bug]: session-sync skips orphaned session files with no import, and retention purge still fails with "database disk image is malformed" on 2.2.x

Author: chcsyfCreated Sep 17, 2026Updated Sep 17, 2026

Environment

QwenPaw 2.2.x, default scroll.

Logs (startup)

session-sync: skipped 86 orphaned session file(s) ... no history was imported from those files
retention purge failed: database disk image is malformed   (team-executor / team-reviewer)
history.db.corrupt-20260814T061546                         ← a real corruption happened earlier

Two separate problems

  1. Orphaned session files are skipped and never imported. This is adjacent to, but different from, #6926 (sync.py importing under a random AgentState UUID → orphaned/duplicated rows): here nothing at all is imported. At minimum the reason should be actionable — can these be re-imported under their real session_id, or listed for cleanup?
  2. retention purge still fails. Matches #7596 (FTS shadow-table corruption that PRAGMA integrity_check reports as ok, so the quarantine self-heal never fires; purge is designed as "retention must never break boot" and only logs a warning). #7596 is closed, but its fix PR #7655 is still unmerged, and this reproduces on 2.2.0/2.2.1 — so retention never runs and history keeps accumulating.

Expected: orphaned sessions importable (or a clear, actionable cleanup path); FTS corruption detected and rebuilt at startup (#7655); purge failure surfaced as a visible state rather than a log warning only.