fix(ccusage): stabilize loading progress#1002
Conversation
Replace the per-agent picospinner instances used by the all-agent reports with one shared progress spinner. Multiple spinner components and pricing log output were competing for the same TTY while apps/ccusage/dist/index.js loaded usage logs, which left duplicated loading lines in cmux. Suppress ccusage logger output only while the TTY progress spinner is active so pricing fetch messages do not corrupt the loading display. JSON and non-TTY output paths are unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughConsolidates per-agent spinners into a single Spinner whose text is computed from a shared per-agent state map; runAllReport now preserves/restores logger.level, stops progress and sets exit code on failures; tests added for the progress-text formatter. ChangesProgress and Error Handling
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/ccusage/src/commands/all.ts[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: Oops! Something went wrong! :( ESLint: 9.35.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'eslint-plugin-format' imported from /node_modules/.pnpm/@antfu+eslint-config@4.19.0_@vue+compiler-sfc@3.5.30_eslint@9.35.0_typescript@5.9.2_vit_670a2c5c75d4275eabd7bc195a173ee6/node_modules/@antfu/eslint-config/dist/index.js Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
@ccusage/amp
ccusage
@ccusage/codex
@ccusage/opencode
@ccusage/pi
commit: |
ccusage performance comparisonThis compares the PR build against the base branch build on the same CI runner. Committed fixture performanceCommitted small fixture for stable PR-to-PR feedback and output-shape regressions. Fixture:
Large real-world-shaped fixture performanceGenerated fixture around 1 GiB shaped from aggregate local Claude-log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixture. Fixture:
Package size
Lower medians and smaller packed package sizes are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/ccusage/src/commands/all.ts (1)
839-841:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winCapture the original logger level before JSON-mode mutation.
Line 856 currently snapshots
logger.levelafter Line 840 sets it to0for JSON mode, so the prior level is lost and cannot be restored correctly at the end of the function.Suggested fix
async function runAllReport(kind: ReportKind, options: AllOptions): Promise<void> { + const originalLoggerLevel = logger.level; if (options.json === true) { logger.level = 0; } @@ let rows: AllRow[]; const progress = createAllLoadProgress(shouldShowAllLoadProgress(options)); - const originalLoggerLevel = logger.level; try {Also applies to: 856-857, 868-870
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/ccusage/src/commands/all.ts` around lines 839 - 841, Before you mutate logger.level for JSON mode, capture the existing level into a local variable (e.g., originalLogLevel) so it can be restored later; specifically, move the snapshot of logger.level to just before the block that does if (options.json === true) { logger.level = 0; } and then restore logger.level = originalLogLevel at the function end where you currently reset the level. Apply the same change for the other affected regions (the snapshot/restore around lines 856-857 and 868-870) so you always save the prior logger.level before setting it to 0 and restore that saved value afterwards.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/ccusage/src/commands/all.ts`:
- Around line 839-841: Before you mutate logger.level for JSON mode, capture the
existing level into a local variable (e.g., originalLogLevel) so it can be
restored later; specifically, move the snapshot of logger.level to just before
the block that does if (options.json === true) { logger.level = 0; } and then
restore logger.level = originalLogLevel at the function end where you currently
reset the level. Apply the same change for the other affected regions (the
snapshot/restore around lines 856-857 and 868-870) so you always save the prior
logger.level before setting it to 0 and restore that saved value afterwards.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 92cf047d-7f95-448d-87ea-a48f5ba79a1c
📒 Files selected for processing (1)
apps/ccusage/src/commands/all.ts
Capture the original logger level before JSON mode silences output, so the all-agent report restores the caller-visible logger state after loading.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 302ccbb | May 16 2026, 11:09 AM |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Addressed CodeRabbit’s logger-level feedback in 302ccbb by capturing the original logger level before JSON-mode mutation. Latest CodeRabbit run reports no actionable comments, and Cubic found no issues. |
Summary
Validation
Summary by cubic
Stabilizes the
ccusageall-agent loading display by replacing per-agent spinners with a single progress line and silencing logs while it runs. Prevents duplicated or corrupted lines in TTY (e.g., cmux); JSON and non‑TTY behavior is unchanged.ccusagelogger while the spinner is active; always restore the original level after the run, including when JSON mode silences output.Written for commit 302ccbb. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
Improvements
Bug Fixes
Tests