Hermes Gateway Standing-Goal Loop After Provider Failure Can Inflate Session Context (#63180)

Bug Tracker — July 12, 2026. A reported gateway control-flow defect can treat a failed provider turn as progress, then repeatedly create synthetic standing-goal continuations instead of halting or recovering safely.

Issue Summary

Issue #63180 reports that a failed provider turn is normalized into non-empty error text. Because the gateway checks only _final_text.strip(), it interprets that error as successful progress and queues another standing-goal continuation. One reported reproduction grew to 10 messages and roughly 46,600 tokens with duplicate continuation blocks, increasing the risk of context exhaustion and prompt-template failure.

Observed Failure Path

StepReported BehaviorFailure Risk
Provider turn failsError is converted to non-empty final text.Failure state loses its semantic distinction.
Gateway completion test_final_text.strip() is treated as progress.Error content passes a success-like guard.
Standing-goal schedulingSynthetic continuation is enqueued repeatedly.Duplicate blocks, growing history, and avoidable token cost.
Long-running sessionContext expands until limits or templates fail.Recovery becomes harder and the original task is obscured.

Operational Impact

Classification: P2. This page summarizes a publicly reported issue; behavior, scope, and remediation status may change as the upstream project investigates and merges fixes. Teams should validate their own deployment before treating any workaround as complete.

Mitigation and Verification

  1. Exercise provider-failure paths in a staging gateway and assert that an error cannot satisfy a progress/completion predicate.
  2. Set bounded continuation depth, message-count, and token-growth guards; surface a clear terminal error when a loop threshold is reached.
  3. Log reason-coded continuation decisions so operators can distinguish genuine agent progress from retry or error states.
  4. Follow upstream issue #63180 and linked PR #63187; validate that duplicate standing-goal blocks do not reappear after remediation.

Source Evidence

Primary issue: NousResearch/hermes-agent issue #63180 (linked PR #63187)

For a managed-agent comparison, the relevant question is whether provider replay, error handling, token growth controls, and session recovery are observable and bounded under failure—not whether a one-off request completes in the happy path.