Skip to content

Session file rotation breaks bootstrap — compaction never triggers (PR #190) #233

@glfruit

Description

@glfruit

Summary

PR #190 (open since 2026-03-26) fixes a critical bug where session file rotation (after /reset or natural rotation) causes LCM bootstrap() to enter a dead loop:

  1. New session file path ≠ old path → skips fast paths ✅
  2. reconcileSessionTail() finds no overlap → hasOverlap: false
  3. bootstrapState never updated (only updates on hasOverlap: true) ❌
  4. Next call: same stale path, same dead loop → compaction never triggers

Production Impact

  • compaction_events: 0 rows (never compacted)
  • Session tracked wrong .jsonl file (815KB, stale)
  • Two agents hit context overflow with compactionAttempts: 0/1

Proposed Fix

Add rotation detection before the fast-path guard in bootstrap() — when path changes, purge stale conversation data and re-bootstrap fresh. Full diff in PR #190.

Workaround

We have applied the patch locally and it resolves the issue. Would love to see this merged upstream.

cc @jalehman

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