Skip to content

Fix Windows gateway task 72h time limit - #54344

Closed
ooiuuii wants to merge 1 commit into
NousResearch:mainfrom
ooiuuii:fix/windows-gateway-task-time-limit
Closed

Fix Windows gateway task 72h time limit#54344
ooiuuii wants to merge 1 commit into
NousResearch:mainfrom
ooiuuii:fix/windows-gateway-task-time-limit

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

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'.

Related Issue

Refs #35692

Real-world evidence

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.

How to Test

  • uv run --with pytest python -m pytest tests/hermes_cli/test_gateway_windows.py -q -> 36 passed
  • 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.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows P3 Low — cosmetic, nice to have labels Jun 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

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.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Windows regression work. This is an automated hermes-sweeper review; the reported behavior is already implemented on current main.

  • Merged PR fix(windows): harden gateway scheduled task #45610 (433db17c0a8d5581b4fb38289539fc1ee5cc7696) changed Windows gateway registration to an XML task definition.
  • 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.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants