Skip to content

fix(gateway): ignore unloaded systemd units in forensics - #37324

Open
Pluviobyte wants to merge 1 commit into
NousResearch:mainfrom
Pluviobyte:codex/systemd-loadstate-forensics
Open

fix(gateway): ignore unloaded systemd units in forensics#37324
Pluviobyte wants to merge 1 commit into
NousResearch:mainfrom
Pluviobyte:codex/systemd-loadstate-forensics

Conversation

@Pluviobyte

Copy link
Copy Markdown
Contributor

Summary

  • query systemd LoadState together with TimeoutStopUSec before trusting shutdown timing data
  • skip missing, non-loaded, or incomplete unit records so nonexistent user units do not produce false mismatch diagnostics
  • add regression coverage for loaded, not-found fallback, non-loaded states, and missing LoadState outputs

Fixes #36755.

Validation

  • .venv/bin/python -m pytest tests/gateway/test_shutdown_forensics.py::TestCheckSystemdTimingAlignment -q
  • .venv/bin/python -m pytest tests/gateway/test_shutdown_forensics.py -q -k "not test_spawns_subprocess_and_writes_output"

Note: the full test file has one local macOS environment failure in test_spawns_subprocess_and_writes_output because the diagnostic spawn returns None here; the new systemd timing coverage passes.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression fix. The premise remains present on current main: gateway/shutdown_forensics.py:367-389 queries systemctl --user first and trusts TimeoutStopUSec without checking the unit's load state, while gateway/run.py:6733-6745 consumes that result for the startup warning.

The PR's LoadState=loaded gate addresses the documented not-found default-value path and correctly permits the subsequent system-manager query. Its tests cover the loaded case, user-to-system fallback, non-loaded replies, and omitted LoadState. GitHub currently reports the PR as mergeable; the narrow change should be directly salvageable.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 13, 2026
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 P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(diagnostics): check_systemd_timing_alignment false-positive — systemctl show returns default 90s for nonexistent --user unit

3 participants