Replay your coding agent sessions as a map and a timeline
Python agent-observabilityai-agentsclaudeclaude-codecodexcoding-agentscursordeveloper-toolsdevtoolsgithub-copilotkirollmobservabilityopencodeprivacypythonsession-replaytypescriptvisualization
fix(gemini): skip sessions whose only user text is empty
shubhookef743a2a32bf
diff --git a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.pyindex 73901a6..6b8aa75 100644--- a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py+++ b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py@@ -1136,10 +1136,11 @@ _GEMINI_SESSION_CONTEXT_PREFIX = "<session_context>"def _gemini_user_counts(content: object) -> bool:- """True unless every text part is the CLI's synthetic `<session_context>`.+ """True when a `user` record carries prompt text, plus tool-result records.- A tool-result `user` record has no text parts and still counts. A record- that is only the context block does not: the parser opens no turn for it.+ Empty text and the CLI's `<session_context>` block are ignored, the same+ filter as `parsers.gemini._user_prompt` (`text` must be non-empty and not+ that prefix). A tool-result record has no text parts and still counts."""if isinstance(content, str):texts = [content]@@ -1153,7 +1154,7 @@ def _gemini_user_counts(content: object) -> bool:return Trueif not texts:return True- return any(not text.lstrip().startswith(_GEMINI_SESSION_CONTEXT_PREFIX) for text in texts)+ return any(text and not text.lstrip().startswith(_GEMINI_SESSION_CONTEXT_PREFIX) for text in texts)def _gemini_has_messages(head: bytes) -> bool:diff --git a/python/tests/core/test_gemini_parser.py b/python/tests/core/test_gemini_parser.pyindex dd9693a..2f49554 100644--- a/python/tests/core/test_gemini_parser.py+++ b/python/tests/core/test_gemini_parser.py@@ -431,6 +431,24 @@ def test_context_only_session_is_skipped_as_empty_events(tmp_path):assert source.discovery_stats()["gemini-cli"]["skipped"]["empty_events"] == 2+def test_empty_text_user_record_is_skipped_as_empty_events(tmp_path):+ home = _gemini_home(tmp_path)+ chats = home / "tmp" / "project" / "chats"+ # `""` is dropped by `_user_prompt` (`if text`). Whitespace is not.+ (chats / "session-empty-text.jsonl").write_bytes(+ _session(_context_user("u0", "", ""), session_id="empty-text")+ )+ (chats / "session-whitespace-prompt.jsonl").write_bytes(+ _session(_context_user("u1", " "), session_id="whitespace-prompt")+ )+ source = LocalSource(claude_code_homes=[], codex_homes=[], gemini_homes=[home])+ index = source._build_index()+ assert "local:gemini-cli:empty-text" not in index+ assert "local:gemini-cli:whitespace-prompt" in index+ # Header-only file from `_gemini_home`, plus the empty-text session.+ assert source.discovery_stats()["gemini-cli"]["skipped"]["empty_events"] == 2++def test_local_source_indexes_gemini_sessions(tmp_path):source = LocalSource(claude_code_homes=[], codex_homes=[], gemini_homes=[_gemini_home(tmp_path)])index = source._build_index()