fix(agent): fall back to non-streaming on JSONDecodeError - #24532
Open
liuhao1024 wants to merge 1 commit into
Open
liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
Some providers (e.g. custom:llmgateway) return malformed or empty
SSE responses when streaming tool-call turns, raising
json.JSONDecodeError ("Expecting value: line 1 column 1 (char 0)").
Previously, only "stream not supported" errors triggered the
automatic fallback to non-streaming. This adds JSONDecodeError
to the same fallback path so the session switches to non-streaming
for subsequent requests.
Fixes NousResearch#24523
This was referenced May 12, 2026
Collaborator
|
Thanks for isolating the streaming failure mode. The underlying fallback is still absent on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
This was referenced Aug 3, 2026
13 tasks
Expri-commits
pushed a commit
to Expri-commits/hermes-agent
that referenced
this pull request
Sep 3, 2026
…ssion (NousResearch#25723) One transient 'stream not supported' error permanently poisoned the whole session into silent non-streaming calls — fatal behind proxies that kill idle connections (z.ai edge ~180-210s → HTTP 524, kills subagent/cron turns that Claude Code/OpenCode never see because they always stream). Mirrors upstream PR NousResearch#25771 (unmerged); reset placed at the top of agent.conversation_loop.run_conversation so every entry point (CLI, gateway, subagent children, review forks) re-attempts streaming each turn while the within-turn retry fallback (NousResearch#24532) still works. Local-patches carry until upstream merges.
Expri-commits
pushed a commit
to Expri-commits/hermes-agent
that referenced
this pull request
Sep 3, 2026
…ssion (NousResearch#25723) One transient 'stream not supported' error permanently poisoned the whole session into silent non-streaming calls — fatal behind proxies that kill idle connections (z.ai edge ~180-210s → HTTP 524, kills subagent/cron turns that Claude Code/OpenCode never see because they always stream). Mirrors upstream PR NousResearch#25771 (unmerged); reset placed at the top of agent.conversation_loop.run_conversation so every entry point (CLI, gateway, subagent children, review forks) re-attempts streaming each turn while the within-turn retry fallback (NousResearch#24532) still works. Local-patches carry until upstream merges.
Expri-commits
pushed a commit
to Expri-commits/hermes-agent
that referenced
this pull request
Sep 4, 2026
…ssion (NousResearch#25723) One transient 'stream not supported' error permanently poisoned the whole session into silent non-streaming calls — fatal behind proxies that kill idle connections (z.ai edge ~180-210s → HTTP 524, kills subagent/cron turns that Claude Code/OpenCode never see because they always stream). Mirrors upstream PR NousResearch#25771 (unmerged); reset placed at the top of agent.conversation_loop.run_conversation so every entry point (CLI, gateway, subagent children, review forks) re-attempts streaming each turn while the within-turn retry fallback (NousResearch#24532) still works. Local-patches carry until upstream merges.
Expri-commits
pushed a commit
to Expri-commits/hermes-agent
that referenced
this pull request
Sep 10, 2026
…ssion (NousResearch#25723) One transient 'stream not supported' error permanently poisoned the whole session into silent non-streaming calls — fatal behind proxies that kill idle connections (z.ai edge ~180-210s → HTTP 524, kills subagent/cron turns that Claude Code/OpenCode never see because they always stream). Mirrors upstream PR NousResearch#25771 (unmerged); reset placed at the top of agent.conversation_loop.run_conversation so every entry point (CLI, gateway, subagent children, review forks) re-attempts streaming each turn while the within-turn retry fallback (NousResearch#24532) still works. Local-patches carry until upstream merges.
Expri-commits
pushed a commit
to Expri-commits/hermes-agent
that referenced
this pull request
Sep 15, 2026
…ssion (NousResearch#25723) One transient 'stream not supported' error permanently poisoned the whole session into silent non-streaming calls — fatal behind proxies that kill idle connections (z.ai edge ~180-210s → HTTP 524, kills subagent/cron turns that Claude Code/OpenCode never see because they always stream). Mirrors upstream PR NousResearch#25771 (unmerged); reset placed at the top of agent.conversation_loop.run_conversation so every entry point (CLI, gateway, subagent children, review forks) re-attempts streaming each turn while the within-turn retry fallback (NousResearch#24532) still works. Local-patches carry until upstream merges.
12 tasks
Expri-commits
pushed a commit
to Expri-commits/hermes-agent
that referenced
this pull request
Sep 17, 2026
…ssion (NousResearch#25723) One transient 'stream not supported' error permanently poisoned the whole session into silent non-streaming calls — fatal behind proxies that kill idle connections (z.ai edge ~180-210s → HTTP 524, kills subagent/cron turns that Claude Code/OpenCode never see because they always stream). Mirrors upstream PR NousResearch#25771 (unmerged); reset placed at the top of agent.conversation_loop.run_conversation so every entry point (CLI, gateway, subagent children, review forks) re-attempts streaming each turn while the within-turn retry fallback (NousResearch#24532) still works. Local-patches carry until upstream merges.
Expri-commits
pushed a commit
to Expri-commits/hermes-agent
that referenced
this pull request
Sep 17, 2026
…ssion (NousResearch#25723) One transient 'stream not supported' error permanently poisoned the whole session into silent non-streaming calls — fatal behind proxies that kill idle connections (z.ai edge ~180-210s → HTTP 524, kills subagent/cron turns that Claude Code/OpenCode never see because they always stream). Mirrors upstream PR NousResearch#25771 (unmerged); reset placed at the top of agent.conversation_loop.run_conversation so every entry point (CLI, gateway, subagent children, review forks) re-attempts streaming each turn while the within-turn retry fallback (NousResearch#24532) still works. Local-patches carry until upstream merges.
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.
What does this PR do?
When using
custom:llmgateway(or similar providers) with streaming enabled, tool-call turns can fail withjson.JSONDecodeError: Expecting value: line 1 column 1 (char 0). The agent retries the same streaming path multiple times, then the tool workflow fails entirely.Root Cause
The streaming error handling in
_interruptible_streaming_api_callonly recognizes"stream not supported"as a signal to fall back to non-streaming. When a provider returns malformed or empty SSE responses for tool-call turns (raisingjson.JSONDecodeError), the error is treated as a generic failure and retried with the same streaming path — which fails identically each time.Related Issue
N/A
Type of Change
Changes Made
How to Test
pytest tests/ -q— all tests should passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture and workflows — or N/A