Skip to content

emrg: usage-anchor stats — attach provider/model identity to loss/drift events (#1011) - #1013

Merged
argszero merged 1 commit into
masterfrom
feature/anchor-stats-provider-identity
Aug 26, 2026
Merged

emrg: usage-anchor stats — attach provider/model identity to loss/drift events (#1011)#1013
argszero merged 1 commit into
masterfrom
feature/anchor-stats-provider-identity

Conversation

@argszero

Copy link
Copy Markdown
Owner

Implements #1011 — attach the active provider/model identity to anchor_loss and anchor_drift events so cross-provider loss windows are attributable (heinrichneb: "a counter that can't say WHICH provider went silent is half a counter").

Changes

  • New _provider_slug(base_url): deterministic provider identity derived from the LLM base_url hostname (api.openai.com / api.deepseek.com / localhost), no heuristics, no DNS
  • anchor_loss events now carry model + provider — the identity that went silent
  • anchor_drift events now carry loss_model / loss_provider (who went silent) plus model / provider (who finally re-anchored)
  • _missing_anchor_est extended to (est, loss_ts, loss_model, loss_provider) so the drift window stays attributable end to end

Tests

  • Extended test_usage_anchor_loss_event_is_countable: asserts model/provider fields on the loss event
  • Extended test_usage_anchor_drift_measured_on_reanchor: asserts loss identity + re-anchor identity on the drift event
  • New test_usage_anchor_cross_provider_window_attributable: loss detected under deepseek, model switch to openai, re-anchor under openai — every event names its provider

Verification

  • pytest: 1106 passed, 1 skipped (was 1105)
  • Import check + CLI help OK
  • doc-count guard 4/4 (Agent.md python count 1106 -> 1107)

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260826-215446 (1/3)

Deep review of head 9144e69 (base 1a609fb, MERGEABLE/CLEAN, +93/−4 across 3 files):

  • _provider_slug(base_url) — deterministic provider identity from base_url hostname (api.deepseek.com / api.openai.com / localhost), no heuristics, no DNS; unparsable input falls back to the raw string so events stay attributable.
  • anchor_loss events now carry model + provider (who went silent); anchor_drift carries loss_model/loss_provider (loss-time identity, stored in the extended 4-tuple _missing_anchor_est) plus model/provider (re-anchor identity) — both ends of a cross-provider loss window are attributable, addressing #1011's core ask.
  • New test_usage_anchor_cross_provider_window_attributable covers the exact issue scenario: loss under deepseek → switch to openai → re-anchor, asserting every event names its provider; existing loss/drift tests extended with identity assertions.
  • Agent.md python count 1106→1107 maintained; doc-count guard 4/4.

Local verification: usage-anchor tests 9/9, doc-count 4/4. CI run 32976242247: test + test-windows both pass. No ❌ found.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260826-220708 (2/3)

Re-verified head 9144e69 (unchanged since cycle 215446's 1/3), MERGEABLE/CLEAN, CI run 32976242247 both green (test + test-windows). Local re-check: usage-anchor tests 9/9, doc-count guard 4/4. No ❌ between votes. Prior deep review stands — provider identity on both ends of loss/drift windows (issue #1011).

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260826-221428 (3/3)

Re-verified head 9144e69 (unchanged since 1/3 and 2/3), MERGEABLE/CLEAN, CI run 32976242247 both green, local usage-anchor 9/9 + doc-count 4/4. Three consecutive approvals (215446 → 220708 → 221428) with no ❌ — merging.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@argszero