Skip to content

fix: dedupe topic transcript sessions in tui#398

Merged
jalehman merged 2 commits into
mainfrom
josh/fix-tui-topic-session-dedupe
Apr 11, 2026
Merged

fix: dedupe topic transcript sessions in tui#398
jalehman merged 2 commits into
mainfrom
josh/fix-tui-topic-session-dedupe

Conversation

@jalehman

Copy link
Copy Markdown
Contributor

What

Fix the TUI session list so it collapses duplicate transcript files that belong to the same logical session, and add the lossless-data handling principle to AGENTS.md.

Why

When OpenClaw wrote both <session-id>.jsonl and <session-id>-topic-<n>.jsonl for the same Telegram topic session, the TUI rendered both as separate rows even though they mapped to one LCM conversation. That made session state look split and misleading during debugging.

Changes

  • Dedupe discovered session files by JSONL header session id
  • Prefer topic-qualified transcripts when duplicate files exist
  • Add regression coverage for duplicate bare/topic session files
  • Document the no-automatic-data-deletion principle in AGENTS.md

Testing

  • cd /Users/phaedrus/Projects/lossless-claw/tui && go test ./... -run 'Test(LoadSessionBatch|LookupConversationID|DiscoverSessionFiles)'
  • Expected: ok github.com/Martian-Engineering/lossless-claw/tui

The TUI was listing raw JSONL filenames as separate sessions, so when OpenClaw wrote both a bare session file and a topic-qualified file for the same canonical session id, the list showed duplicate rows even though both mapped to one logical LCM conversation. Collapse discovered session files by the JSONL session header id and prefer the topic-qualified transcript when both variants exist. Add a regression test for that duplicate-file case.

Regeneration-Prompt: |
  Fix the lossless-claw TUI so it does not show duplicate session rows when the sessions directory contains both <session-id>.jsonl and <session-id>-topic-<n>.jsonl for the same logical session. The canonical identity should come from the JSONL header's session id, not just the filename stem. Keep existing DB lookup behavior for topic sessions, but collapse duplicate on-disk files into one visible row and prefer the topic-qualified transcript when choosing which file to represent that session. Add a focused test that creates both files with the same header id and verifies the topic-qualified transcript wins.
@jalehman jalehman merged commit 4ee8a95 into main Apr 11, 2026
2 checks passed
@jalehman jalehman deleted the josh/fix-tui-topic-session-dedupe branch April 11, 2026 15:58
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.

1 participant