You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes the Windows gateway Scheduled Task install path so newly created Hermes_Gateway tasks do not inherit Task Scheduler's default 72-hour execution time limit. After schtasks /Create succeeds, the install step uses PowerShell's ScheduledTasks API to set ExecutionTimeLimit = 'PT0S'.
On a Windows Hermes install, the gateway stopped responding after the task's 72-hour window:
Hermes_Gateway was Ready, not running
LastTaskResult was 0x41306 / task terminated
ExecutionTimeLimit was PT72H
gateway logs stopped after the last active session/cache sweep
Changing the local task to PT0S and restarting it brought the gateway back up; logs showed Telegram and Discord reconnecting.
Changes Made
Add _disable_scheduled_task_time_limit() for Windows Scheduled Task hardening after creation.
Treat failure to disable the 72-hour limit as an invalid Scheduled Task install, rather than silently leaving a gateway that will die after three days.
Add regression coverage for successful limit disabling and failure handling.
uv run --with ruff ruff check hermes_cli/gateway_windows.py tests/hermes_cli/test_gateway_windows.py -> All checks passed
Scope
This PR fixes the primary ExecutionTimeLimit=PT72H failure mode from #35692. It does not attempt to rewrite the entire Windows task registration flow or change battery/wake/multiple-instance policy in this patch.
The 72h ExecutionTimeLimit failure mode from #35692 already appears fixed on main: _install_scheduled_task() now registers the task from XML (_write_scheduled_task_xml) with <ExecutionTimeLimit>PT0S</ExecutionTimeLimit> and <StopIfGoingOnBatteries>false> (landed via #45610). The bare schtasks /Create path this PR post-patches no longer exists in the default install flow, so this change looks redundant against current main. Related: #45610 (merged fix), #35693 (competing open PR). A maintainer should confirm whether any incremental value remains.
Thanks for the focused Windows regression work. This is an automated hermes-sweeper review; the reported behavior is already implemented on current main.
hermes_cli/gateway_windows.py:616 sets <ExecutionTimeLimit>PT0S</ExecutionTimeLimit> directly in that definition.
hermes_cli/gateway_windows.py:662-663 installs it through schtasks /Create ... /XML, so the bare creation path this PR post-processes is no longer the default flow.
tests/hermes_cli/test_gateway_windows.py:277-310 already verifies the XML registration and PT0S limit.
The merged fix shipped in v2026.7.1; closing as implemented on main.
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
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.
What does this PR do?
Fixes the Windows gateway Scheduled Task install path so newly created
Hermes_Gatewaytasks do not inherit Task Scheduler's default 72-hour execution time limit. Afterschtasks /Createsucceeds, the install step uses PowerShell's ScheduledTasks API to setExecutionTimeLimit = 'PT0S'.Related Issue
Refs #35692
Real-world evidence
On a Windows Hermes install, the gateway stopped responding after the task's 72-hour window:
Hermes_GatewaywasReady, not runningLastTaskResultwas0x41306/ task terminatedExecutionTimeLimitwasPT72HChanging the local task to
PT0Sand restarting it brought the gateway back up; logs showed Telegram and Discord reconnecting.Changes Made
_disable_scheduled_task_time_limit()for Windows Scheduled Task hardening after creation.How to Test
uv run --with pytest python -m pytest tests/hermes_cli/test_gateway_windows.py -q-> 36 passeduv run --with ruff ruff check hermes_cli/gateway_windows.py tests/hermes_cli/test_gateway_windows.py-> All checks passedScope
This PR fixes the primary
ExecutionTimeLimit=PT72Hfailure mode from #35692. It does not attempt to rewrite the entire Windows task registration flow or change battery/wake/multiple-instance policy in this patch.