#5017·hindsight

test-system: bit-exact float pin (abs=1e-12) on the semantic score fails on some runners

Author: gutocarolloCreated Oct 1, 2026Updated Oct 1, 2026

Summary

hindsight-system-tests/tests/test_01_retain_and_recall.py::test_a_retained_memory_comes_back_from_recall pins the semantic score to abs=1e-12, but the value is a 384-dim cosine that differs in its last bits depending on the runner CPU. The test-system (blackbox) job therefore goes red on some runners and green on others for the same code.

What fails

assert berlin.scores.semantic == pytest.approx(0.43465916228227297, abs=1e-12)
E  assert 0.43465914932841954 == 0.43465916228227297 ± 1.0e-12

Delta ≈ 1.295e-8. At ~0.43 the float32 ULP is ≈ 3e-8, and the score is computed from float32 vectors (pgvector/numpy), so the last bits track the runner's SIMD/FMA path.

Evidence: same suite, two outcomes, unrelated PRs

run PR obtained
36796283674 fix/mcp-non-recursive-tool-schema 0.43465914932841954 ❌
36801252195 fix/delta-retry-assistant-cont 0.43465914932841954 ❌
36776379561 fix/embedding-single-batch-con… passes ✅
36760056835 fix/litellm-retry-status-codes passes ✅

Two unrelated PRs produce the identical off value; two other runs of the same suite pass. That is a runner-dependent float path, not a regression.

Note test-system (blackbox) is skipped on main push runs, so this pin has had little cross-runner exposure since the suite landed.

Proposal

The story already tolerates this class of drift for the recency-weighted final score, which is pinned at abs=1e-6 with a comment explaining why. Apply the same reasoning to the deterministic components:

python
# One float32 ULP at ~0.43 is ~3e-8; the vectors are float32 and the cosine's
# last bits track the runner's SIMD/FMA path, so 1e-12 is below the noise floor.
assert berlin.scores.semantic == pytest.approx(0.43465916228227297, abs=1e-6)
assert berlin.scores.reranker == pytest.approx(0.37416573867739417, abs=1e-6)
assert berlin.scores.keyword == pytest.approx(0.30000001192092896, abs=1e-6)

1e-6 keeps the assertion tight enough to catch a changed weighting while absorbing one ULP. Happy to send this as a small PR if you prefer that to changing it inline.