emrg: usage anchor — unconditional bias-shift heartbeat + planted-fire assertions (issue #1072) - #1073
Conversation
…-fire assertions (issue argszero#1072)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 091627
Reviewed the diff on head f4a633c (based on master 32db0c4, single commit).
What I validated
- Heartbeat placement: the unconditional
anchor-bias-heartbeatlog sits after the no-anchor/zero-guard early returns but BEFORE theshift < thresholdgate — so it fires on every computed shift for valid anchors, correctly distinguishing "detector runs, providers stable" from "detector dead". Verified against master's current_detect_silent_anchor_drift. - No-anchor silently skips: on a fresh session (no existing anchor) the heartbeat is NOT emitted (test asserts
anchor-bias-heartbeat not in caplog.text) — correct, nothing to compare against. - Threshold verdict string: since the log's verdict uses the same
_SILENT_DRIFT_THRESHOLDand shift,bias_shift=0.6000 → DRIFT — emitting event(1.5→2.4) andbias_shift=0.0667 → within threshold, no drift(1.5→1.6) both format correctly under%.4f. - Logger name:
caplog.at_level("DEBUG", logger="emrg.server.daemon")matcheslogging.getLogger(__name__)→ resolves toemrg.server.daemon. Correct.
Verification results (local, branch f4a633c)
pytest tests/test_daemon.py -k "silent_drift or silent_provider"→ 2/2 pass- Full
pytest tests/→ 1146 passed + 1 skipped = 1147 (no test-count change; assertions added to existing tests, as the body claims) - Import + CLI green
- Agent.md Python count
(1147)matches - CI: test ✅ pass, test-windows ✅ pass (both green)
Docs the residual 'detector never fired' observability gap from #1072 directly and hermetically. No platform/network dependency. Good to merge.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 092439 (2nd independent vote)
Head unchanged at f4a633c (server detects drift correctly), CI green (test + test-windows). Independently re-validated for this cycle:
pytest tests/test_daemon.py -k "silent_drift or silent_provider"→ 2/2 pass (fresh run on pr1073 branch)- Head
f4a633cstill based on master32db0c4, single commit, MERGEABLE, maintainer can modify
The anchor-bias-heartbeat heartbeat makes the "detector never fired" state measurable (issue #1072), placed correctly after the no-anchor guard and before the threshold gate. Consistent with prior review. Good to merge.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 093143 (3rd consecutive vote → 3/3)
Head unchanged at f4a633c, CI green (test + test-windows), MERGEABLE, maintainer can modify. Independently re-validated for this cycle:
pytest tests/test_daemon.py -k "silent_drift or silent_provider"→ 2/2 pass (fresh run on pr1073 branch)- Sequence of distinct-cycle LGTMs on the current head f4a633c:
091627→092439→093143, no ❌ in between.
The anchor-bias-heartbeat heartbeat makes the "detector never fired" state measurable (issue #1072). Correct placement (after no-anchor guard, before threshold gate) and hermetic assertions. Merge-ready.
Uh oh!
There was an error while loading. Please reload this page.
…tbeat, memory hygiene, GUI fixes) (#1074) Co-authored-by: argszero <argszero@gmail.com>
Fixes#1072 (reader feedback from Dev.to post 4, heinrichneb comment 3dlo4).
Problem
The silent anchor-drift detector (#1029 / issue #1027) only logs when drift actually fires — a quiet detector is indistinguishable from a dead one.
grep emrgd.logfor drift yields nothing whether the detector ran 1000 rounds and saw stable providers, or never ran at all. "Never fired" is not measurable.Changes
1. Unconditional bias-shift heartbeat (
emrg/server/daemon.py)_detect_silent_anchor_driftnow logs EVERY computed shift at debug level before the threshold gate, with a greppable marker:The daemon log file (emrgd.log) runs at DEBUG level, so every anchor round is observable: grep the marker to confirm the detector is alive and see the shift distribution over time. The
logger.warningfor real drift is unchanged.2. Planted-fire test assertions (
tests/test_daemon.py)test_silent_provider_drift_emits_event(the planted fire: bias 1.5 → 2.4, 60% shift): now also asserts the heartbeat appears withDRIFT — emitting eventverdict and the drift warning fires.test_silent_drift_below_threshold_silent(no-drift state): asserts the heartbeat appears withwithin threshold, no driftand NO warning/event — proving the detector runs even when silent.Verification
pytest tests/test_daemon.py -k "silent_drift or silent_provider"— 2/2 passNo platform/network dependency — runs on all CI platforms.