Skip to content

The agent that grows with you

fix(kanban): unknown-assignee skip is recorded once per card, never once per tick (#122422, salvage #122567)

teknium189cb27ab6fba
diff --git a/hermes_cli/kanban_db_dispatch.py b/hermes_cli/kanban_db_dispatch.py
index be00cf26a41..0edbb311a2e 100644
--- a/hermes_cli/kanban_db_dispatch.py
+++ b/hermes_cli/kanban_db_dispatch.py
@@ -2040,12 +2040,19 @@ def _dispatch_lane_task(
profile_exists = _profile_exists_fn()
if profile_exists is not None and not profile_exists(assignee):
result.skipped_nonspawnable.append(task_id)
- # Per-task diagnostic so ``show``/``tail`` name the missing profile
- # instead of leaving the card in ``ready`` with zero board evidence.
- # ponytail: one event per tick (same as respawn_guarded); dedupe if noisy.
+ # Per-task diagnostic so ``show``/``tail`` name the missing profile instead of leaving
+ # the card in ``ready`` with zero board evidence (#122422). Unlike a respawn guard the
+ # condition never expires on its own, so write it once: a repeat only when something
+ # else happened on the card since (reassign, comment) — not one row per tick forever,
+ # and not one row per foreign home per tick on a shared board (#101015).
if not dry_run:
with _kb.write_txn(conn):
- _kb._append_event(conn, task_id, "skipped_nonspawnable", {"assignee": assignee})
+ last = conn.execute(
+ "SELECT kind, payload FROM task_events WHERE task_id = ? "
+ "ORDER BY created_at DESC, id DESC LIMIT 1", (task_id,)).fetchone()
+ if (last is None or last["kind"] != "skipped_nonspawnable"
+ or last["payload"] != _kb._json_or_null({"assignee": assignee})):
+ _kb._append_event(conn, task_id, "skipped_nonspawnable", {"assignee": assignee})
return False
# Per-profile cap: one profile's local model / API quota / browser pool
# must not be overwhelmed by a fan-out even with global headroom.
diff --git a/tests/hermes_cli/test_kanban_dispatch_unknown_assignee_event.py b/tests/hermes_cli/test_kanban_dispatch_unknown_assignee_event.py
index 199403f061f..8eae0b340d5 100644
--- a/tests/hermes_cli/test_kanban_dispatch_unknown_assignee_event.py
+++ b/tests/hermes_cli/test_kanban_dispatch_unknown_assignee_event.py
@@ -40,14 +40,18 @@ def test_unknown_assignee_skip_writes_per_task_event(tmp_path, monkeypatch):
assert isinstance(matches[0], dict) and matches[0].get("assignee") == "no-such-profile"
-def test_unknown_assignee_dry_run_writes_no_event(tmp_path, monkeypatch):
- """Dry-run dispatch must not write rows — bucket only, no event."""
+def test_unknown_assignee_skip_event_is_written_once(tmp_path, monkeypatch):
+ """The condition never expires on its own: repeated ticks must not append a
+ row each (one per minute forever; one per foreign home on a shared board),
+ and a dry-run tick writes nothing."""
_isolated_home(tmp_path, monkeypatch)
from hermes_cli import profiles
monkeypatch.setattr(profiles, "profile_exists", lambda name: False)
with kbc.connect() as conn:
tid = kb.create_task(conn, title="demo", assignee="no-such-profile")
- res = kbd.dispatch_once(conn, dry_run=True)
+ kbd.dispatch_once(conn, dry_run=True)
+ assert "skipped_nonspawnable" not in [e.kind for e in kb.list_events(conn, tid)]
+ for _ in range(3):
+ kbd.dispatch_once(conn, dry_run=False)
kinds = [e.kind for e in kb.list_events(conn, tid)]
- assert res.skipped_nonspawnable == [tid]
- assert "skipped_nonspawnable" not in kinds
+ assert kinds.count("skipped_nonspawnable") == 1