fix: /status command bypasses active-session guard during agent run#5080
Closed
teyrebaz33 wants to merge 1 commit into
Closed
fix: /status command bypasses active-session guard during agent run#5080teyrebaz33 wants to merge 1 commit into
teyrebaz33 wants to merge 1 commit into
Conversation
…ousResearch#5046) When an agent was actively processing a message, /status sent via Telegram (or any gateway) was queued as a pending interrupt instead of being dispatched immediately. The base platform adapter's handle_message() only had special-case bypass logic for /approve and /deny, so /status fell through to the default interrupt path and was never processed as a system command. Apply the same bypass pattern used by /approve//deny: detect cmd == 'status' inside the active-session guard, dispatch directly to the message handler, and send the response without touching session lifecycle or interrupt state. Adds a regression test that verifies /status is dispatched and responded to immediately even when _active_sessions contains an entry for the session.
Contributor
|
Merged via PR #5288 (consolidated bugfix salvage). Your commit(s) were cherry-picked onto current main with your authorship preserved in git log. Thanks @teyrebaz33 for the fix! |
teyrebaz33
added a commit
to teyrebaz33/hermes-agent
that referenced
this pull request
Apr 7, 2026
Comprehensive walkthrough covering: - Three methods for finding bugs (usage, code reading, open issues) - Verifying a real bug before writing code - Tracing root causes through the full code path - Opening well-structured issues - Writing minimal, pattern-following fixes - Writing regression tests - Pre-PR checklist with exact commands - Opening PRs with clear descriptions - Handling CI failures and the salvage pattern All examples drawn from real merged PRs (NousResearch#5080, NousResearch#5829).
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.
Problem
Fixes #5046.
When an agent was actively processing a message, sending
/statusvia Telegram (or any gateway platform) caused it to be silently queued as a pending interrupt rather than being dispatched as a system command. The user would receive no status response, and the running agent would be interrupted unexpectedly on the next turn.Root Cause
BasePlatformAdapter.handle_message()ingateway/platforms/base.pyalready had bypass logic for/approveand/denycommands — these are dispatched directly to the message handler even when a session is active, because they must not interrupt the running agent./statuswas missing the same treatment and fell through to the default interrupt path.Fix
Apply the same bypass pattern to
cmd == 'status': detect it inside the active-session guard, call_message_handlerdirectly, send the response via_send_with_retry, and return without touching session lifecycle or interrupt state.What is not addressed
Tests
Added
test_status_command_bypasses_active_session_guardtotests/gateway/test_status_command.py. Verifies thathandle_message("/status")dispatches immediately even when_active_sessionscontains an active entry, sends the response, does not set the interrupt event, and does not queue the event.