Skip to content

fix(gateway): staged inactivity warning before timeout escalation#6263

Closed
Helmi wants to merge 1 commit into
NousResearch:mainfrom
Helmi:fix/staged-inactivity-timeout
Closed

fix(gateway): staged inactivity warning before timeout escalation#6263
Helmi wants to merge 1 commit into
NousResearch:mainfrom
Helmi:fix/staged-inactivity-timeout

Conversation

@Helmi

@Helmi Helmi commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a pre-timeout warning layer to the gateway inactivity timeout mechanism. When the agent has been idle for gateway_timeout_warning seconds (default: 15 min), a single notification is sent to the user. If inactivity continues to gateway_timeout (default: 30 min), the full timeout fires as before.

This gives users a chance to intervene on slow API providers without disabling the safety timeout.

Related Issue

Fixes #6260

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • hermes_cli/config.py: Added gateway_timeout_warning default (900s) to DEFAULT_CONFIG["agent"]
  • gateway/run.py: Bridge gateway_timeout_warning config key → HERMES_AGENT_TIMEOUT_WARNING env var; poll loop sends a single warning notification before escalating to full timeout
  • cli-config.yaml.example: Documented gateway_timeout and gateway_timeout_warning under the agent: section
  • tests/gateway/test_gateway_inactivity_timeout.py: New test suite covering warning fires once, warning disabled at 0, warning skipped on unlimited timeout, full timeout still fires after warning, env var parsing

How to Test

  1. Set gateway_timeout_warning: 900 and gateway_timeout: 1800 in ~/.hermes/config.yaml
  2. Trigger an agent run that goes idle for > 15 min — verify a warning message is received
  3. Verify the warning fires only once per run
  4. Set gateway_timeout_warning: 0 — verify no warning fires
  5. Run pytest tests/gateway/test_gateway_inactivity_timeout.py -v

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(gateway): ...)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes
  • I've tested on my platform: macOS 15

Documentation & Housekeeping

  • I've updated relevant documentation (cli-config.yaml.example)
  • I've updated cli-config.yaml.example if I added/changed config keys
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — N/A
  • I've considered cross-platform impact — N/A (env var parsing only)
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A

Screenshots / Logs

Example warning message:

⚠️ No activity for 15 min. If the agent does not respond soon, it will be timed out in 15 min. You can continue waiting or use /reset.

Introduce gateway_timeout_warning (default 900s) as a pre-timeout alert
layer.  When inactivity reaches the warning threshold, a single
notification is sent to the user offering to wait or reset.  If
inactivity continues to the gateway_timeout (default 1800s), the full
timeout fires as before.

This gives users a chance to intervene before work is lost on slow
API providers without disabling the safety timeout entirely.

Config: agent.gateway_timeout_warning in config.yaml, or
HERMES_AGENT_TIMEOUT_WARNING env var (0 = disable warning).
@teknium1

teknium1 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Merged via PR #6387 — your commit was cherry-picked onto current main with authorship preserved. Two small bug fixes added on top (unbound exception variable in the warning send handler, and remaining-time math for non-default configs). Thanks for the feature, @Helmi!

@teknium1 teknium1 closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inactivity timeout fires repeatedly with MiniMax 2.7 highspeed

2 participants