fix: dedupe topic transcript sessions in tui#398
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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>.jsonland<session-id>-topic-<n>.jsonlfor 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
AGENTS.mdTesting
cd /Users/phaedrus/Projects/lossless-claw/tui && go test ./... -run 'Test(LoadSessionBatch|LookupConversationID|DiscoverSessionFiles)'ok github.com/Martian-Engineering/lossless-claw/tui