revert: auto-subscribe gateway chat on tool-driven kanban_create (#19718) (#19721)

Reverts ff3d2773e2. Teknium reviewed the merged PR and decided this
behavior isn't wanted — tool-driven kanban_create should not mirror
the slash-command path's auto-subscribe. Orchestrators that want
their originating chat notified can call kanban_notify-subscribe
explicitly; we're not going to make it implicit.
This commit is contained in:
Teknium 2026-05-04 05:04:01 -07:00 committed by GitHub
parent 25b7b0f8e6
commit 3fb35520c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 130 deletions

View file

@ -380,40 +380,10 @@ def _handle_create(args: dict, **kw) -> str:
skills=skills,
created_by=os.environ.get("HERMES_PROFILE") or "worker",
)
# Auto-subscribe the originating gateway source (if any) to the
# new task's terminal events. Mirrors the behavior of the
# `/kanban create` slash command in gateway/run.py so that
# tool-driven creation (orchestrator agents calling kanban_create)
# gets the same blocked/completed/gave_up notifications as human-
# driven creation. No-op in CLI / cron contexts where no gateway
# session context is active. See issue #19479.
subscribed = False
try:
from gateway.session_context import get_session_env
platform = get_session_env("HERMES_SESSION_PLATFORM")
chat_id = get_session_env("HERMES_SESSION_CHAT_ID")
thread_id = get_session_env("HERMES_SESSION_THREAD_ID") or None
user_id = get_session_env("HERMES_SESSION_USER_ID") or None
if platform and chat_id:
kb.add_notify_sub(
conn,
task_id=new_tid,
platform=platform,
chat_id=chat_id,
thread_id=thread_id,
user_id=user_id,
)
subscribed = True
except Exception:
# Subscription is best-effort; don't fail the whole create
# if the gateway context module isn't importable (e.g. in
# test rigs that stub out gateway.*).
logger.debug("kanban_create notify-sub skipped", exc_info=True)
new_task = kb.get_task(conn, new_tid)
return _ok(
task_id=new_tid,
status=new_task.status if new_task else None,
subscribed=subscribed,
)
finally:
conn.close()