{"slug": "do-not-let-one-provider-refresh-make-another-provider-s-cache-look-fresh", "title": "Do Not Let One Provider Refresh Make Another Provider's Cache Look Fresh", "summary": "Agent Island v1.7.1 introduces a provider-scoped cache to prevent one provider's successful refresh from extending the freshness of another provider's stale data. The fix stores separate timestamps per provider, ensuring that cached values are only restored when their individual freshness windows are valid.", "body_md": "A desktop usage view needs a cache for cold starts and temporary network failures. The dangerous shortcut is giving the entire snapshot one freshness timestamp.\n\nIf Claude refreshes successfully while Codex fails, rewriting the shared cache with a new timestamp can silently extend the life of old Codex data. The values are still different, but their trust boundary has been collapsed.\n\nThe fix is to model freshness where failure happens: per provider.\n\nAgent Island v1.7.1 stores Claude data, Codex data, a compatibility timestamp, and separate provider timestamps:\n\n```\nsnapshot = {\n  claude,\n  codex,\n  updatedAt,\n  claudeUpdatedAt,\n  codexUpdatedAt\n}\n```\n\nThe overall timestamp remains useful for decoding older records and rejecting obviously old snapshots. It does not authorize both provider values to restore.\n\nThis is an important distinction. A shared file is an implementation detail. It is not a shared freshness guarantee.\n\nA provider result should be cacheable only when the relevant windows have no error and at least one real signal exists: a positive percentage or a reset timestamp.\n\nA plan label with two zero-percent windows is not enough. Authentication failures and empty responses often produce clean-looking shapes. Caching those shapes turns missing evidence into a confident 0%.\n\nError-bearing values are also unsafe even when they carry percentages from an earlier successful fetch. Those percentages may be useful for the current screen, but saving them with the new time launders stale data into a fresh cache entry.\n\nConsider a refresh where Claude succeeds and Codex times out. The snapshot can save Claude's new value while carrying forward the last valid Codex value. The timestamps must tell the truth:\n\n```\nclaude value: new          claudeUpdatedAt: now\ncodex value: preserved     codexUpdatedAt: old timestamp\n```\n\nIf neither provider produced fresh cacheable data, do not write a new snapshot. Repeated failures must not extend the cache indefinitely.\n\nAn unfetched provider follows the same rule. It may retain a previously valid value, but it never receives a fresh timestamp simply because its peer was fetched.\n\nDuring restore, compare each provider timestamp with the maximum age. Claude may restore while Codex expires, or the other way around.\n\nThat behavior is more honest and more useful than rejecting the whole snapshot. A partial outage can still show one verified provider without presenting both with the same confidence.\n\nSchema evolution needs the same care. A provider response may contain one meaningful usage window and explicitly omit another. It remains cacheable when the real window contains usage or reset evidence. Requiring two fully populated windows would turn a valid response into a permanent cache miss.\n\nA useful policy test suite should prove that:\n\nCache correctness improves the honesty of a usage display. It does not change what the metric means.\n\nUsage percentages and local API-value estimates are not subscription invoices, savings, revenue, user counts, or installs. A technically correct cache should not be used to make a stronger business claim than the underlying source supports.\n\nThe reusable rule is straightforward:\n\nScope freshness to the failing dependency, never renew data you did not fetch, and require evidence before turning an empty response into 0%.\n\nThe full policy, compatibility behavior, and product boundary are in the [canonical engineering article](https://agent-island.dev/blog/provider-scoped-usage-cache/?utm_source=devto&utm_medium=content_distribution&utm_campaign=provider_scoped_usage_cache). The [Agent Island v1.7.1 source](https://github.com/tristan666666/agent-island/releases/tag/v1.7.1?utm_source=devto&utm_medium=content_distribution&utm_campaign=provider_scoped_usage_cache) is public under MIT.", "url": "https://wpnews.pro/news/do-not-let-one-provider-refresh-make-another-provider-s-cache-look-fresh", "canonical_source": "https://dev.to/agentis/do-not-let-one-provider-refresh-make-another-providers-cache-look-fresh-3eif", "published_at": "2026-07-21 20:22:10+00:00", "updated_at": "2026-07-21 20:50:54.958220+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Agent Island", "Claude", "Codex"], "alternates": {"html": "https://wpnews.pro/news/do-not-let-one-provider-refresh-make-another-provider-s-cache-look-fresh", "markdown": "https://wpnews.pro/news/do-not-let-one-provider-refresh-make-another-provider-s-cache-look-fresh.md", "text": "https://wpnews.pro/news/do-not-let-one-provider-refresh-make-another-provider-s-cache-look-fresh.txt", "jsonld": "https://wpnews.pro/news/do-not-let-one-provider-refresh-make-another-provider-s-cache-look-fresh.jsonld"}}