Skip to content

feat(kanban): auto-subscribe origin conversation on kanban_create - #29984

Closed
TheoLong wants to merge 1 commit into
NousResearch:mainfrom
TheoLong:upstream/kanban-auto-subscribe-origin
Closed

feat(kanban): auto-subscribe origin conversation on kanban_create#29984
TheoLong wants to merge 1 commit into
NousResearch:mainfrom
TheoLong:upstream/kanban-auto-subscribe-origin

Conversation

@TheoLong

Copy link
Copy Markdown

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-subscribe for 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:

  1. Live HERMES_SESSION_* env vars (gateway-injected) — preferred
  2. Parent task's subscriptions (worker-fanout case — child inherits)
  3. No-op (CLI usage with no originating conversation — silent on purpose)

UNIQUE constraint at the DB layer makes the operation idempotent.

Test

7 tests in tests/tools/test_kanban_tools.py pin 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.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins labels May 21, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Note: competing open PR #28720 implements the same kanban_create auto-subscribe feature. This is the 8th+ attempt (original #19718 merged then reverted by #19721).

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.
@TheoLong
TheoLong force-pushed the upstream/kanban-auto-subscribe-origin branch from 3594e90 to f294629 Compare June 8, 2026 06:51
@TheoLong

TheoLong commented Jun 8, 2026

Copy link
Copy Markdown
Author

Rebased on current main (1,824 commits absorbed). Carry still applies cleanly — tools/kanban_tools.py and tests/tools/test_kanban_tools.py, additive.

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.

@TheoLong

Copy link
Copy Markdown
Author

Closing as superseded.

The kanban_create auto-subscribe feature landed on main via f8d8f045f — a config-gated implementation (kanban.auto_subscribe_on_create) with TUI/desktop support, strictly more complete than this carry.

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!

@TheoLong TheoLong closed this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins 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.

2 participants