Daemon double-dispatches event workers (YAML events block + seeded registry trigger both fire) #24

Closed
opened 2026-08-19 19:49:38 +00:00 by Mark · 0 comments
Owner

Symptom

Every Vikunja webhook event fires the dispatched worker twice. Ledger on unstable shows paired runs at identical timestamps (verified 2026-08-19, e.g. runs 9d526db3/e0833fa5 at 2026-08-19T15:28:05 both executing vikunja-webhook-to-kanban.sh for the same event).

Root cause

The vikunja endpoint in daemon.unstable.yaml has an "events:" block (task.created/updated/deleted/completed → vikunja-webhook-to-kanban.sh). Two dispatch paths fire for each event:

  1. AsyncDispatchWorkerStep — legacy YAML action-chain dispatch reads the events mapping and fires the script.
  2. RegistryDispatchStep — _seed_yaml_base() in automation_registry.py seeds a yaml-origin registry trigger for the same (source, event_type, script) tuple at startup, and the registry step fires it again.

Idempotency-key on card creation prevents duplicate kanban cards, but every event burns two worker processes and writes two ledger rows. Same pattern likely affects the forgejo endpoint's events mappings too.

Fix direction

Pick one path explicitly (documented in org-subscriber-daemon skill, double-dispatch pitfall): either the YAML events block dispatches and the seed skips scripts already covered by a YAML action-chain mapping, or the events block is removed and only the registry trigger fires. Seed-skip is preferred — keeps YAML as the static default while the registry stays free for runtime-managed triggers.

Evidence

  • Ledger: SELECT run_id, worker, created_at FROM runs WHERE worker='vikunja-webhook-to-kanban.sh' ORDER BY rowid DESC — pairs at identical timestamps.
  • Registry: 4 yaml-origin triggers vikunja-task.{created,updated,deleted,completed}.
  • daemon.unstable.yaml vikunja endpoint events: block with the same four mappings.
## Symptom Every Vikunja webhook event fires the dispatched worker twice. Ledger on unstable shows paired runs at identical timestamps (verified 2026-08-19, e.g. runs 9d526db3/e0833fa5 at 2026-08-19T15:28:05 both executing vikunja-webhook-to-kanban.sh for the same event). ## Root cause The vikunja endpoint in daemon.unstable.yaml has an "events:" block (task.created/updated/deleted/completed → vikunja-webhook-to-kanban.sh). Two dispatch paths fire for each event: 1. AsyncDispatchWorkerStep — legacy YAML action-chain dispatch reads the events mapping and fires the script. 2. RegistryDispatchStep — _seed_yaml_base() in automation_registry.py seeds a yaml-origin registry trigger for the same (source, event_type, script) tuple at startup, and the registry step fires it again. Idempotency-key on card creation prevents duplicate kanban cards, but every event burns two worker processes and writes two ledger rows. Same pattern likely affects the forgejo endpoint's events mappings too. ## Fix direction Pick one path explicitly (documented in org-subscriber-daemon skill, double-dispatch pitfall): either the YAML events block dispatches and the seed skips scripts already covered by a YAML action-chain mapping, or the events block is removed and only the registry trigger fires. Seed-skip is preferred — keeps YAML as the static default while the registry stays free for runtime-managed triggers. ## Evidence - Ledger: SELECT run_id, worker, created_at FROM runs WHERE worker='vikunja-webhook-to-kanban.sh' ORDER BY rowid DESC — pairs at identical timestamps. - Registry: 4 yaml-origin triggers vikunja-task.{created,updated,deleted,completed}. - daemon.unstable.yaml vikunja endpoint events: block with the same four mappings.
Mark 2026-08-19 19:49:38 +00:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No description provided.