Skip to content

Commit 5f1f326

Browse files
fix: skip summary metadata entries in JSONL role fallback path
1 parent 98b295c commit 5f1f326

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

tests/test_jsonl_parser.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,25 @@ def test_file_history_snapshot_timestamp(self):
771771
finally:
772772
os.unlink(path)
773773

774+
def test_summary_entry_type_produces_no_message(self, caplog):
775+
path = _write_jsonl(
776+
[
777+
{
778+
"type": "summary",
779+
"timestamp": "2026-01-03T08:00:00Z",
780+
"summary": "Session recap metadata",
781+
},
782+
]
783+
)
784+
try:
785+
with caplog.at_level("WARNING", logger="utils.jsonl_parser"):
786+
s = parse_session(path)
787+
assert len(s["messages"]) == 0
788+
assert s["metadata"]["entry_counts"].get("summary") == 1
789+
assert "Unknown message role" not in caplog.text
790+
finally:
791+
os.unlink(path)
792+
774793
def test_entry_counts_accumulated(self):
775794
assistant_entry = {
776795
"type": "assistant",

utils/jsonl_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"_track_file_activity",
4242
]
4343

44-
_SKIP_ENTRY_TYPES = frozenset({"file-history-snapshot"})
44+
# Metadata-only JSONL entry types: contribute timestamps/counts but not messages.
45+
_SKIP_ENTRY_TYPES = frozenset({"file-history-snapshot", "summary"})
4546
_VALID_ROLES = frozenset(get_args(RoleLiteral))
4647
_log = logging.getLogger(__name__)
4748

0 commit comments

Comments
 (0)