test(cli): describe the chat -q author forwarding as -Q parity, not a Kanban path

Kanban workers do not run chat -q any more (the owner gateway authors their
turns), so the comment and the test no longer name the Kanban spawn: the
test moves to test_single_query_turn_author.py and uses a neutral bot
author instead of bot:kanban, the id the owner-side constant avoids.
This commit is contained in:
kshitijk4poor authored and kshitij committed 2026-10-26 13:04:58 +05:30
1 parent 95953ea5b7
commit 7b2ee12945
2 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -546,7 +546,7 @@ def _run_single_query_mode(cli, query, image, quiet, oneshot, stream_json: bool
if _query_label:
cli.console.print(f"[bold blue]{t('cli.single_query.query_label')}[/] {_query_label}")
cli._show_security_advisories()
# Same author contract as `-Q`: a dispatcher (the Kanban worker spawn) names who wrote this run's
# Same author contract as `-Q`: a spawner that sets HERMES_TURN_AUTHOR names who wrote this run's
# prompts. Consumed before the first turn so tool subprocesses never inherit it; every turn of
# the run (recovery and goal follow-ups included) carries it to memory providers.
from agent.turn_author import take_turn_author_from_env
@@ -33,7 +33,7 @@ def _one_shot_cli(monkeypatch):
the_cli = cli.HermesCLI.__new__(cli.HermesCLI)
the_cli.session_id = "s-1"
the_cli.conversation_history = [{"role": "user", "content": "work kanban task t_author"}]
the_cli.conversation_history = [{"role": "user", "content": "summarize the report"}]
the_cli.agent = SimpleNamespace(run_conversation=Mock(side_effect=run_conversation))
the_cli._flush_credit_notices = lambda: None
the_cli._single_query_mode = False
@@ -51,14 +51,14 @@ def _one_shot_cli(monkeypatch):
return the_cli, calls
def test_dispatcher_author_reaches_the_worker_turn_and_is_consumed(monkeypatch):
monkeypatch.setenv(TURN_AUTHOR_ENV, '{"id": "bot:kanban", "name": "Kanban dispatcher", "is_bot": true}')
def test_dispatcher_author_reaches_the_turn_and_is_consumed(monkeypatch):
monkeypatch.setenv(TURN_AUTHOR_ENV, '{"id": "bot:relay", "name": "relayed teammate", "is_bot": true}')
the_cli, calls = _one_shot_cli(monkeypatch)
with pytest.raises(SystemExit):
cli._run_single_query_mode(the_cli, "work kanban task t_author", None, False, True)
cli._run_single_query_mode(the_cli, "summarize the report", None, False, True)
assert len(calls) == 1
assert calls[0]["turn_author"] == {"id": "bot:kanban", "name": "Kanban dispatcher", "is_bot": True}
assert calls[0]["turn_author"] == {"id": "bot:relay", "name": "relayed teammate", "is_bot": True}
# Tool subprocesses started during the turn must not inherit the dispatcher's author.
assert calls[0]["env_author"] is None