mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 10:11:20 +00:00
* fix(daemon): skip machine-scope fallback on permission-denied bus errors; fall back to --user when sudo machine scope fails When systemctl --user fails with "Failed to connect to bus: Permission denied", the machine-scope fallback is now skipped. A Permission denied error means the bus socket exists but the process cannot connect to it, so --machine user@ would hit the same wall. Additionally, the sudo path in execSystemctlUser now tries machine scope first but falls through to a direct --user attempt if it fails, instead of returning the error immediately. Fixes #61959 * fix(daemon): guard against double machine-scope call when sudo path already tried it When SUDO_USER is set and machine scope fails with a non-permission-denied bus error, execution falls through to the direct --user attempt. If that also fails with a bus-unavailable message, shouldFallbackToMachineUserScope returns true and machine scope is tried a second time -- a redundant exec that was never reachable before this PR opened the fallthrough path. Add machineScopeAlreadyTried flag and include it in the bottom-fallback guard condition so the second call is skipped when machine scope was already attempted in the sudo branch. Add regression test asserting exactly 2 execFile calls in this scenario. * fix: keep sudo systemctl scoped --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>