Skip to content

feat(gateway): configurable auto-resume delay for paused platforms - #35938

Closed
courage-zero wants to merge 2 commits into
NousResearch:mainfrom
courage-zero:feat/gateway-platform-auto-resume
Closed

feat(gateway): configurable auto-resume delay for paused platforms#35938
courage-zero wants to merge 2 commits into
NousResearch:mainfrom
courage-zero:feat/gateway-platform-auto-resume

Conversation

@courage-zero

@courage-zero courage-zero commented May 31, 2026

Copy link
Copy Markdown

Closes #35936

Problem

When the gateway loses connection (e.g. Telegram behind Clash/VPN), the circuit breaker pauses the platform permanently after 10 failures. Even after the network recovers, the platform stays paused until manual /platform resume or hermes gateway restart.

How this differs from #35387

  • PR fix(gateway): never auto-pause platforms on transient network/DNS failures #35387 (merged upstream): prevents transient failures (network/DNS timeouts) from triggering a pause in the first place. Prevention.
  • This PR: handles the case where the platform is already paused — whether from non-transient failures, manual /platform pause, or pause state left from a previous version. Provides a configurable auto-resume mechanism. Recovery.

These are complementary: #35387 reduces how often pauses happen, this PR ensures any pause that does happen is self-healing.

Solution

Adds gateway.platform_resume_delay config option (minutes, default 0 = backward compatible — auto-resume disabled).

When > 0:

  • Circuit breaker still activates after 10 failures, but schedules a finite next_retry instead of float(inf)
  • Reconnect watcher checks auto_resume_at on each tick and auto-recovers when timeout expires
  • Manual /platform pause does NOT set auto_resume_at, preserving manual pause semantics

Environment override: HERMES_PLATFORM_RESUME_DELAY (minutes)

Example

gateway:
  platform_resume_delay: 10  # auto-resume after 10 minutes

Adds gateway.platform_resume_delay config option (minutes, default 0)
that controls how long before the gateway automatically resumes a
paused platform after repeated network failures.

When set to a positive value, the circuit breaker still activates
after PAUSE_AFTER_FAILURES consecutive failures, but schedules a
finite next_retry instead of float('inf'). The reconnect watcher
checks the new auto_resume_at field on each tick and auto-resumes
when the timeout expires.

Manually paused platforms (/platform pause) have no auto_resume_at
and stay paused until explicit /platform resume, preserving the
intended semantics of manual pause.

Environment override: HERMES_PLATFORM_RESUME_DELAY (minutes)

Closes NousResearch#35936
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels May 31, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Companion PR for #35936. Related to #35290 (auto-recover auto-paused platforms, hardcoded 5-min probe) and merged #35387 (removed auto-pause on transient failures). Note: #35387 changed the behavior so transient failures no longer auto-pause — this PR's value is for non-transient pauses.

@courage-zero

Copy link
Copy Markdown
Author

Closing — upstream already has a better fix (commit 45465b0). Instead of a configurable delay, it removes the auto-pause entirely for retryable failures (network/DNS timeouts). Non-retryable errors like bad auth already drop out of the queue earlier. This is cleaner — no config option needed, self-heals on network recovery within 5 minutes.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the recovery-oriented proposal. The reporter’s failure mode is already addressed on current main, as the author noted in the May 31 follow-up.

  • Automated hermes-sweeper review verified commit 45465b0d5d8c7b2db7df6d9e466589cdef9136c0 (fix(gateway): never auto-pause platforms on transient network/DNS failures (#35387)) removed both automatic pause branches for retryable reconnect failures.
  • gateway/run.py:7844-7853 now keeps retryable failures in the reconnect queue indefinitely at the capped backoff, so recovered network/DNS failures self-heal without /platform resume.
  • tests/gateway/test_platform_reconnect.py:402 covers failures far beyond the former threshold and asserts the platform remains unpaused and queued.
  • The implementing commit is included in v2026.6.5.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: configurable auto-resume delay for paused gateway platforms

4 participants