vps-health-api/agent/claude-usage
le king fu 123b3c3c8c fix(agent): no double count across midnight, no freeze on a read error, bounded limits read
- aggregate: frozen days are dropped after deduplication, not before. A
  request straddling midnight whose best line sat on a day frozen since
  was counted again on the open day. On equal output the earliest line now
  wins (it was the first one read), so the choice no longer depends on
  which files a beat reads.
- aggregate: unreadable directories, failed stats (ENOENT included) and
  stream errors are counted in `readErrors`; a missing root is still an
  empty scan. The beat then freezes no new day (nextState freeze: false),
  still pushes, and logs `read_errors=N` with no path.
- limits: the response is read chunk by chunk and counted in bytes; past
  256 KiB the stream is cancelled instead of being read in full and
  measured in characters.
- state: a test now covers the chmodSync of a leftover temp file.

Each fix was checked by mutation (13 mutations, 13 red).

Refs #54

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 20:29:29 -04:00
..
aggregate.js fix(agent): no double count across midnight, no freeze on a read error, bounded limits read 2026-10-07 20:29:29 -04:00
limits.js fix(agent): no double count across midnight, no freeze on a read error, bounded limits read 2026-10-07 20:29:29 -04:00
push-claude-usage.js fix(agent): no double count across midnight, no freeze on a read error, bounded limits read 2026-10-07 20:29:29 -04:00
run-claude-usage.sh feat(agent): add the claude-usage agent: plan limits, local cache, push 2026-10-04 15:26:15 -04:00
state.js fix(agent): no double count across midnight, no freeze on a read error, bounded limits read 2026-10-07 20:29:29 -04:00