@@ -626,6 +626,102 @@ def mock_run(*args, **kwargs):
626626 assert "gistpreview.github.io" in index_content
627627
628628
629+ class TestContinuationLongTexts :
630+ """Tests for long text extraction from continuation conversations."""
631+
632+ def test_long_text_in_continuation_appears_in_index (self , output_dir ):
633+ """Test that long texts from continuation conversations appear in index.
634+
635+ This is a regression test for a bug where conversations marked as
636+ continuations (isCompactSummary=True) were completely skipped when
637+ building the index, causing their long_texts to be lost.
638+ """
639+ # Create a session with:
640+ # 1. An initial user prompt
641+ # 2. Some messages
642+ # 3. A continuation prompt (isCompactSummary=True)
643+ # 4. An assistant message with a long text summary (>300 chars)
644+ session_data = {
645+ "loglines" : [
646+ # Initial user prompt
647+ {
648+ "type" : "user" ,
649+ "timestamp" : "2025-01-01T10:00:00.000Z" ,
650+ "message" : {"content" : "Build a Redis JavaScript module" , "role" : "user" },
651+ },
652+ # Some assistant work
653+ {
654+ "type" : "assistant" ,
655+ "timestamp" : "2025-01-01T10:00:05.000Z" ,
656+ "message" : {
657+ "role" : "assistant" ,
658+ "content" : [{"type" : "text" , "text" : "I'll start working on this." }],
659+ },
660+ },
661+ # Continuation prompt (context was summarized)
662+ {
663+ "type" : "user" ,
664+ "timestamp" : "2025-01-01T11:00:00.000Z" ,
665+ "isCompactSummary" : True ,
666+ "message" : {
667+ "content" : "This session is being continued from a previous conversation..." ,
668+ "role" : "user" ,
669+ },
670+ },
671+ # More assistant work after continuation
672+ {
673+ "type" : "assistant" ,
674+ "timestamp" : "2025-01-01T11:00:05.000Z" ,
675+ "message" : {
676+ "role" : "assistant" ,
677+ "content" : [{"type" : "text" , "text" : "Continuing the work..." }],
678+ },
679+ },
680+ # Final summary - this is a LONG text (>300 chars) that should appear in index
681+ {
682+ "type" : "assistant" ,
683+ "timestamp" : "2025-01-01T12:00:00.000Z" ,
684+ "message" : {
685+ "role" : "assistant" ,
686+ "content" : [
687+ {
688+ "type" : "text" ,
689+ "text" : (
690+ "All tasks completed successfully. Here's a summary of what was built:\n \n "
691+ "## Redis JavaScript Module\n \n "
692+ "A loadable Redis module providing JavaScript scripting via the mquickjs engine.\n \n "
693+ "### Commands Implemented\n "
694+ "- JS.EVAL - Execute JavaScript with KEYS/ARGV arrays\n "
695+ "- JS.LOAD / JS.CALL - Cache and call scripts by SHA1\n "
696+ "- JS.EXISTS / JS.FLUSH - Manage script cache\n \n "
697+ "All 41 tests pass. Changes pushed to branch."
698+ ),
699+ }
700+ ],
701+ },
702+ },
703+ ]
704+ }
705+
706+ # Write the session to a temp file
707+ session_file = output_dir / "test_session.json"
708+ session_file .write_text (json .dumps (session_data ))
709+
710+ # Generate HTML
711+ generate_html (session_file , output_dir )
712+
713+ # Read the index.html
714+ index_html = (output_dir / "index.html" ).read_text ()
715+
716+ # The long text summary should appear in the index
717+ # This is the bug: currently it doesn't because the continuation
718+ # conversation is skipped entirely
719+ assert "All tasks completed successfully" in index_html , (
720+ "Long text from continuation conversation should appear in index"
721+ )
722+ assert "Redis JavaScript Module" in index_html
723+
724+
629725class TestSessionJsonOption :
630726 """Tests for the session command --json option."""
631727
0 commit comments