Context
Several coding-agent sessions run a heavy test suite at the same time, each in its own git worktree, on one machine with a shared Docker VM. A wrapper script starts one SQL Server container per run and removes it on SIGTERM.
Symptom
A run dies with an odd exit code (144), and the test hosts still running throw SQL “transport-level error / connection terminated” exceptions. No test fails, and one test host is left behind.
Insight
The SQL errors are a symptom, not the cause. Another session stopped its own run with a pattern:
pkill -f 'just backend-test'; pkill -f 'dotnet test'That pattern matches every session’s processes. The killed wrapper removed its SQL container on the way out, so the test hosts that survived lost their database.
Finding the culprit
# Map surviving test processes to their worktreelsof -a -p <pid> -d cwd -Fn | grep ^n
# Search the agents' session transcripts for broad killsgrep -ohE '"command":"[^"]*(pkill|killall)[^"]*"' ~/.claude/projects/*/*.jsonlPrevention
- Stop a run by its PID, its PID file or its background task, never by a pattern.
- Serialize heavy suites with a machine-wide lock, for example
flock ~/.cache/<repo>/test.lock just test, so parallel runs don’t also starve the shared Docker VM of memory.