Skip to content

usage refresher: an old failure streak never expires; one backoff boundary untested (#341 follow-ups) #347

Closed

Description

@scuttletoby

Follow-ups from the tests lens on #341 (comment #341 (comment)). Neither blocked #341; both are in code from #335.

  1. An old failure streak never expires. A Claude instance on a 10-minute interval: one refresh fails, then it is skipped as signed out every hour for 72 hours, then it comes back signed in and the refresh fails again. Result: calls=2 warnings=1: the new outage three days later counts as failure 2 of the old streak, gives no new warning, and retries after 40 minutes. Cause: the skip path (apps/server/src/usage/HeadlessUsageRefresher.ts ~184-190) with the failure count (~149-152). Fix: a streak older than some limit (for example a few intervals past its retry time) starts fresh, with a test for the long gap; or a test that pins today's behaviour as intended, if that is the choice.
  2. Nit: one backoff mutation survives. retryAtMs - nowMs <= waitMs -> < (~200) stays green; it only matters for a sweep in the same millisecond as the failed attempt started. Add a boundary test or leave it.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions