Skip to content

[codex] Allow gateway to preserve suspended sessions - #18851

Closed
juanfradb wants to merge 1 commit into
NousResearch:mainfrom
juanfradb:codex/gateway-preserve-suspended-sessions
Closed

juanfradb wants to merge 1 commit into
NousResearch:mainfrom
juanfradb:codex/gateway-preserve-suspended-sessions

Conversation

@juanfradb

@juanfradb juanfradb commented May 2, 2026

Copy link
Copy Markdown

Summary

  • add session_reset.reset_suspended to control whether stopped/interrupted gateway sessions are hard-reset
  • when disabled, clear the suspended flag and mark the session resume_pending so the next message continues with the existing transcript
  • document the setting and cover the default and opt-in behavior with focused tests

Why

The existing hard-suspend path was introduced to avoid unrecoverable stuck-session loops (#7536). Later restart-resume work added resume_pending for interrupted restarts (#11852), but explicit suspended sessions still always force a fresh session. That is safe, but it can be too destructive for deployments that prefer continuity and explicit /reset.

This PR keeps upstream default behavior unchanged (reset_suspended: true) and adds an opt-in for deployments that want stopped/interrupted sessions to continue automatically.

Validation

  • /home/juan/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_config.py::TestSessionResetPolicy tests/gateway/test_restart_resume_pending.py::TestGetOrCreateResumePending tests/gateway/test_session_reset_notify.py::TestResetPolicyNotify -q

Related: #7536, #4493, #9850, #9934, #11852

@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 2, 2026
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the session-continuity work. Current main already provides the requested behavior, so this is redundant as an automated hermes-sweeper review.

  • Commit 952a885fbfa2b7c4f12791bfeead6d25bb361036 changed /stop to preserve the session; the current gateway handler at gateway/run.py:9237 interrupts and releases the running session without suspending it.
  • Forced restart/shutdown interruptions are marked resume_pending at gateway/run.py:8170, and gateway/session.py:1772 returns the existing session entry and transcript on recovery.
  • The remaining suspended state is the terminal three-restart stuck-loop safeguard (gateway/run.py:6088). The proposed reset_suspended: false branch would relax that safety boundary rather than restore normal stop/restart continuity.

No release tag was identified for the relevant changes.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 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.

3 participants