Skip to content

fix(session): reject stale sqlite molt boundaries#885

Open
TZZheng wants to merge 1 commit into
Lingtai-AI:mainfrom
TZZheng:fix/issue-757-sqlite-molt-boundary-telegrambot
Open

fix(session): reject stale sqlite molt boundaries#885
TZZheng wants to merge 1 commit into
Lingtai-AI:mainfrom
TZZheng:fix/issue-757-sqlite-molt-boundary-telegrambot

Conversation

@TZZheng

@TZZheng TZZheng commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate the selected SQLite psyche_molt boundary's fields_json.molt_count against the requested generation
  • treat missing, malformed, boolean, or mismatched boundary metadata as a fast-path miss
  • preserve the existing authoritative JSONL fallback and valid-boundary behavior

Validation

  • PYTHONPATH=src python -m pytest -q tests/test_agent_session.py17 passed
  • git diff --check canonical/main...HEAD — passed
  • independent read-only review — PASS, no blockers

Risk

Invalid or stale sidecar metadata now takes the slower authoritative fallback instead of injecting totals from the wrong molt generation. The SQLite tier contract and generation-zero/no-boundary behavior remain intact.

Fixes #757

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sqlite rebuild tier does not cross-check molt_count, so a stale sidecar silently seeds wrong session token totals

1 participant