fix(gateway): preserve kanban notifier chat type - #58615
Conversation
|
teknium1
left a comment
There was a problem hiding this comment.
Thanks for carrying the source lane through the notifier path. The premise is confirmed on current main: gateway/kanban_watchers.py:517-537 documents the missing provenance and hardcodes the wake source to chat_type="group".
Problems
hermes_cli/kanban.py:2439-2444is a sibling notification-subscription writer that still supplies no chat type. A manually created DM subscription would remain NULL and hit this PR'sgroupfallback ingateway/kanban_watchers.py.- The new gateway bridge in
gateway/run.pyis not directly covered:tests/gateway/test_kanban_notifier.pysets the ContextVar directly, whiletests/gateway/test_session_env.py:33-72does not assertHERMES_SESSION_CHAT_TYPEfrom_set_session_env().
Suggested changes
- Add and thread a
--chat-typevalue throughhermes kanban notify-subscribe, with a DM wake regression test. - Add set-and-clear assertions for
HERMES_SESSION_CHAT_TYPEthrough_set_session_env().
This is an automated hermes-sweeper review.
| return set_session_vars( | ||
| platform=context.source.platform.value, | ||
| chat_id=context.source.chat_id, | ||
| chat_type=( |
There was a problem hiding this comment.
Please add a direct regression assertion through _set_session_env(): the notifier test sets this ContextVar directly, so it would not catch this production bridge being omitted or cleared incorrectly.
|
Merged via PR #72191 — your commit was cherry-picked onto current main with your authorship preserved in git log (05ab059). Your implementation won the arbitration among four competing PRs for this bug: earliest submission and the only one that fixed the auto-subscribe path end-to-end (ContextVar bridge + gateway stamp + schema with self-heal backfill), not just the slash-command site. Nice work. |
Both the wake chat-scope salvage (#72191, merged) and the DM-topic metadata salvage added HERMES_SESSION_CHAT_TYPE plumbing; the rebase auto-merge kept both copies. Dedupe the ContextVar declaration, _VAR_MAP entry, set_session_vars parameter/token, and the run.py call-site kwarg, and prefer the persisted chat_type column with delivery_metadata as the legacy fallback in the notifier wake path.
with NousResearch#60769 Both the wake chat-scope salvage (NousResearch#72191, merged) and the DM-topic metadata salvage added HERMES_SESSION_CHAT_TYPE plumbing; the rebase auto-merge kept both copies. Dedupe the ContextVar declaration, _VAR_MAP entry, set_session_vars parameter/token, and the run.py call-site kwarg, and prefer the persisted chat_type column with delivery_metadata as the legacy fallback in the notifier wake path.
Summary
chat_typeonkanban_notify_subs, including legacy-table migration and rebuild specs.HERMES_SESSION_CHAT_TYPEthrough gateway session context sokanban_createauto-subscriptions record the source lane.SessionSourcewith the subscription's persistedchat_type, falling back togroupfor old rows.Root Cause
Kanban notifications delivered the text message to the subscribed chat, but the follow-up agent wakeup hardcoded
chat_type="group". For DM-originated tasks, Hermes created or woke a synthetic group session instead of the PM's real DM session, so the PM often never saw the coder/QA completion in the active lane.Tests
PYTHONPATH=/tmp/hermes-pytest-deps:. /home/ubuntu/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_kanban_notifier.py -qPYTHONPATH=/tmp/hermes-pytest-deps:. /home/ubuntu/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_session_env.py tests/gateway/test_session_context_inheritance.py tests/gateway/test_async_delivery_capability.py -q/home/ubuntu/.hermes/hermes-agent/venv/bin/python -m py_compile hermes_cli/kanban_db.py gateway/session_context.py gateway/kanban_watchers.py tools/kanban_tools.py gateway/slash_commands.py gateway/run.py tests/gateway/test_kanban_notifier.pyPYTHONPATH=/tmp/hermes-pytest-deps:. /home/ubuntu/.hermes/hermes-agent/venv/bin/python -m ruff check hermes_cli/kanban_db.py gateway/session_context.py gateway/kanban_watchers.py tools/kanban_tools.py gateway/slash_commands.py gateway/run.py tests/gateway/test_kanban_notifier.py