Skip to content

feat(kanban): auto-subscribe on create/assign, SIGUSR1 dispatcher wake, claimed event - #22190

Closed
jrhouston-trilogy wants to merge 1 commit into
NousResearch:mainfrom
jrhouston-trilogy:feat/kanban-auto-notify-routes
Closed

feat(kanban): auto-subscribe on create/assign, SIGUSR1 dispatcher wake, claimed event#22190
jrhouston-trilogy wants to merge 1 commit into
NousResearch:mainfrom
jrhouston-trilogy:feat/kanban-auto-notify-routes

Conversation

@jrhouston-trilogy

Copy link
Copy Markdown

Summary

Production audit by EVE (Hermes agent, 2026-05-08) identified two notification gaps:

  1. hermes kanban create never auto-subscribed the assignee — callers had to wrap every create with a helper script that duplicated a profile→platform map.
  2. The only notification events were terminal (completed/blocked/gave_up/crashed/timed_out). Tasks that ran for >30s gave zero signal that work had started.

Additionally, the dispatcher's 60s tick interval meant up to 60s latency between task creation and worker spawn.

Changes

P1 — CLI auto-subscribe (hermes_cli/kanban.py)

  • Added _load_notify_routes() — loads ~/.hermes/kanban/notify-routes.yaml
  • Added _auto_subscribe_from_routes() — looks up assignee route and calls kb.add_notify_sub
  • Called from _cmd_create and _cmd_assign after successful DB write
  • Missing route = silent no-op. Bad route = stderr warning. Subscribe failure = stderr warning, no crash.

P2 — SIGUSR1 dispatcher wake (gateway/run.py)

  • Added asyncio event _dispatch_wake wired to a SIGUSR1 handler
  • Dispatcher tick now wakes immediately on SIGUSR1 instead of waiting up to dispatch_interval_seconds
  • Degrades gracefully on Windows/platforms without signal support

P3 — claimed notification event (kanban_db.py, gateway/run.py)

  • claim_task() now appends a claimed event with the claimer ID
  • Notifier watches claimed in addition to terminal kinds (via NOTIFY_KINDS)
  • Delivers ▶ Kanban <id> started by @<profile> — <title> message
  • claimed is NOT terminal — subscriptions are preserved after delivery

P4 — Tests (tests/hermes_cli/test_kanban_notify_routes.py)

  • notify-routes.yaml loaded correctly
  • Missing route = no subscribe attempt
  • Bad route (missing chat_id) = warning, not crash
  • Subscribe failure = no exception propagated

Notes

  • notify-routes.yaml schema is unchanged from the user-space prototype
  • The SIGUSR1 helper in user scripts was already best-effort no-op; this makes it live
  • No breaking changes to existing CLI surface

…e, claimed event

- P1: CLI auto-subscribe via notify-routes.yaml helpers
  - _load_notify_routes(): Load routes from ~/.hermes/kanban/notify-routes.yaml
  - _auto_subscribe_from_routes(): Subscribe assignee to task if route exists
  - Auto-call from _cmd_create and _cmd_assign after successful assignment

- P2: SIGUSR1 dispatcher wake in gateway/run.py
  - Added asyncio.Event (_dispatch_wake) wired to SIGUSR1 handler
  - Dispatcher tick now wakes immediately on signal instead of waiting full interval
  - Degrades gracefully on Windows/unsupported platforms

- P3: 'claimed' notification event
  - kanban_db.claim_task() already appends 'claimed' event with claimer info
  - Updated _kanban_notifier_watcher to deliver 'claimed' events
  - 'claimed' is NOT terminal - subscriptions preserved after delivery

- P4: Tests for notify-routes auto-subscribe behavior
  - test_load_routes_valid: YAML loading
  - test_missing_route_no_subscribe: Silent no-op for missing routes
  - test_bad_route_missing_chat_id_no_crash: Warning on malformed routes
  - test_subscribe_failure_no_raise: Exception handling

Fixes: EVE audit findings on kanban notification gaps
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery labels May 9, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks @jrhouston-trilogy — closing this one. Status of the three pieces:

  • P3 (claimed event) is already landed on main: hermes_cli/kanban_db.py:2091 appends the claimed event in claim_task() and the notifier picks it up.
  • P2 (SIGUSR1 dispatcher wake) conflicts with main's existing use of SIGUSR1 for graceful gateway restart. A different signal (or an explicit IPC channel) would be needed; that's a design discussion rather than a salvage.
  • P1 (auto-subscribe via notify-routes.yaml) introduces a new YAML schema and a profile→platform map. The kanban subsystem already has add_notify_sub and gateway-create auto-subscribe (feat(kanban): auto-subscribe gateway chat on tool-driven kanban_create #19718/follow-ups landed) covers the chat-id origin path. A YAML-based assignee→route lookup would still be useful for headless CLI flows, but it deserves a focused PR with the schema and merge-with-existing-mechanisms questions answered.

If you want to revive P1 as a fresh, focused PR against current main, happy to take another look. Appreciate the audit and contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants