fix: auto-subscribe on CLI kanban create + check SendResult in notifier - #45940
fix: auto-subscribe on CLI kanban create + check SendResult in notifier#45940hannes-x wants to merge 3 commits into
Conversation
…on_subprocess_env() - Added build_session_subprocess_env() in gateway/session_context.py - Replaced inline ContextVar injection in _make_run_env (local.py) with new helper - Key fix: old code skipped empty ContextVar values (treated '' same as _UNSET), causing fallback to stale os.environ. New helper respects explicit empty values and only falls back to os.environ when ContextVar is truly unset.
…elivery failures adapter.send() returns SendResult(success=False, error=...) for silent failures (thread not found, channel not found, etc.) without raising exceptions. The notifier ignored the return value, logged 'delivered', and removed the subscription — leaving the user with no notification and no way to recover. Now we check result.success and raise RuntimeError on failure, which is caught by the existing except block that handles rewinding and failure counting correctly.
|
Verification review — reviewed the diff across all 4 files.
All changes look correct. No issues found. |
…dResult tests - Add --subscribe-platform/chat-id/thread-id/user-id to - Explicit params take priority over env-based auto-subscribe - Subscription status reported in create output - Fix all existing notifier tests to return SendResult(success=True) - Add tests for SendResult(success=False), mixed subs, adapter exception
…bump base-tag NousResearch#44338 was closed administratively (fork CI gating), not merged, so the manifest's default "auto-retire when the PR lands in a release" rule can never fire for this row — and the only strictly-weaker alternative PR (NousResearch#45940, detection-only) would regress the keep-alive and backoff behaviors if the carry were dropped on its merge. Rewrite the NousResearch#44338 row's retire trigger to be behavior-keyed: retire only when upstream gateway/kanban_watchers.py implements ALL of (i) SendResult failure-detection, (ii) keep-subscription-alive-on-permanent-failure, and (iii) bounded exponential backoff. Watch NousResearch#45940 and NousResearch#46443 but do not drop on NousResearch#45940 merge alone. Update the port-location note to the post-refactor home (GatewayKanbanWatchersMixin in gateway/kanban_watchers.py) and bump the row's base-tag to v2026.6.19. Add a "per-row override" caveat to the global Auto-retire rule so a future rebaser does not naively apply the PR-merge rule to a behavior-keyed row.
Kanban workers spawned by _default_spawn inherit os.environ but not the gateway's ContextVar session state (HERMES_SESSION_PLATFORM/CHAT_ID/ THREAD_ID). Workers therefore have no originating thread context, causing send_message calls to post as new root messages instead of replying in the correct thread. Add build_session_subprocess_env() to gateway/session_context.py (mirrors the approach in upstream PR NousResearch#45940). Overlay the current ContextVar values onto the base env dict before handing it to Popen. The try/except ImportError guard keeps the standalone CLI and test environments working unchanged. Workers now inherit HERMES_SESSION_PLATFORM, HERMES_SESSION_CHAT_ID, and HERMES_SESSION_THREAD_ID, enabling send_message to auto-target the originating Mattermost/Telegram/Discord thread without requiring the thread_id to be baked into the kanban brief.
|
Thanks for identifying the silent notifier-failure path. The notifier portion still addresses a real current-main defect: Problems
Suggested changes
Automated hermes-sweeper review. |
Kanban workers spawned by _default_spawn inherit os.environ but not the gateway's ContextVar session state (HERMES_SESSION_PLATFORM/CHAT_ID/ THREAD_ID). Workers therefore have no originating thread context, causing send_message calls to post as new root messages instead of replying in the correct thread. Add build_session_subprocess_env() to gateway/session_context.py (mirrors the approach in upstream PR NousResearch#45940). Overlay the current ContextVar values onto the base env dict before handing it to Popen. The try/except ImportError guard keeps the standalone CLI and test environments working unchanged. Workers now inherit HERMES_SESSION_PLATFORM, HERMES_SESSION_CHAT_ID, and HERMES_SESSION_THREAD_ID, enabling send_message to auto-target the originating Mattermost/Telegram/Discord thread without requiring the thread_id to be baked into the kanban brief.
|
Closing — both halves are now covered on main: the SendResult(success=False) check landed earlier (rewind-on-soft-fail in the notifier), and CLI auto-subscribe-on-create is tracked by #50972's scope. Your report of the silent notifier-failure path was accurate and corroborated the reliability work that landed via #72236. Thanks! |
Summary
Two related kanban notification fixes:
1. Auto-subscribe on CLI
kanban createhermes kanban createinvoked via CLI did not auto-subscribe the caller. Added auto-subscribe to_cmd_createusingget_session_env().build_session_subprocess_env()ingateway/session_context.py_make_run_envwith new helper_cmd_createinhermes_cli/kanban.py2. Check SendResult.success in notifier
The notifier called
adapter.send()but ignored the returnedSendResult. Silent failures (thread not found, etc.) were treated as success — the notifier logged 'delivered', removed the subscription, and the user never received notifications.result.successafteradapter.send()RuntimeErroron failure, caught by existing except block for proper rewindingTest Plan
hermes kanban createauto-subscribes correctlySendResult(success=False)by rewinding instead of deleting subscription