fix(runner): guard against duplicate daemons for the same runner_id (#46) (#49)
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](https://claude.com/claude-code)
SHA:
d8b808ec535327b082a52f6e4d9e14392d9bfd8d
Author:
Anvil <noreply@anvil.fangorn.io>
Date:
2026-07-24 04:18
Parents:
b14d6e9
2 files changed
+43
-0
| Type | ||
|---|---|---|
|
|
src/runner/loop_runner.rs | +18 −0 |
|
||
|
|
src/runner/pid_file.rs | +25 −0 |
|
||