Skip to content

[codex] Flag stale Windows gateway task definitions - #55711

Open
ooiuuii wants to merge 1 commit into
NousResearch:mainfrom
ooiuuii:codex/windows-gateway-task-drift
Open

[codex] Flag stale Windows gateway task definitions#55711
ooiuuii wants to merge 1 commit into
NousResearch:mainfrom
ooiuuii:codex/windows-gateway-task-drift

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Adds a Windows Scheduled Task definition audit to hermes gateway status.
  • Warns when an upgraded install still has a pre-fix(windows): harden gateway scheduled task #45610 task shape: legacy .cmd launcher, no restart-on-failure, disabled StartWhenAvailable, or battery settings that can prevent/start-stop the gateway.
  • Keeps the existing process liveness probes unchanged; this only adds diagnostics for stale task definitions.

Why?

Review follow-up

  • Rebased onto current main.
  • Changed every definition-repair hint to hermes gateway install: Windows installs already recreate/reconcile the task, so --force is unnecessary API parity.
  • Added regression coverage for malformed XML, a legacy launcher, and a non-VBS launcher; every repair hint now asserts the plain install command and rejects --force.

Proof at 7aa4980eee272455331f0422163ea86be3a1d072

  • bash scripts/run_tests.sh tests/hermes_cli/test_gateway_windows.py -q — 11/11 passed.
  • Ruff check on both changed files — passed.
  • git diff --check — passed.
  • Scoped AutoReview — clean, patch correct (0.99 confidence).
  • The original native-Windows reproduction confirmed that the audit detects an existing stale Scheduled Task; this review amendment only corrects the remediation command.

Notes

  • This is intentionally diagnostic-only. It does not attempt to elevate, delete, or rewrite the user's Scheduled Task from status.

@ooiuuii
ooiuuii marked this pull request as ready for review June 30, 2026 15:01
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard platform/windows Native Windows-specific behavior or breakage P2 Medium — degraded but workaround exists sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working and removed type/feature New feature or request labels Jun 30, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a targeted diagnostic for persisted Windows task drift. The current status path only reports registration and runtime fields (hermes_cli/gateway_windows.py:1426), while the current task generator requires the launcher and reliability settings this PR audits (hermes_cli/gateway_windows.py:602-626).

Problems

  • The new warnings tell users to run hermes gateway install --force (hermes_cli/gateway_windows.py:1317, 1326, 1331), but current Windows install() explicitly says force is only API parity and every install reconciles the task (hermes_cli/gateway_windows.py:1031). The extra flag is unnecessary.

Suggested changes

  • Use hermes gateway install in each warning and assert that remediation text in the warning tests.

Automated hermes-sweeper review.

root = ET.fromstring(xml_text.lstrip("\ufeff"))
except ET.ParseError:
return [
"Scheduled Task definition could not be parsed; run "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install() already reconciles the Windows task on every invocation; force is accepted only for API parity (hermes_cli/gateway_windows.py:1031). Please recommend hermes gateway install here and in the other new warnings.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 15, 2026
@randydevlab

randydevlab commented Aug 9, 2026

Copy link
Copy Markdown

I reproduced this Windows gateway-status issue on a native Windows installation while troubleshooting a live Hermes gateway.

While validating #55711, I found an additional observability gap in hermes gateway status --deep:

  • it reports Task script: ...\Hermes_Gateway.cmd even when the installed Scheduled Task actually executes wscript.exe ...\Hermes_Gateway.vbs
  • it reports an expected Startup-folder entry even when no Startup fallback is installed

On the tested system, the actual Scheduled Task action is:

wscript.exe //B //Nologo "%LOCALAPPDATA%\hermes\gateway-service\Hermes_Gateway.vbs"

and the Startup fallback is not installed.

I built a tested follow-up on top of #55711 that:

  • reports the observed Task Scheduler Exec action rather than an inferred path
  • reports the actual Startup fallback state
  • queries/parses the Scheduled Task XML once per status() call and reuses that observation for validation and display
  • remains completely read-only

I also incorporated the July 15 review feedback locally: remediation now recommends hermes gateway install, not hermes gateway install --force.

Validation on native Windows against current upstream:

  • Ruff: PASS
  • Windows gateway tests: 14/14 PASS
  • Python compile: PASS
  • git diff --check: PASS
  • live read-only hermes gateway status --deep canary: PASS
  • regression coverage verifies one Scheduled Task XML query during status(deep=True)

The corrected live output is:

Task name:          Hermes_Gateway
Task action:        wscript.exe //B //Nologo "%LOCALAPPDATA%\hermes\gateway-service\Hermes_Gateway.vbs"
Startup fallback:   not installed

I kept the production Hermes checkout untouched throughout testing.

If this fits the intended scope of #55711, I'm happy to provide the tested follow-up commit or open a focused PR in whatever form is most useful.

Signed-off-by: luyifan <al3060388206@gmail.com>
@ooiuuii
ooiuuii force-pushed the codex/windows-gateway-task-drift branch from cfe52e6 to 7aa4980 Compare August 9, 2026 12:20
@ooiuuii

ooiuuii commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — you’re right. Windows install() already recreates and reconciles the Scheduled Task on every run, so --force was misleading here.

I rebased onto current main, changed all three repair hints to plain hermes gateway install, and added a regression that covers malformed XML, a legacy launcher, and a non-VBS launcher while asserting that none of the remediation text includes --force. The focused wrapper suite is 11/11, Ruff and git diff --check pass, and the scoped AutoReview is clean. Could you take another look when you have a moment?

@ooiuuii

ooiuuii commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@randydevlab Thanks for doing the native-Windows pass — reporting the observed Task action instead of an inferred path is a useful separate improvement.

I kept this update narrow to the existing review request so the PR doesn’t grow another behavior surface this late. Your read-only/query-once approach sounds like a good focused follow-up; please feel free to open it against current main (or share the tested commit) and link #55710/#55711 so the proof and attribution stay with your work.

@randydevlab

Copy link
Copy Markdown

Thanks — I finished the focused follow-up and pushed the tested commit here:

randydevlab@eb17c25

It builds directly on the current #55711 head and keeps the change scoped to Windows gateway status observability:

  • reports the observed Task Scheduler Exec command, arguments, and working directory rather than an inferred launcher path
  • reports the actual current/legacy Startup fallback state
  • reuses one Scheduled Task XML observation for validation and display
  • fails closed on ambiguous/malformed task actions
  • keeps status --deep read-only and preserves the quick status summary before the XML query

Final validation on native Windows:

I haven’t opened a PR yet since this commit is directly stacked on #55711. Happy to transplant it onto main once #55711 lands, or adjust the submission shape if you prefer.

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 P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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.

[Windows] gateway status hides stale Scheduled Task definitions after task hardening

4 participants