The per-batch release test made device.is_mps() return true and then ran
the real free_gpu_memory(), which reached torch.mps.empty_cache() and
torch.mps.synchronize(). On an MPS-capable host this unmarked CPU test could
touch real accelerator state. Stub both MPS calls (and the CUDA cache calls
as a guard) and assert their call counts, so the release path is still
exercised without hardware.
_collect_activations ran gc.collect() every 4 batches on every host (about 850 calls per refusal-pack probe), and each call costs more as the live heap grows. On CPU-only hosts the per-batch release is now skipped (new device.per_batch_release_needed()); with CUDA or MPS it is unchanged, and stage-boundary cleanup still collects everywhere. Tests pin the CPU skip and the accelerator release.
Refs #684
(cherry picked from commit 2e8c362430830f1b4ce23757b9a364596bcee6ac)
Adapted for upstream: _admit_phase does not exist upstream (grep finds no
definition in obliteratus/), so dropped the internal mock and rewrote the
main test to group model forwards per cache policy instead of assuming a
single two-prompt batch (upstream batches by available memory; on CPU-only
hosts each prompt runs its own forward). Kept docs/attention-cache-
qualification.md verbatim (no hostnames, receipts, or private refs; the
#95/#96/#97 refs are public issue numbers) and the
ci/test-risk-map.json registration, which matches the final test file name.