Skip to content

fix(gateway): query systemd timeout in owning scope - #61532

Closed
zzz163519 wants to merge 1 commit into
NousResearch:mainfrom
zzz163519:fix/shutdown-forensics-systemd-scope
Closed

fix(gateway): query systemd timeout in owning scope#61532
zzz163519 wants to merge 1 commit into
NousResearch:mainfrom
zzz163519:fix/shutdown-forensics-systemd-scope

Conversation

@zzz163519

Copy link
Copy Markdown
Contributor

Summary

Fixes #61003.

check_systemd_timing_alignment() currently probes systemctl --user show before the system manager. On system-scope gateway units, systemctl --user show <missing-unit> can still return success with the default TimeoutStopUSec=1min 30s, so Hermes reports a stale-unit warning even when the real system unit has a sufficient timeout.

This change records the manager scope while reading /proc/self/cgroup:

  • /system.slice/...service queries system systemctl show only
  • /user.slice/...service queries systemctl --user show only
  • unknown cgroup shapes keep the previous fallback order

Tests

Added regression coverage for a system-scope cgroup where the user manager would return the phantom 90s timeout but the system manager reports 4min.

uv run --extra dev python -m pytest tests/gateway/test_shutdown_forensics.py -q
uv run --extra dev python -m ruff check gateway/shutdown_forensics.py tests/gateway/test_shutdown_forensics.py
git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists labels Jul 9, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #54396 — the earliest open PR fixing the same false-positive stale-systemd-unit warning at the same code site (check_systemd_timing_alignment in gateway/shutdown_forensics.py) via the same mechanism: parse /proc/self/cgroup and select the systemctl scope by owner slice (/system.slice→system, /user.slice→user). This PR's system-only query vs #54396's ordered fallback is a minor variant that doesn't change the mechanism (#61017 already carries the same variant and is marked duplicate of #54396). The distinct LoadState-gate cluster (#34734 et al.) is a different mechanism, not this.

@zzz163519

Copy link
Copy Markdown
Contributor Author

Closing in favor of the earlier canonical systemd-scope fix in #54396.

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

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shutdown_forensics: false-positive 'Stale systemd unit' warning when unit exists in system scope only

2 participants