Replay your coding agent sessions as a map and a timeline
Python agent-observabilityai-agentsclaudeclaude-codecodexcoding-agentscursordeveloper-toolsdevtoolsgithub-copilotkirollmobservabilityopencodeprivacypythonsession-replaytypescriptvisualization
fix(hook_detail): keep readable subagent transcripts beside an unreadable folder
adityajha2005e7361229d5dc
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 262fb00..848e82e 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@@ -1165,9 +1165,12 @@ def _has_cursor_store_header(head: bytes) -> bool:return False-def claude_code_subagent_files(transcript: Path) -> list[Path]:+def claude_code_subagent_files(transcript: Path, *, strict: bool = True) -> list[Path]:+ """Subagent transcripts under ``<session>/subagents/**``. ``strict`` raises on an+ unreadable folder; otherwise that folder is skipped and its readable siblings kept."""+def _raise_unless_missing(err: OSError) -> None:- if not isinstance(err, FileNotFoundError):+ if strict and not isinstance(err, FileNotFoundError):raise errreturn sorted(diff --git a/python/src/agentplay/hook_detail.py b/python/src/agentplay/hook_detail.pyindex 2b5715d..4883d79 100644--- a/python/src/agentplay/hook_detail.py+++ b/python/src/agentplay/hook_detail.py@@ -73,11 +73,8 @@ def _transcripts(path: str) -> list[str]:"""The session transcript, then its subagents' (``<session>/subagents/**/agent-*.jsonl``)."""from ._core.ingestion.coding_agent._sources.local.source import claude_code_subagent_files- try:- subs = claude_code_subagent_files(Path(path))- except OSError:- subs = []- return [path, *(str(f) for f in subs)]+ # Not strict: one unreadable folder must not hide hooks in the readable ones.+ return [path, *(str(f) for f in claude_code_subagent_files(Path(path), strict=False))]def _load(path: str, line_no: int, uuid: str) -> dict[str, Any] | None:"""The hook attachment on one line, or None if the file changed under us."""diff --git a/python/tests/test_local_tool.py b/python/tests/test_local_tool.pyindex 8d76751..278926e 100644--- a/python/tests/test_local_tool.py+++ b/python/tests/test_local_tool.py@@ -168,6 +168,27 @@ def test_unreadable_workflow_folder_fails_only_its_own_session(env):assert (rep.found, rep.built, rep.failed) == (2, 1, 1)[email protected](sys.platform == "win32" or os.geteuid() == 0, reason="needs POSIX permissions")+def test_hook_detail_keeps_readable_subagents_beside_an_unreadable_folder(tmp_path):+ from agentplay.hook_detail import _transcripts++ f = tmp_path / "s.jsonl"+ f.write_text("")+ subs = tmp_path / "s" / "subagents"+ (subs / "workflows" / "ok").mkdir(parents=True)+ direct = subs / "agent-a.jsonl"+ nested = subs / "workflows" / "ok" / "agent-b.jsonl"+ direct.write_text("")+ nested.write_text("")+ bad = subs / "workflows" / "locked"+ bad.mkdir()+ bad.chmod(0)+ try:+ assert _transcripts(str(f)) == [str(f), str(direct), str(nested)]+ finally:+ bad.chmod(0o700)++@pytest.mark.parametrize(("raw", "want"),[