feat(kanban): auto-subscribe origin conversation on kanban_create - #29984
feat(kanban): auto-subscribe origin conversation on kanban_create#29984TheoLong wants to merge 1 commit into
Conversation
The kanban_notify_subs table + gateway notifier already deliver terminal
events (completed/blocked/gave_up) every 5s to subscribed (platform,
chat, thread) tuples. The /kanban create slash command and the dashboard
toggle both wire this up. The kanban_create *tool* (used by orchestrator
and worker agents to fan out child cards) did not — so workspaces spawned
from a Discord thread had no way back to that thread without a per-thread
cron polling the board.
Now: at task-creation time, resolve the originating conversation in two
steps and write notify subscriptions atomically with the task.
1. Live gateway session — gateway.session_context exposes the
platform/chat/thread the user is in via contextvars (mirrored to
HERMES_SESSION_* env). When present, that's the origin.
2. Parent task inheritance — when a kanban worker (HERMES_KANBAN_TASK
set) creates child cards, copy the parent's subs to the child.
The originating conversation thus stays the durable manager of
its whole subtree, not just the first hop.
Failures in auto-subscribe never break task creation. The notify_subs
UNIQUE (task, platform, chat, thread) constraint makes retries safe.
Tests cover: live Discord thread, channel-root (no thread), no-origin
CLI usage (silent), worker fan-out inheritance, live-session-wins-over-
parent, and idempotency on duplicate-create.
3594e90 to
f294629
Compare
|
Rebased on current Re competing PR #28720 and the "8th+ attempt" / #19718 → revert #19721 history flagged by automation: would value any pointer to the maintainer concern that keeps killing these. Happy to address it directly here rather than file another iteration. Bumping for review. |
|
Closing as superseded. The kanban_create auto-subscribe feature landed on The one piece not covered upstream is parent-task subscription inheritance (worker fan-out: child cards inherit the parent's notify subs so the origin thread manages the whole subtree). I'll re-offer just that delta as a focused follow-up on top of the merged feature rather than keep this whole-feature PR open. Thanks! |
Problem
When an agent running inside a gateway session calls
kanban_create, the originating conversation (Discord thread, Telegram topic, Slack thread, etc.) doesn't get notified when the task reaches a terminal state. Users have to manually/kanban notify-subscribefor the common case of "agent in chat spawns a task and wants to be told when it's done."Change
Auto-subscribe the originating conversation on task create. Resolution order:
HERMES_SESSION_*env vars (gateway-injected) — preferredUNIQUE constraint at the DB layer makes the operation idempotent.
Test
7 tests in
tests/tools/test_kanban_tools.pypin the rules: live-session-wins-over-parent, idempotency, no-op without session, worker-fanout inheritance.Risk
Low-medium. New behaviour only fires when the session vars are present (gateway-managed runs). CLI usage is unchanged.