feat(kanban): config-gated auto-subscribe on kanban_create (salvage #28720) - #48635
Merged
Conversation
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.
Contributor
🔎 Lint report:
|
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kanban_createnow auto-subscribes the calling session to the new task's completion/block events, gated by a newkanban.auto_subscribe_on_createflag (defaulttrue). Salvage of #28720 (@flooryyyy), cherry-picked onto currentmainwith authorship preserved.Behavior
HERMES_SESSION_PLATFORM+HERMES_SESSION_CHAT_IDset → row keyed to that chat.HERMES_SESSION_KEYexported →platform="tui",chat_id=<key>.subscribed=false.kanban.auto_subscribe_on_create=falsesuppresses it entirely (mirrors the post-revert: auto-subscribe gateway chat on tool-driven kanban_create (#19718) #19721 state; orchestrators callkanban_notify-subscribeexplicitly).add_notify_subfailures are logged at WARNING and swallowed — a bookkeeping failure never fails the parentkanban_create. Response carriessubscribed: boolso an orchestrator can fall back to explicit subscribe or polling.Changes
tools/kanban_tools.py:_maybe_auto_subscribe(), wired into_handle_create,subscribedin the response.hermes_cli/config.py:kanban.auto_subscribe_on_createinDEFAULT_CONFIG.tests/tools/test_kanban_tools.py: 6 tests + 2 helpers.website/docs/user-guide/features/kanban.md+zh-Hansmirror: config-knob row.Validation
tests/tools/test_kanban_tools.pyHERMES_HOME)subscribed=True+ row written; CLI →subscribed=False, no rowCloses #28720.
Infographic