Repository navigation
fix(stats): preserve usage error status in aggregates and doctor - #512
Conversation
JSONL usage logs record per-request status but parseLogFile dropped it, so /stats and doctor always reported successes. Preserve status, count errors in getStats, and surface the count in doctor diagnostics.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Count errors in log statistics src/stats.ts, src/stats.error-status.test.ts |
Statistics preserve recognized error and success statuses and include an error count. The test checks request and error counts, and verifies that recent logs include ERROR. |
Report errors in doctor log information src/doctor.ts |
collectLogInfo reports the error count returned by getStats(1) instead of a constant zero. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: vickyxai
Merge Risk: 
Minimal · up to f45f0
-
The error-count reporting change is consistent across statistics and doctor, with no merge-blocking risk identified.
Pre-merge checks: 
5
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
VickyXAI
left a comment
There was a problem hiding this comment.
Thanks @Tyagiquamar, good catch. parseLogFile was dropping status, so failed requests never showed as ERROR in clawrouter logs and doctor always reported 0 errors. Your test fails on main and passes here. I pushed a small follow-up (f45f0e3): prettier formatting on src/stats.ts (CI's format check would have failed), and removed the now-redundant status cast in formatRecentLogs.
Summary
Summary by CodeRabbit