[Bug]: Linux update --apply ends client-owned `cua-driver mcp` stdio servers (installer pkill -x backstop)
What happens
On Linux, cua-driver update --apply (and a plain run of _install-rust.sh) ends every process named cua-driver on the host, including the cua-driver mcp stdio servers that running MCP clients own. Those agent sessions lose the driver in the middle of their work. The updater process itself is also a cua-driver process, so update --apply exits with status 143 (SIGTERM) even when the install succeeds.
The cause is stop_cua_driver_daemons in libs/cua-driver/scripts/_install-common.sh: after systemctl --user stop cua-driver-rs.service, the Linux branch runs pkill -x cua-driver as a backstop. On Linux there is no daemon to restart for stdio MCP use, and a running stdio server keeps working on its old inode after the packages/current symlink flips.
Reproduction (0.38.0, Debian 12, no display)
work=$(mktemp -d)
cp /bin/sleep "$work/cua-driver"
"$work/cua-driver" 600 & # stands in for a client-owned `cua-driver mcp`
victim=$!
curl -fsSL -o "$work/install.sh" \
https://github.com/trycua/cua/releases/download/cua-driver-rs-v0.38.0/_install-rust.sh
HOME="$work/home" bash "$work/install.sh" --no-modify-path
kill -0 "$victim" && echo survived || echo "killed by installer"
Output:
==> stopping any running cua-driver daemons before swap
cua-driver-rs 0.38.0 installed.
killed by installer
The victim ran from a different HOME than the install target, so the backstop is not limited to the install being replaced.
With real MCP clients, the update log also shows the backstop fail on processes it cannot signal:
Note: 15 cua-driver process(es) still running after best-effort kill (...)
They are probably owned by another user, or are ignoring SIGTERM.
Expected
An update does not end stdio MCP servers that clients own. Options:
- On Linux, stop only the supervised
servedaemon (the systemd unit), or only processes whose executable is under the install root being replaced. - Keep the symlink flip atomic and let running stdio servers finish on the old release, as the release directory is retained anyway.
- Exclude the updater's own pid and its parent from the stop.
Related
- The installer also appends an
export PATH=...line to the shell rc file on each run when~/.local/binis not on the installer's PATH (for example under a systemd user timer). After daily updates one rc file had 8 identical copies.--no-modify-pathworks around it; a check for an existing line would fix it.
Hi @DoWhileGeek ,
I'd like to take this issue!
Approach:
- Remove blanket
pkill -x cua-driveron Linux in_install-common.sh: Stop only the supervised systemd user service (cua-driver-rs.service). - Safeguard running stdio processes & updater: Let active MCP stdio sessions finish on their existing inode via the atomic symlink swap, and ensure the updater process (
$$) isn't killed. - De-duplicate shell RC PATH exports in
_install-rust.shbefore appending.