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

@ -610,103 +610,3 @@ def test_orchestrator_complete_any_task_allowed(monkeypatch, tmp_path):
out = kt._handle_complete({"task_id": tid, "summary": "orchestrator close"})
d = json.loads(out)
assert d.get("ok") is True and d.get("task_id") == tid
# ---------------------------------------------------------------------------
# kanban_create auto-subscribe to gateway notifications (#19479)
# ---------------------------------------------------------------------------
#
# When an orchestrator agent (running under the gateway) calls kanban_create,
# the originating (platform, chat, thread) should be auto-subscribed to the
# new task's terminal events — matching the /kanban create slash-command
# behavior in gateway/run.py. In CLI / cron contexts (no session vars set),
# no subscription row is written.
def test_create_no_subscribe_in_cli_context(worker_env):
"""Classic CLI: no gateway session vars -> no notify subscription."""
from tools import kanban_tools as kt
from hermes_cli import kanban_db as kb
out = kt._handle_create({"title": "cli task", "assignee": "peer"})
d = json.loads(out)
assert d.get("ok") is True
assert d.get("subscribed") is False
conn = kb.connect()
try:
assert kb.list_notify_subs(conn, d["task_id"]) == []
finally:
conn.close()
def test_create_auto_subscribes_in_gateway_context(worker_env):
"""Gateway session vars set -> auto-subscribe the originating source."""
from gateway.session_context import set_session_vars, clear_session_vars
from tools import kanban_tools as kt
from hermes_cli import kanban_db as kb
tokens = set_session_vars(
platform="telegram",
chat_id="1234567",
thread_id="42",
user_id="u_alice",
)
try:
out = kt._handle_create({"title": "gateway task", "assignee": "peer"})
d = json.loads(out)
assert d.get("ok") is True
assert d.get("subscribed") is True
conn = kb.connect()
try:
subs = kb.list_notify_subs(conn, d["task_id"])
finally:
conn.close()
assert len(subs) == 1
assert subs[0]["platform"] == "telegram"
assert subs[0]["chat_id"] == "1234567"
assert subs[0]["thread_id"] == "42"
assert subs[0]["user_id"] == "u_alice"
finally:
clear_session_vars(tokens)
def test_create_subscribe_without_thread_id(worker_env):
"""DM / no-thread platforms subscribe without a thread_id."""
from gateway.session_context import set_session_vars, clear_session_vars
from tools import kanban_tools as kt
from hermes_cli import kanban_db as kb
tokens = set_session_vars(platform="discord", chat_id="ch_dm_789")
try:
out = kt._handle_create({"title": "dm task", "assignee": "peer"})
d = json.loads(out)
assert d.get("subscribed") is True
conn = kb.connect()
try:
subs = kb.list_notify_subs(conn, d["task_id"])
finally:
conn.close()
assert len(subs) == 1
assert subs[0]["thread_id"] == ""
assert subs[0]["user_id"] is None
finally:
clear_session_vars(tokens)
def test_create_no_subscribe_when_chat_id_missing(worker_env):
"""Partial gateway context (platform but no chat_id) -> no subscription."""
from gateway.session_context import set_session_vars, clear_session_vars
from tools import kanban_tools as kt
from hermes_cli import kanban_db as kb
tokens = set_session_vars(platform="telegram", chat_id="")
try:
out = kt._handle_create({"title": "partial ctx", "assignee": "peer"})
d = json.loads(out)
assert d.get("subscribed") is False
conn = kb.connect()
try:
assert kb.list_notify_subs(conn, d["task_id"]) == []
finally:
conn.close()
finally:
clear_session_vars(tokens)