Skip to content

classifyHalt

classifyHalt(tail, limits, holdPct): "usage_limit" | null

Defined in: src/usage-halt.ts:75

Pure halt classifier — unit-testable without the poller.

Returns “usage_limit” when the tail matches AND usage corroborates (or usage is unknown/uncalibrated). Returns null otherwise.

Corroboration rule:

  • If the tail does not match → null (fast exit).
  • If usage is known (at least one window non-null) AND the highest window pct is below holdPct → null (measurable but not near cap; probably not a real halt).
  • Otherwise (usage unknown OR at/above cap) → “usage_limit” (degrade gracefully when telemetry is unavailable so real halts are never silently dropped).

string

UsageLimits

number

"usage_limit" | null