Skip to content

The agent that grows with you

fix(kanban): keep `diagnostics --json` a list; allowlist rides as a trailing home-scope row

teknium120e48f87c04f
diff --git a/hermes_cli/kanban.py b/hermes_cli/kanban.py
index a02f556597d..dc8be95f5df 100644
--- a/hermes_cli/kanban.py
+++ b/hermes_cli/kanban.py
@@ -677,11 +677,11 @@ def _cmd_diagnostics(args: argparse.Namespace) -> int:
allowlist = kbd.dispatch_profile_allowlist_summary()
if getattr(args, "json", False):
- _print_json({
- "dispatch_profiles": allowlist,
- "tasks": [{"task_id": tid, **meta.get(tid, {}), "diagnostics": [d.to_dict() for d in dl]}
- for tid, dl in diags_by_task.items()],
- })
+ # Per-task rows unchanged; the home-scope allowlist rides as a trailing row
+ # (task_id null) so existing `payload[0]["diagnostics"]` consumers keep working.
+ _print_json([{"task_id": tid, **meta.get(tid, {}), "diagnostics": [d.to_dict() for d in dl]}
+ for tid, dl in diags_by_task.items()]
+ + [{"task_id": None, "dispatch_profiles": allowlist, "diagnostics": []}])
return 0
print(f"kanban.dispatch_profiles: {allowlist}")
diff --git a/tests/hermes_cli/test_kanban_dispatch_claim_allowlist.py b/tests/hermes_cli/test_kanban_dispatch_claim_allowlist.py
index fe33656181e..b94a4a86c8e 100644
--- a/tests/hermes_cli/test_kanban_dispatch_claim_allowlist.py
+++ b/tests/hermes_cli/test_kanban_dispatch_claim_allowlist.py
@@ -134,5 +134,5 @@ def test_diagnostics_reports_resolved_allowlist(kanban_home, capsys, config, exp
assert f"kanban.dispatch_profiles: {expected}" in text
assert kanban_cli._cmd_diagnostics(argparse.Namespace(task=None, severity=None, json=True)) == 0
payload = json.loads(capsys.readouterr().out)
- assert payload["dispatch_profiles"].startswith(expected)
- assert payload["tasks"] == []
+ assert payload == [{"task_id": None, "dispatch_profiles": payload[-1]["dispatch_profiles"], "diagnostics": []}]
+ assert payload[-1]["dispatch_profiles"].startswith(expected)