fix(send_message): allow kanban workers to call send_message#23358
Closed
dmnkhorvath wants to merge 2 commits into
Closed
fix(send_message): allow kanban workers to call send_message#23358dmnkhorvath wants to merge 2 commits into
dmnkhorvath wants to merge 2 commits into
Conversation
The kanban dispatcher sets HERMES_KANBAN_TASK on every spawned worker but launches it with the assignee profile's HERMES_HOME (e.g. ~/.hermes/profiles/<name>/), which has no gateway.pid file. The existing _check_send_message therefore returned False from the is_gateway_running() fallback, even though the parent gateway is alive and reachable. Net effect: workers could call kanban_* tools (gated on HERMES_KANBAN_TASK in _check_kanban_mode) but not send_message. This breaks the natural pattern of "worker does the job, calls send_message to deliver rich content to the originating chat, then calls kanban_complete with a one-line summary" because the kanban notifier's payload_summary is hard-truncated to the first line (~200 chars) at gateway/run.py:3963 — anything richer has to ship via send_message. Honoring HERMES_KANBAN_TASK in _check_send_message — symmetric with _check_kanban_mode in kanban_tools.py:42 — closes the gap. No new state, no new env var, no profile-config changes required.
Adds a TestCheckSendMessage class with 7 focused tests pinning the
four passing conditions and the failure modes:
- HERMES_KANBAN_TASK grants access (the new branch)
- HERMES_KANBAN_TASK short-circuits before consulting
session_context or gateway.status (so workers don't depend on
those import paths being healthy)
- HERMES_SESSION_PLATFORM=telegram grants access
- HERMES_SESSION_PLATFORM=local falls through to gateway check
- is_gateway_running()=True grants access
- All signals absent → False
- gateway.status ImportError is swallowed → False
Pinning the short-circuit (test NousResearch#2) is the load-bearing one — it
documents the contract that worker-side availability cannot regress
to depending on gateway-side state lookups.
kshitijk4poor
added a commit
that referenced
this pull request
May 11, 2026
Collaborator
|
Merged via salvage PR #23791. Your commits were cherry-picked onto current main with your authorship preserved in git log. Thanks for the fix! |
rmulligan
pushed a commit
to rmulligan/hermes-agent
that referenced
this pull request
May 11, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath), NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban bug-fix batch salvage.
JinyuID
pushed a commit
to JinyuID/hermes-agent
that referenced
this pull request
May 11, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath), NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban bug-fix batch salvage.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath), NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban bug-fix batch salvage.
jsboige
pushed a commit
to jsboige/hermes-agent
that referenced
this pull request
May 14, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath), NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban bug-fix batch salvage.
AlexFoxD
pushed a commit
to AlexFoxD/hermes-agent
that referenced
this pull request
May 21, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath), NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban bug-fix batch salvage.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath), NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban bug-fix batch salvage.
Seven74AI
pushed a commit
to Seven74AI/hermes-agent
that referenced
this pull request
Jun 13, 2026
For PRs NousResearch#23206 (Frowtek), NousResearch#23252 (Sylw3ster), NousResearch#23358 (dmnkhorvath), NousResearch#23659 (smwbev), and NousResearch#23356 (TurgutKural) — all part of the kanban bug-fix batch salvage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
send_messageis unavailable to kanban-dispatcher-spawned workers because_check_send_messagefalls back tois_gateway_running(), which reads{HERMES_HOME}/gateway.pid— and workers run under the assignee profile'sHERMES_HOME(e.g.~/.hermes/profiles/calendar/), where no PID file exists. The parent gateway is alive and reachable; only the check fails.This is asymmetric with
_check_kanban_modeintools/kanban_tools.py:42, which already honorsHERMES_KANBAN_TASK(the env var the dispatcher sets on every spawned worker, seehermes_cli/kanban_db.py:3782). So today, a worker can call everykanban_*tool but cannot callsend_message.This PR mirrors that pattern in
_check_send_message: ifHERMES_KANBAN_TASKis set, the worker is dispatcher-spawned, the parent gateway is by definition running, andsend_messageis safe to allow.Why this matters
The kanban completion notifier truncates
payload_summaryto its first line, max 200 chars (gateway/run.py:3963):For workers whose natural output is richer than a one-liner (a calendar listing, a deck export with a paste URL, a research idea ranking, a video summary with bullets), the only ergonomic delivery path is for the worker to call
send_message(platform=..., chat_id=..., text=<full content>)itself, thenkanban_complete(summary=<one-liner>)for the notifier's "✔ done" line. Today that pattern silently fails:send_messageis gated off, the worker either hallucinates success or substituteskanban_comment(which the user never sees on Telegram).Net user-visible effect: a Telegram-originated kanban task completes, the user gets
✔ Kanban t_xxxx done — <one-line headline>and nothing else. Rich content lives in the kanban DB but never reaches the chat.Relationship to other in-flight work
feat(kanban): return agent-created task completions to originsolves the broader "completions return to origin" problem at the gateway notifier layer (provenance threading + auto-subscribe + synthesis). It does not modify_check_send_message. This PR is orthogonal: even with feat(kanban): return agent-created task completions to origin #21523 merged, workers may want to message other chats (e.g., notify a team channel on completion of a user-originated task), and that requiressend_messageto be callable from the worker. Both can land independently.toolsets: [hermes-cli]" bug. Different gate, same family of "workers can't reach a tool that should be available" surprises.Change
osis already imported at module top (tools/send_message_tool.py:11).Test plan
send_message unavailable (check failed)and the worker silently fell back tokanban_comment.send_message(platform="telegram", chat_id=..., text=...)and the rich content reaches the originating chat._check_send_messageis thin.Out of scope
gateway/run.py:3963is intentional (notifier wants scannable headlines). This PR does not touch it; instead it makes the documented worker-side workaround actually work._check_kanban_mode, profile config defaults, or the dispatcher.