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 a false-positive stale-systemd-unit warning in shutdown forensics. For system-scope gateway services, Hermes was querying systemctl --user show first; systemd returns the default TimeoutStopUSec=1min 30s for unknown user units, so the code could warn on every startup even when the real system unit had sufficient stop time configured.
My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
I searched for existing PRs to make sure this isn't a duplicate
My PR contains only changes related to this fix/feature (no unrelated commits)
I've run pytest tests/ -q and all tests pass
I've added tests for my changes (required for bug fixes, strongly encouraged for features)
I've tested on my platform: macOS local toolchain via uv / Python 3.11
Documentation & Housekeeping
I've updated relevant documentation (README, docs/, docstrings) — or N/A
I've updated cli-config.yaml.example if I added/changed config keys — or N/A
I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
I've updated tool descriptions/schemas if I changed tool behavior — or N/A
Screenshots / Logs
Local proof: the new system-scope and user-scope alignment tests pass, syntax check passes, and git diff --check is clean.
Note: the broader tests/gateway/test_shutdown_forensics.py -q file still has one unrelated preexisting failure in TestSpawnAsyncDiagnostic::test_spawns_subprocess_and_writes_output on this machine; the alignment-specific slice passes.
Duplicate of #54396 (earliest open PR using the same fix). Both parse /proc/self/cgroup and select the systemctl manager scope from the cgroup owner slice (/system.slice -> system, /user.slice -> --user) to fix the false-positive check_systemd_timing_alignment warning. Related cluster: #34734/#36766/#37324/#58735 use the alternate LoadState-gate mechanism; #61003 is the issue this fixes. Maintainer to pick the canonical fix from the cgroup-scope pair (#54396 / #61017).
Thanks for the focused regression fix. Current main still queries systemctl --user before system scope and stops at the first parseable timeout in gateway/shutdown_forensics.py:367-389; that is the faulty path documented in #61003. The cgroup-slice routing in this PR addresses that path while preserving the existing fallback for unrecognized cgroups, and the added tests cover both /system.slice and /user.slice command selection.
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
comp/gatewayGateway runner, session dispatch, deliveryduplicateThis issue or pull request already existsP3Low — cosmetic, nice to havesweeper:blast-containedSweeper blast radius: contained — one narrow path / opt-in / few userssweeper:risk-compatibilitySweeper risk: may break existing users, config, migrations, defaults, or upgradestype/bugSomething isn't working
3 participants
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 a false-positive stale-systemd-unit warning in shutdown forensics. For system-scope gateway services, Hermes was querying
systemctl --user showfirst; systemd returns the defaultTimeoutStopUSec=1min 30sfor unknown user units, so the code could warn on every startup even when the real system unit had sufficient stop time configured.Related Issue
Fixes #61003
Type of Change
Changes Made
.serviceunit.systemctlmanager: system scope for/system.slice/..., user scope for/user.slice/....tests/gateway/test_shutdown_forensics.py.How to Test
uv run pytest tests/gateway/test_shutdown_forensics.py -k CheckSystemdTimingAlignment -quv run python -m py_compile gateway/shutdown_forensics.py tests/gateway/test_shutdown_forensics.pygit diff --checkChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passuv/ Python 3.11Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
git diff --checkis clean.tests/gateway/test_shutdown_forensics.py -qfile still has one unrelated preexisting failure inTestSpawnAsyncDiagnostic::test_spawns_subprocess_and_writes_outputon this machine; the alignment-specific slice passes.