fix(gateway): session activity watchdog, stall notify, compress timeout (#72424 salvage) - #72817
Merged
kshitijk4poor merged 4 commits intoJul 27, 2026
Conversation
…out (NousResearch#72424) Three mechanisms to detect and notify when gateway sessions stall silently: 1. Mid-turn activity heartbeats stamped to SessionDB so hermes sessions list and hermes status show progress during long turns without new message rows. 2. Stall watchdog: when a busy session has pending inbound and the shared activity clock is idle past agent.session_stall_timeout (default 300), log a WARNING and notify the user once to try /new. Notify-only; does not kill the turn. 3. Compaction timeout: fenceless compress_context callers get a progress-aware host budget (compression.context_timeout_seconds default 120 idle, compression.context_total_ceiling_seconds default 600 ceiling). On timeout, cancel via commit fence, skip compaction without dropping messages, and continue the turn. Closes NousResearch#72016 (slices 1-3; slice 4 cumulative SSE stream-retry deadline remains a follow-up). Cherry-picked from PR NousResearch#72424 by @fangliquanflq.
Three code-reuse fixes applied during salvage: 1. Reuse _relative_time from hermes_cli/main.py instead of duplicating the relative-time formatting logic in hermes_cli/status.py. 2. Extract _stamp_hygiene_compression_provenance helper in gateway/run.py to deduplicate the two nearly-identical try/except blocks that stamp compression timeout/abort provenance in the hygiene path. 3. Add ContextCompressor.record_timeout_failure() method and use it from the in-agent compress_context timeout callback instead of re-implementing the (60, 300, 900) cooldown ladder inline. The existing summary-LLM exception handler already has this ladder — now both paths share one method.
…text compress_context now runs on a daemon pool worker thread (via run_compress_context_with_progress_timeout). The session id rotation updates hermes_logging._session_context (a threading.local) on the WORKER thread, not the caller thread. After the wrapper returns, propagate self.session_id back to the caller's logging context so subsequent log lines carry the rotated id (NousResearch#34089). Fixes CI failure in test_compression_logging_session_context.
kshitijk4poor
added a commit
that referenced
this pull request
Jul 27, 2026
revert: PR #72817 — session activity watchdog, stall notify, compress timeout
14 tasks
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…fy, compress timeout Reverting NousResearch#72817 (salvage of NousResearch#72424) pending further review. All 4 commits reverted: feat, refactor, chore (contributor map), CI fix.
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
revert: PR NousResearch#72817 — session activity watchdog, stall notify, compress timeout
33hodl
pushed a commit
to 33hodl/hermes-agent
that referenced
this pull request
Aug 12, 2026
…fy, compress timeout Reverting NousResearch#72817 (salvage of NousResearch#72424) pending further review. All 4 commits reverted: feat, refactor, chore (contributor map), CI fix.
33hodl
pushed a commit
to 33hodl/hermes-agent
that referenced
this pull request
Aug 12, 2026
revert: PR NousResearch#72817 — session activity watchdog, stall notify, compress timeout
prmartinow
pushed a commit
to prmartinow/hermes-agent
that referenced
this pull request
Aug 26, 2026
…fy, compress timeout Reverting NousResearch#72817 (salvage of NousResearch#72424) pending further review. All 4 commits reverted: feat, refactor, chore (contributor map), CI fix.
prmartinow
pushed a commit
to prmartinow/hermes-agent
that referenced
this pull request
Aug 26, 2026
revert: PR NousResearch#72817 — session activity watchdog, stall notify, compress timeout
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
…fy, compress timeout Reverting NousResearch#72817 (salvage of NousResearch#72424) pending further review. All 4 commits reverted: feat, refactor, chore (contributor map), CI fix.
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
revert: PR NousResearch#72817 — session activity watchdog, stall notify, compress timeout
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.
Summary
Gateway sessions now detect and notify when the agent loop stalls silently — activity heartbeats, a stall watchdog, and a progress-aware compress_context timeout.
Cherry-picked from #72424 by @fangliquanflq with three code-reuse fixes applied on top.
Changes
agent/session_activity.py(new): shared activity observation contract — timestamp + bounded description/provenancegateway/session_stall.py(new): notify-once stall policy for pending inbound + stale activityagent/conversation_compression.py: progress-aware timeout wrapper for in-agent compress_context (daemon pool + fence cancel)run_agent.py:_touch_activitygains provenance + rate-limited SessionDB heartbeat;_compress_contextwraps fenceless callershermes_state.py:touch_session_activity/clear_session_activity_labels/get_session_activity; freshest-oflast_activeSQL helpergateway/run.py: stall watcher, hygiene compression provenance stampshermes_cli/config.py/status.py/dump.py: new config keys, status surfacingSalvage fixes (our commits)
_relative_timefromhermes_cli/main.pyinstead of duplicating instatus.py_stamp_hygiene_compression_provenancehelper ingateway/run.pyto deduplicate two copy-paste blocksContextCompressor.record_timeout_failure()and delegate to it from the compress_context timeout callback instead of re-implementing the(60, 300, 900)cooldown ladder inlineValidation
Closes #72016 (slices 1-3; slice 4 cumulative SSE stream-retry deadline remains a follow-up).