Skip to content

fix(gateway): restore session transcript fallback - #33623

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix-33563-telegram-session-jsonl-fallback
Closed

fix(gateway): restore session transcript fallback#33623
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix-33563-telegram-session-jsonl-fallback

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • restore JSONL transcript writes in SessionStore.append_to_transcript and rewrites in rewrite_transcript
  • fall back to the JSONL backup when DB transcript rows are missing or unreadable
  • add regression tests for DB-empty fallback and skip_db transcript persistence

Closes #33563.

Testing

  • uv run --frozen pytest -o addopts= tests/gateway/test_session.py -k "LoadTranscriptFallback or RewriteTranscript"
  • uv run --frozen pytest -o addopts= tests/run_agent/test_860_dedup.py -k "skip_db or default_writes_to_sqlite"
  • uv run --frozen ruff check gateway/session.py tests/gateway/test_session.py tests/run_agent/test_860_dedup.py
  • git diff --check

Proof

  • .paperclip_artifacts/quality-gate/proof-71574eb3ceb2ffb505bb8f98ef96951c14904784.json

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels May 28, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for taking a crack at this, and the regression tests are clean work. Unfortunately we can't take this one, and the reason is architectural rather than a quality issue.

This PR restores JSONL transcript writes in append_to_transcript/rewrite_transcript and re-adds a JSONL fallback in load_transcript. But the JSONL fallback was deliberately removed in commit 024a8e3ee ("refactor(gateway): drop JSONL fallback in load_transcript") — state.db is the canonical session store by design, and pre-DB sessions were already migrated into it. Re-adding the JSONL path reintroduces dual-write/dual-read divergence (the #860 duplicate-write class) and revives an approach we intentionally moved past.

The underlying issue this targets (#33563) was a stale premise plus a real-but-already-fixed corruption bug:

So the right fix for the data-loss symptom is the corruption detection/repair that's already on main, not restoring a parallel JSONL store. Closing #33563 as resolved alongside this.

Appreciate the contribution — the DB-empty-fallback test instinct was sound; it just points at a layer we've intentionally collapsed onto state.db.

@teknium1 teknium1 closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway Telegram sessions lose context after idle TTL eviction — session JSONL never written, state.db corruption swallows writes silently

3 participants