Skip to content

usage anchor lacks provider identity: silent drift when provider changes under an unchanged base_url #1027

Description

@pm25coder

Reader feedback (Dev.to comment 3dicj by heinrichneb, source link at bottom): the anchor now dies on a deliberate switch, but what about the provider changing underneath the same base_url? Gateway reroutes, silently updated model versions: the hostname slug says 'same provider', the tokenizer disagrees anyway, and the anchor looks healthy while it drifts.

Verified against current master (11245ba):

  • The usage anchor is a tuple (real prompt_tokens, local estimate) only - daemon.py:2597-2599. It never records which provider/model produced the real number.
  • Invalidation runs on exactly one path: an explicit model switch where api_model != old_model (daemon.py:3566-3571) calling _invalidate_usage_anchors_on_switch (daemon.py:2974).
  • A provider change underneath an unchanged base_url/model alias (gateway reroute, silent model update) therefore keeps the old provider's real prompt_tokens as the projection base. If the new provider reports tokens differently, the auto-compact projection under-counts - the emrg: usage-anchored auto-compact + stable system prefix for prompt cache (rants 2026-08-23T13:28:50, 13:54:14) #946 failure mode (148K estimated vs 222K real, gate never fired) can recur with no declared switch and no signal.

Reader's suggestion: a drift threshold that forces a re-anchor even when no switch was declared - the anchor falsifiable by its own number, not only by announced events. E.g. compare each new real prompt_tokens against the anchored base; on deviation beyond a threshold, re-anchor and append an anchor_drift event (the drift-measurement machinery from #995/#1013 could be reused).

Secondary suggestion: add a README metric - median time from reader-found boundary to merged fix (the 50-min loop claim becomes a measured number).

Source: https://dev.to/pm25coder/50-minutes-from-issue-to-merged-fix-when-the-readers-find-the-boundary-you-shipped-past-20g5 (comment 3dicj, 2026-08-26T20:43Z)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions