fix(runner): guard against duplicate daemons for the same runner_id (#46) #49
fix/runner-duplicate-guard
into main
Closes half of #46 (the runner-side duplicate guard).
A runner’s single-instance check was keyed on the --pid-file path, so two daemons for the same runner_id but different --pid-file both started — and the host ran the runner twice, exceeding its parallel config. Found live on carl (parallel:1) running two CI jobs at once (a stale anvil-runner.service next to anvil-runner-default.service, using runner.pid vs runner-default.pid), which thrashed the box into CI timeouts.
Fix: a lock keyed on the runner_id (pid_file::identity_path), acquired at startup independent of --pid-file, so any second daemon for the same runner is refused with a clear message.
Companion server-side fix (heartbeat capacity telemetry) is in fangorn/anvil. Mitigation already applied on carl (legacy unit disabled).
🤖 Generated with Claude Code