---
name: test-subagent-stalls-on-hanging-test
description: A test subagent (spt-test-engineer) wrapping test runs in blocking until-loops stalls forever if a test it spawned HANGS; take over and bisect yourself.
metadata: 
  node_type: memory
  type: feedback
  originSessionId: ba9196fa-7544-41c6-854e-b36cebc3b771
---

When a delegated test subagent (e.g. [[delegate-tests-to-spt-test-engineer]]) runs suites via blocking `until <marker>; do sleep; done` loops, a HANGING test stalls it indefinitely — its loop never sees the completion marker, so it just keeps "coming to rest" with no result (saw ~50 min wasted on a P1c run). The subagent's owl perch keeps spawning (w185/w186/w187…) and its background cargo keeps running.

**Why:** spt-daemon e2e tests hang (not crash) on this bug class — `render_until`/`read_output_until` block forever when expected output never arrives. The subagent's until-loop can't distinguish "still running" from "hung."

**How to apply:** If a test subagent rests repeatedly with no final result, suspect a hung test. Don't wait. (1) `Get-CimInstance Win32_Process -Filter "Name='cargo.exe'"` + look for a long-lived `<suite>-<hash>.exe` test binary (minutes = hang); check `CommandLine` for which suite. (2) `TaskStop` the subagent so it stops respawning cargo. (3) Kill the orphan test/cargo procs by PID — SPARE the live daemon/psyche (filter by CreationDate; test procs are from the run window). (4) Bisect yourself: `--list` the suite, then run tests timeout-wrapped (`timeout 90 cargo test … <name> -- --exact --nocapture`) to pin the hanger. (5) On this Windows box, the heavy attach/inject e2e suites also just run SLOW under `--test-threads=1` + concurrent load — a suite that times out at 360s often passes clean isolated in seconds, so re-run isolated before concluding "hang." Always timeout-wrap test runs (`timeout … ; EXIT=$?`, 124=hang) so a hang surfaces as a clean signal, never an open-ended wait.
