fix(kanban): auto-subscribe on create via CLI and tool - #50972
Conversation
hermes kanban create (and the kanban_create model tool) advertised 'auto-subscribes you to events' but neither path actually called kb.add_notify_sub(...). As a result, orchestrator workers that filed follow-up tasks via the tool received no terminal-state notifications. Fix mirrors what the gateway's /kanban create slash command already does: - CLI: resolves a chat binding from explicit --auto-subscribe-* args, then HERMES_NOTIFY_* env vars (set by chat-bound shells), then HERMES_SESSION_* env vars (set by the agent subprocess). When none resolve, the create still succeeds with a stderr note pointing at notify-subscribe. Opt out via --no-auto-subscribe or --json. - Tool: already had _maybe_auto_subscribe; this PR documents the CLI parity, the escape hatches, and the config gate kanban.auto_subscribe_on_create in the kanban docs page. Tests: 6 new tests in tests/hermes_cli/test_kanban_core_functionality.py covering happy path (env binding), no-binding warning, --no-auto-subscribe opt-out, explicit args overriding env, --json skipping, and help-text pinning. Tool-side auto-subscribe already had 4 tests in tests/tools/test_kanban_tools.py (gateway / TUI / CLI / config gate). Full test_kanban_core_functionality.py passes (172/1sk), test_kanban_tools.py (90/0), test_kanban_db+notify+notifier (331 across the cluster). Refs t_d13282da.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the CLI/gateway mismatch. The current CLI path still creates a task without a notification row (hermes_cli/kanban.py:1328-1355), while the gateway handler already subscribes from event.source (gateway/slash_commands.py:450-481), so there is a real CLI-focused gap.
Problems
- The new CLI helper bypasses the existing
kanban.auto_subscribe_on_createopt-out: the PR inserts after target resolution (hermes_cli/kanban.py:1120-1132), while the tool checks the gate intools/kanban_tools.py:999-1001. The documented contract saysfalserequires explicit subscription (website/docs/user-guide/features/kanban.md:511). HERMES_NOTIFY_*has no in-tree producer on current main; existing chat-bound terminal subprocesses receiveHERMES_SESSION_*throughtools/environments/local.py:336-380. The new variables would become a user-facing behavioral env-var surface without an established runtime contract.
Suggested changes
- Honor
kanban.auto_subscribe_on_createin the CLI path and test that opt-out. - Reuse
HERMES_SESSION_*; drop the newHERMES_NOTIFY_*mechanism and its docs/repro unless maintainers explicitly want that public interface. - The tool portion is already present on main (
tools/kanban_tools.py:945;f8d8f045facce40351f8a34421764fe514c49c0b), so salvage only the CLI-specific behavior.
Automated hermes-sweeper review.
| return None | ||
| if getattr(args, "json", False): | ||
| return None | ||
| target = _resolve_auto_subscribe_target(args) |
There was a problem hiding this comment.
Please check kanban.auto_subscribe_on_create before resolving/inserting here. The existing tool honors this config gate (tools/kanban_tools.py:999-1001), and the documented contract says false requires explicit subscription; without it, a chat-bound CLI subprocess ignores the user's opt-out.
| # Names of env vars that a chat-bound shell (Telegram/Discord/Slack/... | ||
| # adapter) can set so the CLI knows which chat to subscribe. | ||
| _AUTO_SUB_ENV_VARS = ( | ||
| "HERMES_NOTIFY_PLATFORM", |
There was a problem hiding this comment.
There is no in-tree producer for HERMES_NOTIFY_* on current main. Chat-bound terminal subprocesses already receive HERMES_SESSION_* through tools/environments/local.py::_inject_session_context_env; please avoid adding a new user-facing behavioral HERMES_* convention here.
Summary
Fixes the gap where
hermes kanban create(and thekanban_createmodel tool) advertised "auto-subscribes you to events" but never actually calledkb.add_notify_sub(...). Subscriptions only got attached when something explicitly invokednotify-subscribe.The model tool's
_maybe_auto_subscribewas already wired up; this PR brings the bare CLI to parity and documents the behaviour.Changes
hermes_cli/kanban.py—_cmd_createnow resolves a chat binding (explicit--auto-subscribe-*args →HERMES_NOTIFY_*env vars →HERMES_SESSION_*env vars) and callskb.add_notify_subafterkb.create_task. New flags:--no-auto-subscribe— escape hatch for scripted creates--auto-subscribe-platform / --auto-subscribe-chat-id / --auto-subscribe-thread-id / --auto-subscribe-user-id— explicit overrides--jsonmode opts out (machine-output callers manage subs explicitly)When no binding is available the create still succeeds and a stderr note points the operator at
hermes kanban notify-subscribe. Two helper functions:_resolve_auto_subscribe_target(args)(pure) and_auto_subscribe_create(...)(side-effecting; logs+swallows on failure).tests/hermes_cli/test_kanban_core_functionality.py— 6 new tests:--no-auto-subscribeoverrides env--auto-subscribe-*overrides env--jsonskips auto-subscribe (parses output as JSON)website/docs/user-guide/features/kanban.md— new subsection documenting CLI/tool parity, the opt-out knobs, and the no-binding fallback.Test coverage
tests/hermes_cli/test_kanban_core_functionality.py— 172 passed, 1 skippedtests/tools/test_kanban_tools.py— 90 passed (auto-subscribe tests on the tool side were already in place)tests/hermes_cli/test_kanban_db.py + test_kanban_notify.py + tests/gateway/test_kanban_notifier.py + tests/plugins/test_kanban_dashboard_plugin.py— 102 passed across the clusterReproduction (post-fix)
Closes t_d13282da.