---
name: live-agents-lock-target-debug-spt-exe
description: "on this host the live agents RUN target/debug/spt.exe, so any rebuild of the spt bin fails with os error 5; use a redirected CARGO_TARGET_DIR for e2e work"
metadata: 
  node_type: memory
  type: project
  originSessionId: 7755f304-48e2-4a81-8b92-79c5f42ce085
  modified: 2026-08-02T00:02:29.581Z
---

The live spt-core agents on hfenduleam (doyle, flynn, perri, liam + the daemon) execute the DEV BUILD directly: `C:\Users\decid\Documents\projects\spt-core\target\debug\spt.exe`. So `cargo test -p spt --test <any e2e>` — anything that relinks the `spt` bin — dies with:

```
error: failed to remove file `...\target\debug\spt.exe`
Caused by: Access is denied. (os error 5)
```

It is INTERMITTENT (it links fine in the gaps between agent invocations), which makes it read like a flaky build rather than a lock.

**Why:** killing the holders is not an option — they are the live agent perches, including my own. Waiting for a gap is a coin flip on a host that is always working.

**How to apply:** run `spt` e2e suites with the target dir redirected — NOT into the session scratchpad (superseded 2026-08-01: scratchpad targets ate 112 GB and killed the v0.50.0 floor, see [[scratchpad-target-trees-eat-the-box]]) but via the `.worktrees/gate-target` junction per [[worktree-target-junction]]. Then `cargo build --bin mock-shell` (e2e suites need the sibling binary; `--test x` alone does NOT build it) before `cargo test -p spt --test ...`. Follow-ons: (1) e2e suites leave `spt.exe` ORPHANS that hold the redirected exe on the next run — reap by PATH ONLY, never a bare name-match kill (that takes down the live agents); (2) `cargo clippy`/`cargo check`/lib tests need no redirect — they emit no exe; (3) **the e2e lane cannot run FROM a live endpoint at all** (todlando, 2026-08-01 W5): with `$SPT_ENDPOINT_ID` set the suites fail via `DAEMON_STOP_REFUSED`, and the failed run leaves the exe-holding orphans behind — clear the marker or run from a non-endpoint shell. Related: [[daemon-lib-tests-deadlock-on-live-host]], [[spt-verification-gates]], [[alarm-every-test-run]].
