fix(gateway): preserve rate-limit failure metadata - #64686
Merged
teknium1 merged 1 commit intoJul 28, 2026
Conversation
tonydwb
reviewed
Jul 15, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Overview
Gateway fix: preserves rate-limit failure metadata instead of dropping it, so callers can distinguish rate-limit errors from other failures. 226 additions.
Assessment
- Correctness: Preserving rate-limit metadata is the right behavior for proper error handling downstream.
- Security: No security-sensitive changes.
- Debug artifacts: None.
Summary
Clean fix. LGTM.
Reviewed by Hermes Agent
Contributor
|
Thanks for the focused regression fix. The premise is confirmed on current main: Automated hermes-sweeper review. |
teknium1
force-pushed
the
fix-gateway-rate-limit-session-state
branch
from
July 28, 2026 20:57
68766bf to
d345462
Compare
teknium1
added a commit
that referenced
this pull request
Jul 29, 2026
…n path Sibling of #64686: _run_agent's empty-final_response early return dropped failure_reason (and #64686 only fixed the non-empty path), so downstream consumers (TUI billing surface, transient-failure persistence) lost the structured reason exactly when a failed run produced no text. Also hardens the two BasePlatformAdapter identity checks (edit_message / delete_message) with getattr so duck-typed adapters without the attribute mean 'capability absent', not AttributeError — this was crashing the send_progress_messages path for minimal adapters and test fakes.
teknium1
added a commit
that referenced
this pull request
Jul 29, 2026
…n path Sibling of #64686: _run_agent's empty-final_response early return dropped failure_reason (and #64686 only fixed the non-empty path), so downstream consumers (TUI billing surface, transient-failure persistence) lost the structured reason exactly when a failed run produced no text. Also hardens the two BasePlatformAdapter identity checks (edit_message / delete_message) with getattr so duck-typed adapters without the attribute mean 'capability absent', not AttributeError — this was crashing the send_progress_messages path for minimal adapters and test fakes.
caozuohua
pushed a commit
to caozuohua/hermes-agent
that referenced
this pull request
Jul 30, 2026
…n path Sibling of NousResearch#64686: _run_agent's empty-final_response early return dropped failure_reason (and NousResearch#64686 only fixed the non-empty path), so downstream consumers (TUI billing surface, transient-failure persistence) lost the structured reason exactly when a failed run produced no text. Also hardens the two BasePlatformAdapter identity checks (edit_message / delete_message) with getattr so duck-typed adapters without the attribute mean 'capability absent', not AttributeError — this was crashing the send_progress_messages path for minimal adapters and test fakes.
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…n path Sibling of NousResearch#64686: _run_agent's empty-final_response early return dropped failure_reason (and NousResearch#64686 only fixed the non-empty path), so downstream consumers (TUI billing surface, transient-failure persistence) lost the structured reason exactly when a failed run produced no text. Also hardens the two BasePlatformAdapter identity checks (edit_message / delete_message) with getattr so duck-typed adapters without the attribute mean 'capability absent', not AttributeError — this was crashing the send_progress_messages path for minimal adapters and test fakes.
33hodl
pushed a commit
to 33hodl/hermes-agent
that referenced
this pull request
Aug 12, 2026
…n path Sibling of NousResearch#64686: _run_agent's empty-final_response early return dropped failure_reason (and NousResearch#64686 only fixed the non-empty path), so downstream consumers (TUI billing surface, transient-failure persistence) lost the structured reason exactly when a failed run produced no text. Also hardens the two BasePlatformAdapter identity checks (edit_message / delete_message) with getattr so duck-typed adapters without the attribute mean 'capability absent', not AttributeError — this was crashing the send_progress_messages path for minimal adapters and test fakes.
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.
Preserves
failedandfailure_reasonmetadata when a gateway agent runreturns a non-empty rate-limit error response.
On retry exhaustion,
run_conversation()already returns failure metadata,but
GatewayRunner._run_agent_inner()dropped it on the non-emptyfinal_responsepath. The outer gateway could therefore treat the generated429 text as a normal assistant response and persist it into the session
transcript.
This change forwards the failure metadata through that return path, allowing
the existing transient-failure handling to preserve the user turn without
storing the gateway-generated error as assistant output.
Regression coverage verifies that:
without replaying the previous 429 error.
The Desktop/TUI route was reviewed separately. Current
mainalready keepsretry-exhaustion error text out of backend conversation history and rebuilds
the runtime during a provider switch, so this PR does not modify that path.
Related Issue
Closes #64446
Testing
19 passedgit diff --checkpassed