Skip to content

feat(kanban): config-gated auto-subscribe on kanban_create (salvage #28720) - #48635

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-0f8a2d57
Jun 18, 2026
Merged

feat(kanban): config-gated auto-subscribe on kanban_create (salvage #28720)#48635
teknium1 merged 1 commit into
mainfrom
hermes/hermes-0f8a2d57

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

kanban_create now auto-subscribes the calling session to the new task's completion/block events, gated by a new kanban.auto_subscribe_on_create flag (default true). Salvage of #28720 (@flooryyyy), cherry-picked onto current main with authorship preserved.

Priority note: This touches a narrow, opt-in surface — only dispatcher-spawned workers and profiles that have explicitly enabled the kanban toolset ever see kanban_create. Ordinary chat sessions (hermes chat, Telegram, Discord, TUI) get zero kanban tools, so the blast radius is small. This is a low-priority area; future kanban-notification PRs should expect a 1+ month review/merge turnaround.

Behavior

  • Auto-subscribe fires only from a session with a persistent delivery channel:
    • Gateway: HERMES_SESSION_PLATFORM + HERMES_SESSION_CHAT_ID set → row keyed to that chat.
    • TUI/desktop: platform/chat_id cleared, but HERMES_SESSION_KEY exported → platform="tui", chat_id=<key>.
    • CLI / cron / test: no channel → no-op, subscribed=false.
  • kanban.auto_subscribe_on_create=false suppresses it entirely (mirrors the post-revert: auto-subscribe gateway chat on tool-driven kanban_create (#19718) #19721 state; orchestrators call kanban_notify-subscribe explicitly).
  • add_notify_sub failures are logged at WARNING and swallowed — a bookkeeping failure never fails the parent kanban_create. Response carries subscribed: bool so an orchestrator can fall back to explicit subscribe or polling.

Changes

  • tools/kanban_tools.py: _maybe_auto_subscribe(), wired into _handle_create, subscribed in the response.
  • hermes_cli/config.py: kanban.auto_subscribe_on_create in DEFAULT_CONFIG.
  • tests/tools/test_kanban_tools.py: 6 tests + 2 helpers.
  • website/docs/user-guide/features/kanban.md + zh-Hans mirror: config-knob row.

Validation

Result
tests/tools/test_kanban_tools.py 90/90 pass
E2E (real imports, isolated HERMES_HOME) gateway → subscribed=True + row written; CLI → subscribed=False, no row

Closes #28720.

Infographic

kanban-auto-subscribe-on-create

When a worker calls kanban_create from inside a session that has a
persistent delivery channel, the originating session is now subscribed
to the new task's completion/block events automatically. The agent
that dispatched the task gets notified instead of having to poll.

- Gateway sessions (telegram/discord/slack): HERMES_SESSION_PLATFORM +
  HERMES_SESSION_CHAT_ID ContextVars, set by the messaging gateway.
- TUI / desktop sessions: HERMES_SESSION_KEY in the subprocess env.
  The TUI notification poller keys on platform='tui' + chat_id=<key>.
- CLI / cron / test: no persistent channel, no subscription.

Gated by kanban.auto_subscribe_on_create in config.yaml (default True).
Disable to mirror pre-feature behaviour — users who want explicit
kanban_notify-subscribe calls per task can set it to false. This
config gate addresses the design concern that got PR #19718 reverted
upstream (unconditional implicit auto-subscribe on tool-driven
kanban_create was too aggressive for orchestrator users).

HERMES_SESSION_ID is intentionally not a fallback channel — it is
set by ACP/agent subprocess telemetry for every invocation, not just
TUI, so treating it as a notification target would auto-subscribe
every CLI session and re-introduce the over-eager behaviour.

The kanban_create response now includes a 'subscribed' bool so
orchestrators can react if subscription failed (e.g. by falling
back to explicit kanban_notify-subscribe or to polling).

Includes 6 tests covering the gateway / TUI / CLI / partial-context /
gated / add_notify_sub-failure paths. All 90 tests in
test_kanban_tools.py pass; 509 broader kanban tests pass.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-0f8a2d57 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 11030 on HEAD, 11030 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5781 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have labels Jun 18, 2026
@teknium1
teknium1 merged commit f8d8f04 into main Jun 18, 2026
35 checks passed
@teknium1
teknium1 deleted the hermes/hermes-0f8a2d57 branch June 18, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management 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