Skip to content

feat(update): add opt-out for gateway shutdown notices - #63165

Open
metamindedu wants to merge 3 commits into
NousResearch:mainfrom
metamindedu:fix/suppress-update-shutdown-notification
Open

feat(update): add opt-out for gateway shutdown notices#63165
metamindedu wants to merge 3 commits into
NousResearch:mainfrom
metamindedu:fix/suppress-update-shutdown-notification

Conversation

@metamindedu

@metamindedu metamindedu commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Windows Desktop/CLI updates intentionally pause running gateways before mutating the install. Today that planned stop follows the same notification path as manual or unexpected shutdowns, so active chats receive:

⚠️ Gateway shutting down — Your current task will be interrupted.

This PR makes that update-specific notice configurable while preserving existing behavior by default.

New setting

updates:
  gateway_shutdown_notification: true  # default

The setting is also exposed as Settings → Advanced → Update Shutdown Notifications in Hermes Desktop.

Setting Update-initiated gateway stop Other stops/restarts/failures
true (default) Existing shutdown notice is sent Existing behavior
false Shutdown notice is suppressed Existing behavior

Implementation

  • Each profile's update helper reads its own config.yaml before writing the planned-stop marker.
  • It sets suppress_notification: true only when that profile explicitly disables updates.gateway_shutdown_notification.
  • The gateway honors suppression only when the live marker targets its own PID/start-time and passes the existing TTL checks.
  • Missing, malformed, stale, foreign, or non-boolean values fail toward the historical visible behavior.
  • Suppression affects only the user-facing update shutdown ping. Drain/interruption, resume_pending, cleanup, exit status, and post-update gateway restart behavior are unchanged.

Compatibility

  • Default is true, so existing installs behave exactly as before.
  • Legacy planned-stop markers omit the suppression field and remain visible.
  • hermes gateway stop, service stops, normal restarts, and unexpected shutdowns do not set the update suppression flag and keep their existing notifications.

Related work / de-duplication

Tests

  • Python: 87 passed across updater quarantine/config behavior, planned-stop markers, restart-drain notifications, gateway shutdown, and config schema/default endpoints.
  • Review follow-up: a lifecycle regression now exercises profile config → update marker → the registered shutdown signal handler → marker consumption/runner suppression flag → notification delivery for opt-out, default-visible, and legacy-marker cases.
  • The lifecycle regression is fully in-process: it captures the registered callback and sends no OS signal or live gateway stop.
  • Desktop UI: 20 passed in the Settings helper suite.
  • Desktop TypeScript typecheck: passed.
  • Targeted ESLint and Prettier checks: passed.
  • Desktop production build: passed (assert-dist-built included).
  • Ruff, py_compile, and git diff --check: passed.

The Desktop build emitted only existing non-blocking CSS/chunk-size warnings and reported zero dependency vulnerabilities after a clean root npm ci.

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 12, 2026
@metamindedu metamindedu changed the title fix(update): suppress gateway shutdown notices for planned updates feat(update): add opt-out for gateway shutdown notices Jul 12, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for keeping the control narrowly scoped to update-initiated Windows gateway pauses. The current main path still writes an update planned-stop marker in hermes_cli/main.py:8881-8900, invokes it at hermes_cli/main.py:9196, and sends shutdown notices before drain at gateway/run.py:5815-5832 and gateway/run.py:8226-8228, so the premise remains current.

Problems

  • The new tests stop short of the new integration boundary. tests/gateway/test_restart_drain.py directly sets runner._suppress_shutdown_notifications, and tests/gateway/test_status.py only probes the marker helper. Neither exercises the PR's gateway/run.py signal-handler sequence that reads the marker, consumes it, sets the runner flag, and then reaches notification delivery.

Suggested changes

  • Add a lifecycle-level regression covering a fresh self-targeted marker with suppress_notification: true through the shutdown path, plus a legacy or false marker proving the existing notification still sends. This would validate the profile-config → marker → signal-handler → delivery chain required by the change.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
@metamindedu

Copy link
Copy Markdown
Contributor Author

Addressed the lifecycle coverage gap in 3c6018ebc7.

  • Replaced the direct _suppress_shutdown_notifications = True test with an in-process lifecycle regression that starts at the real per-profile update config/marker writer.
  • The test invokes the actual shutdown callback registered by start_gateway, verifies that the marker is consumed and the runner suppression flag is applied, then reaches the real notification-delivery method.
  • Covered three compatibility cases: update opt-out suppresses the ping, the default-visible update setting still sends it, and a legacy marker without the field still sends it.
  • The regression captures the callback and substitutes a notification-only runner.stop; it sends no OS signal and does not stop a live gateway.

Verification:

  • Focused Python suite: 87 passed
  • The three lifecycle cases also pass when applied to GitHub's current main + PR merge ref
  • Ruff and git diff --check: passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages 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