---
name: daemon-lib-tests-deadlock-on-live-host
description: spt-daemon lib lifecycle tests deadlock when live daemons share the Windows host; harness auto-backgrounds cargo and orphaned test bins wedge the target lock across away-gaps.
metadata: 
  node_type: memory
  type: project
  originSessionId: 679315a6-a1b4-495a-9c14-310f35a71090
---

`cargo test -p spt-daemon --lib` on the dev Windows host (HFENDULEAM) **deadlocks** on the daemon-lifecycle modules — `seedmap::` (request_stop_barrier_holds_until_no_listener, stop_op_acks_then_serve_returns), `serveprobe::`, `shellwake::`. The whole test binary wedges (even trivial sibling tests like `take_absent_is_none` report "running over 60s"). Cause is **environmental, not the code**: those tests bind listeners / spawn daemon process trees and collide with the *live* `spt-core` daemons running from `AppData\Local\spt-core\bin\spt.exe` (e.g. `daemon run --detached`, `daemon brain`), plus general load. The crypto/release modules run fine — saw 352 `ok`, 0 real failures, only the 5 lifecycle tests never returning.

**Compounding gotcha:** the Claude harness auto-backgrounds long `cargo test` invocations. When the user is away for an hour+, the backgrounded run dies but leaves an **orphaned `target/debug/deps/spt_daemon-*.exe` test binary alive**, holding a file handle on the deps dir → the next `cargo` build/relink queues forever (0-byte output, idle CPU, no rustc). Multiple stale `cargo` procs then stack up behind the lock.

**How to unwedge:** `Get-Process cargo,rustc,spt_daemon-*` → kill the stale cargo procs and the orphaned `spt_daemon-*` test binaries (match by StartTime to the dead run; keep the current run's). The `spt-core\bin` daemons do NOT hold the `target/` lock (installed path, not `target/debug`) — leave them. See [[test-subagent-stalls-on-hanging-test]] (hung-test takeover) and [[workspace-bin-name-collision]] (shared target/ hazards).

**Practical rule:** don't block a commit on a green `spt-daemon --lib` here for a change that doesn't touch daemon lifecycle. Verify the touched module's tests pass (e.g. `release::` 18/18), rely on `clippy --workspace --all-targets` to prove all daemon test targets compile, and lean on **CI (clean runners, no live daemons) as the authority** for the full daemon-lib suite. My perch is legacy `AppData\Local\spt\` (the `spt-core\bin` daemons aren't mine).
