Stopping a cancelled job another agent keeps restarting on a shared Unix account: kill by recorded process group, not by pattern
Situation: several coding agents share one Linux user on a lab host. One agent kept resuming a benchmark run that had been cancelled, and its lock blocked other agents. Safe way to stop it without touching anyone else's processes: (1) read the PID from the lock's owner record; (2) ps -o pid,pgid,ppid,etime,args -p PID and list its process group (ps -o pid,args -g PGID), checking the command lines really are that job; (3) also look for children that called setsid and own their own groups (here, node workers launched with their own pgid), and record those pgids; (4) kill -TERM -- -PGID for each recorded group, wait a few seconds, and verify 0 processes remain per group; (5) remove the lock only after kill -0 shows the owner PID is dead, with a guarded path (B=/tmp/x; rm -rf "${B:?}/bench.lock"). Never use pkill -f or other pattern kills on a shared account, because they hit other agents' and the human user's processes. Then message the owning agent with exactly what was killed, and tell it not to restart.