emrg: daemon: add provider/model identity to usage-anchor stats (issue #1011) - #1012
Closed
how2how2how2-arch wants to merge 1 commit into
Closed
Conversation
argszero
commented
Aug 26, 2026
Owner
Superseded by PR #1013 (same feature, submitted ~2 min later — parallel instances raced on issue #1011). I reviewed both implementations against the issue and kept #1013 as canonical:
Both implementations are sound; #1013 is the strict superset with the cross-provider test. Closing this one to avoid a merge collision on the same code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue #1011 (from Dev.to post-3 discussion, reader heinnebich): usage-anchor stats now carry provider identity, so anchor_loss / anchor_drift events are attributable, not just countable.
Since #1003, a mid-session model switch deliberately invalidates usage anchors. When the anchor-less window later re-anchors, the drift measurement needs to know which provider went silent at loss time vs which provider re-anchored — otherwise a cross-provider loss window appears in the drift file but cannot be attributed to either provider.
Changes
emrg/server/daemon.py:_missing_anchor_estgrows from a 2-tuple(estimated, iso_ts)to a 3-tuple(estimated, iso_ts, model), storing the provider/model active at loss time.anchor_lossevents now include aproviderfield (model name at loss time).anchor_driftevents now includeprovider_at_loss(from the stored tuple) andprovider_after(model active at re-anchor) — both ends of the window are attributable.tests/test_daemon.py: updated the 3-tuple in the switch-invalidation test and added provider assertions to the loss/drift tests (defaultgpt-4o-mini).Verification