Skip to content

Replay your coding agent sessions as a map and a timeline

fix(server): drop zero-call sessions from the session list

adityajha2005b0aa7d0b30c3
diff --git a/python/src/agentplay/server.py b/python/src/agentplay/server.py
index 564047a..454760c 100644
--- a/python/src/agentplay/server.py
+++ b/python/src/agentplay/server.py
@@ -369,7 +369,7 @@ class _Handler(BaseHTTPRequestHandler):
def _rows(self) -> list[dict[str, Any]]:
with self.lock:
- return [r for r in self.store.rows() if r.get("role") not in ("subagent", "helper")]
+ return [r for r in self.store.rows() if r.get("role") not in ("subagent", "helper") and r.get("calls")]
def _status(self) -> None:
rows = self._rows()
diff --git a/python/tests/test_local_tool.py b/python/tests/test_local_tool.py
index 019b922..d8185d3 100644
--- a/python/tests/test_local_tool.py
+++ b/python/tests/test_local_tool.py
@@ -538,6 +538,20 @@ def test_server_endpoints(env):
httpd.server_close()
+def test_server_hides_zero_call_sessions(env):
+ st = Store(env["sm"])
+ st.index["oneshot"] = {"key": "k", "sessionId": "oneshot", "startedAt": "2026-09-11T00:00:00Z", "calls": 0}
+ st.index["real"] = {"key": "k2", "sessionId": "real", "startedAt": "2026-09-10T00:00:00Z", "calls": 3}
+ httpd = serve(0, store=st)
+ threading.Thread(target=httpd.serve_forever, daemon=True).start()
+ try:
+ with urllib.request.urlopen(f"http://127.0.0.1:{httpd.server_address[1]}/api/sessions") as r:
+ assert [s["sessionId"] for s in json.loads(r.read())["sessions"]] == ["real"]
+ finally:
+ httpd.shutdown()
+ httpd.server_close()
+
+
def test_cli_build_json_and_export(env, capsys, monkeypatch):
_write_claude_session(env["home"], "33333333-0000-0000-0000-000000000003", env["repo"])
assert cli.main(["build", "--json"]) == 0