fix(gateway): don't suppress error messages when streaming already_sent#7652
Merged
Conversation
When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
2 tasks
Tommyeds
pushed a commit
to Tommyeds/hermes-agent
that referenced
this pull request
Apr 12, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
liaoyinglong
pushed a commit
to liaoyinglong/hermes-agent
that referenced
this pull request
Apr 13, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…nt (NousResearch#7652) When the stream consumer has sent at least one message (already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc. The user would see the last streamed content and then nothing: no error message, no explanation. The agent appeared to 'stop responding.' Fix: check the 'failed' flag at both the producer (_run_agent marks already_sent) and consumer (_handle_message_with_agent checks it) sites. Error messages are always delivered regardless of streaming state.
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
When the stream consumer has sent at least one message (
already_sent=True), the gateway skips sending the final response to avoid duplicates. But this also suppressed error messages when the agent failed mid-loop — rate limit exhaustion, context overflow, compression failure, etc.User-visible symptom: The agent appears to "stop responding mid-loop without any explanation." The last streamed content stays on screen and nothing else arrives — no error, no timeout message, nothing.
Root cause: The
already_sentflag is set unconditionally when the stream consumer has sent anything, even a single progressive edit early in the session. When the agent later fails (returning{"failed": True, "error": "..."}), the gateway generates a proper error message at line ~3050, but then thealready_sentcheck at line ~3212 returnsNone— silently dropping the error.Fix: Check the
failedflag at both sites:_run_agent, line ~7698): Don't markalready_senton the response dict when the agent failed_handle_message_with_agent, line ~3212): Belt-and-suspenders — don't suppress delivery whenfailedis setTest plan