Repository navigation
3.0.1: keep the user manager bus when the updater relaunches itself - #71
Merged
promptclickrun merged 2 commits intoSep 29, 2026
Merged
Conversation
The systemd-run --user launcher runs with a deliberately stripped environment, which also stripped the locator the client needs to reach the per-user service manager. On a host where that launcher runs without an inherited XDG_RUNTIME_DIR, the updater job is rejected and the update stops with "The service manager rejected the updater job". Keep a valid XDG_RUNTIME_DIR when the environment provides one, derive /run/user/<uid> when it exists, and carry DBUS_SESSION_BUS_ADDRESS when it is set. Nothing else about the launcher environment changes.
promptclickrun
previously approved these changes
Sep 29, 2026
promptclickrun
left a comment
Owner
There was a problem hiding this comment.
Thanks for this, and for the clear write-up with the systemd-run repro. It made the problem easy to confirm.
Approved. We'll merge it today.
What we checked:
- The change only affects the environment handed to
systemd-run --user/launchctl. The updater itself still starts with a clean environment throughenv -i, so the bus locator doesn't leak into it. PATH,HOMEandLANGare unchanged, and on macOS nothing changes, since/run/user/<uid>doesn't exist there.- The new tests pass, and the locator tests fail on
mainwithout the fix. The existing updater tests behave the same with and without this PR.
Two optional thoughts. Neither is needed for this PR, and we're happy to handle them later ourselves:
- If
XDG_RUNTIME_DIRis set but points at a missing directory, it's dropped without trying the/run/user/<uid>fallback. That's rare, and it's no worse than today. test_falls_back_to_existing_per_user_runtime_directoryis skipped wherever/run/user/<uid>doesn't exist, which likely includes CI. Patchingos.path.isdir, as the neighbouring test does, would let it run everywhere.
Plugin releases are batched now (promptclickrun#73): the release PR bumps the version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Small heads-up: I pushed one commit that takes the version bump out of this PR. We've just moved to batched plugin releases (#73): pull requests leave the version alone, and a separate release PR bumps it and ships the batch. Your fix goes out in the next plugin release, and you'll be credited in its notes. Nothing else in your change was touched. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The plugin's detached updater (
_launch_detached_worker→systemd-run --user …) builds a deliberately stripped launcher environment ofPATH/HOME/LANG. That also strips the locator a client needs to reach the per-user service manager, so on a host where the launcher runs without an inheritedXDG_RUNTIME_DIRthe job is rejected and the update stops with:Reproduced on the affected host (Hermes Agent, Debian/LXC,
loginctl show-user→Linger=yes,State=active,/run/user/0/buspresent):The host is healthy — only the launcher environment lacked the bus locator, while the failure text points at the host ("This host cannot launch a restart-safe updater").
Change
_launcher_env()now:XDG_RUNTIME_DIRwhen the environment provides one and the directory exists,/run/user/<uid>when that directory exists,DBUS_SESSION_BUS_ADDRESSwhen it is set,PATH,HOMEandLANGare unchanged, so a host that worked before behaves identically.Tests
tests/test_update_launcher_env.py(unittest, 6 tests): existing runtime directory is carried,/run/user/<uid>fallback,DBUS_SESSION_BUS_ADDRESSpass-through, base keys unchanged, no fallback when/run/user/<uid>is missing, and a non-existentXDG_RUNTIME_DIRis dropped.All 6 pass. Against current
mainthe three locator tests fail (AssertionError: None != '/run/user/0'), so the regression is pinned.Version bumped to 3.0.1 (
plugin.yaml,PLUGIN_VERSIONinloopdy_plugin/link_contracts.py).