Replay your coding agent sessions as a map and a timeline
Python agent-observabilityai-agentsclaudeclaude-codecodexcoding-agentscursordeveloper-toolsdevtoolsgithub-copilotkirollmobservabilityopencodeprivacypythonsession-replaytypescriptvisualization
fix(cli): fall back to a list number after fix id lookups
aiswaryasankartest277d69de7a35
diff --git a/python/src/agentplay/cli.py b/python/src/agentplay/cli.pyindex 8163034..3409746 100644--- a/python/src/agentplay/cli.py+++ b/python/src/agentplay/cli.py@@ -332,19 +332,19 @@ def _health_fixes(st: Store, days: int = 30) -> list[dict]:def _pick_fix(st: Store, items: list[dict], target: str) -> dict | None:- """A fix by its 1-based number in ``items`` or by id (the viewer shows ids, over any window)."""+ """A fix by id (the viewer shows ids, over any window), else by its 1-based number in ``items``.++ Ids come first: they are hex, so one can be all digits.+ """if not target:return None- # An exact id first: ids are hex, so one can be all digits.- exact = next((f for f in items if f["id"] == target), None)- if exact is not None:- return exact- if target.isdigit() and len(target) < 12:- n = int(target)- return items[n - 1] if 1 <= n <= len(items) else None- return next(- (f for f in _health_fixes(st, days=36500) if f["id"] == target), None- )+ by_id = next((f for f in items if f["id"] == target), None)+ if by_id is None and len(target) == 12:+ by_id = next((f for f in _health_fixes(st, days=36500) if f["id"] == target), None)+ if by_id is not None or not target.isdigit():+ return by_id+ n = int(target)+ return items[n - 1] if 1 <= n <= len(items) else Nonedef cmd_fix(args: argparse.Namespace) -> int:diff --git a/python/tests/test_search_health_fixes.py b/python/tests/test_search_health_fixes.pyindex c6a0fe7..131e6ac 100644--- a/python/tests/test_search_health_fixes.py+++ b/python/tests/test_search_health_fixes.py@@ -393,13 +393,15 @@ def test_resolver_roots_keep_the_latest_checkout(tmp_path):assert r.roots()[name] == str(a)-def test_an_all_digit_fix_id_is_matched_before_a_list_number(tmp_path):+def test_an_all_digit_fix_id_is_matched_before_a_list_number(monkeypatch):from agentplay import cliitems = [{"id": "aaaaaaaaaaaa"}, {"id": "123456789012"}]assert cli._pick_fix(None, items, "123456789012")["id"] == "123456789012"assert cli._pick_fix(None, items, "1")["id"] == "aaaaaaaaaaaa"assert cli._pick_fix(None, items, "0") is None+ monkeypatch.setattr(cli, "_health_fixes", lambda *_a, **_k: [])+ assert cli._pick_fix(None, items, "000000000002")["id"] == "123456789012" # zero-padded numberdef test_bad_cron_time_leaves_the_hook_alone(monkeypatch, capsys):