feat(kanban): config-gated auto-subscribe on kanban_create with TUI support - #28720
feat(kanban): config-gated auto-subscribe on kanban_create with TUI support#28720flooryyyy wants to merge 1 commit into
Conversation
|
Open competing PR: #28331 also includes auto-subscribe on create. Maintainer should decide whether the revert+replacement in #19721/#19864 was a deliberate design choice or if this approach is now acceptable. |
|
i think it would be significantly beneficial to have agents auto-subscribe to kanban tasks if they're the ones dispatching it. maybe config.yaml option for changing this behaviour? previous attempts shows demand. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused patch. I verified the premise against current main, and the missing behavior is real in the narrow sense: tools/kanban_tools.py:795 creates a task and currently returns only task_id/status, while /kanban create still has its own auto-subscribe path at gateway/slash_commands.py:349.
Problems
- This exact design was deliberately reverted. Commit 3fb3552 says tool-driven kanban_create should not mirror the slash-command path and that orchestrators should subscribe explicitly instead. PR #19864 then replaced the reverted implicit behavior with explicit dashboard home-channel toggles.
- The PR adds unconditional implicit subscription but no config gate. The PR discussion mentions a possible config.yaml option; AGENTS.md:102 says behavioral settings should live in config.yaml, not as implicit/uncontrolled behavior.
- There are no regression tests in the diff. Current tests/tools/test_kanban_tools.py has no coverage for _maybe_auto_subscribe, gateway session context, partial context, or no-op CLI sessions.
Suggested changes
- If maintainers want to revisit this behavior, make the implicit subscription an explicit config.yaml-controlled option rather than always-on.
- Add tests for gateway context subscribe, CLI/no-context no-op, partial context no-op, and notifier_profile/board correctness.
- Consider returning a subscribed boolean, as #19718 did, so the calling agent can tell whether the subscription was created.
This is an automated hermes-sweeper review.
| @@ -654,6 +654,11 @@ def _handle_create(args: dict, **kw) -> str: | |||
| created_by=os.environ.get("HERMES_PROFILE") or "worker", | |||
There was a problem hiding this comment.
This makes tool-driven kanban_create implicitly subscribe again, but commit 3fb3552 explicitly reverted that behavior. If this is revived, it likely needs an explicit config.yaml gate rather than unconditional behavior.
| @@ -667,6 +672,35 @@ def _handle_create(args: dict, **kw) -> str: | |||
| return tool_error(f"kanban_create: {e}") | |||
There was a problem hiding this comment.
Silently swallowing every exception makes subscription failures impossible to diagnose. If this remains best-effort, log at debug with exc_info=True like the earlier #19718 implementation did.
|
forgot to sync local changes to this PR. will update soon |
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 NousResearch#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.
9d78ba4 to
5ce8f3c
Compare
|
Rewrote this from scratch in response to the review feedback (and the #19718 → #19721 → #19864 history). Both blocking concerns addressed: 1. Unconditional behaviour (your Issue 1) Added 2. Silent exception swallowing (your Issue 2) Replaced A few things added beyond the original PR while I was in there:
Diff: |
|
i've tried pinging teknium and mentioning this PR in the discord but i was met with radio silence. i've brought this PR up to date with my local changes and i'd additionally add an arg to let the agent control subscriptions on the fly in cases where the agent knows when to subscribe vs not, however with no constructive feedback i can not do anything and therefore i don't think i will contribute in the future seen as this PR has been completely ignored for over a month i understand everyone is busy, however it is not nice being on the other end either. even a simple "too busy at the moment" would be better than me chasing someone to look at my contribution. i imagine it wouldn't be hard just re-running the sweeper bot either i'm still ok with finishing this PR and getting it merged but it's my last unless the contribution system improves in the future cc: @teknium1 @alt-glitch |
|
@daimon-nous review this please! |
|
Code is clean and the two prior sweeper blockers (config gate + logged exceptions) are genuinely addressed. The remaining question is a design/taste call that belongs to @teknium1, plus two technical items below. I verified everything against current Premise — confirmed real
The design decision (for the maintainer, not automatable)This exact behavior was deliberately reverted in Technical:
|
|
Merged via PR #48635 — your commit was cherry-picked onto current Thanks for the rewrite addressing the config gate and the TUI fallback path — both landed as-is. The 6 new tests and docs (EN + zh-Hans) all came across. One heads-up on cadence so expectations are calibrated: kanban auto-notification is a low-priority area for us. The tool surface here is narrow and opt-in (only dispatcher-spawned workers and profiles that have explicitly enabled the |
Summary
kanban_createnow auto-subscribes the calling session to completion / block events for the new task, but only when the call has a persistent delivery channel. Gated by a newkanban.auto_subscribe_on_createconfig flag (defaulttrue).This is a rewrite of the original 1-commit / 34-line proposal in response to the review feedback on the previous version (and the prior history of #19718 → #19721 → #19864). Both blocking concerns are addressed.
What changed
kanban.auto_subscribe_on_createin~/.hermes/config.yaml(defaulttrue). Users who want explicitkanban_notify-subscribecalls per task can set it tofalse. This is what the prior reviewer flagged as the blocker, and the design call that originally got feat(kanban): auto-subscribe gateway chat on tool-driven kanban_create #19718 reverted.except: pass. The notify sub write is still swallowed at the boundary (a bookkeeping failure must never fail akanban_createmid-conversation) but the failure is no longer invisible. The parent create still succeeds withsubscribed=False.HERMES_SESSION_KEYto subprocesses. We write a row withplatform="tui" + chat_id=<session_key>for the TUI notification poller. Real local bug from deployed integration, was missing from the original PR.HERMES_SESSION_IDis not a fallback channel on purpose. It is set by ACP for telemetry regardless of CLI / TUI parent, so using it as a notification target would auto-subscribe every CLI invocation. That re-introduces the over-eager behaviour that got feat(kanban): auto-subscribe gateway chat on tool-driven kanban_create #19718 reverted.subscribed: boolin thekanban_createresponse so orchestrators can fall back to explicitkanban_notify-subscribeor to polling when the sub fails.upstream/main. Was 2981 commits behind.Subscription paths
HERMES_SESSION_PLATFORM+HERMES_SESSION_CHAT_IDContextVars setplatform=<gateway>,chat_id=<chat_id>HERMES_SESSION_KEYin env, platform / chat_id ContextVars emptyplatform="tui",chat_id=<session_key>Tests
6 new tests in
tests/tools/test_kanban_tools.py:test_create_subscribes_gateway_sessiontest_create_subscribes_tui_session_via_session_keytest_create_does_not_subscribe_in_cli_sessiontest_create_respects_auto_subscribe_on_create_falsetest_create_partial_session_context_no_subscribetest_maybe_auto_subscribe_swallows_add_notify_sub_failureAll 90 tests in the file pass. 509 broader kanban tests pass. Real-import, real-DB tests with
HERMES_HOMEisolation per the project conftest pattern.Files changed
tools/kanban_tools.py: added_maybe_auto_subscribe(), wired into_handle_create, addedsubscribedto the response.hermes_cli/config.py: addedkanban.auto_subscribe_on_createtoDEFAULT_CONFIG.tests/tools/test_kanban_tools.py: 6 new tests plus 2 helpers.website/docs/user-guide/features/kanban.md: config knob table row.website/i18n/zh-Hans/.../kanban.md: same row, translated.Diff:
+306 / -0across 5 files. New commit is5ce8f3cda.Open question for the maintainers
Is
feat/kanban-standingthe right long-term home for_maybe_auto_subscribe, or should it stay intools/kanban_tools.pyfor parity with the slash-command path? Happy to move it.