Repository navigation
fix(ccusage): parallelise all-agent loading - #1066
Conversation
All-agent reports previously loaded each coding-agent source one after another. That made the unified reports wait for every source serially even though the loaders operate on independent local data directories. Run the source loaders through scoped threads and collect their results over a channel so progress can update as each source finishes. The final rows are sorted back into the existing agent order before aggregation, preserving JSON and table output while reducing wall-clock time for multi-source reports. Add a regression test that requires two agent loaders to overlap, which guards against accidentally returning this path to serial execution.
|
@coderabbitai please review this PR. The key change is that all-agent source loaders now run concurrently, while final row ordering remains deterministic. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 9f7d1e7 | Commit Preview URL Branch Preview URL |
May 19 2026, 03:59 PM |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 12073
🟡
|
📝 WalkthroughWalkthroughAgent loading is refactored: shared pricing is loaded once, per-agent ChangesConcurrent Agent Loading
Sequence Diagram(s)sequenceDiagram
participant Main
participant LoaderThread
participant Channel
participant Progress as ProgressAgent
Main->>LoaderThread: spawn scoped thread with AgentLoadSpec.loader()
LoaderThread->>Channel: send (index, agent, progress_agent, result)
Main->>Channel: receive messages
Main->>Progress: mark success/failure per agent
Main->>Main: join threads, detect panics
Main->>Main: sort by spec index and return results or first error
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRsSuggested labels
Poem
🚥 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)
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 |
Clarify why unified weekly and monthly reports still load daily source rows before aggregation by spelling out the load-kind mapping with an explicit match. Make the concurrency regression test use distinct progress agents, matching production behaviour more closely. Also make multi-agent error reporting deterministic by selecting the lowest declaration index after all worker results have been collected.
|
@coderabbitai addressed the review notes in d0596c5.
Validation after the fix:
Please review again. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 11548
The implementation is clean and solid. Happy to approve. (´。• ᵕ •。`) ♡ [approve] |
Bring in the latest main branch so the PR is mergeable. Resolve the all-agent adapter conflict by keeping the parallel loader path and adding the newly introduced Kilo source to the same concurrent load set. This preserves the new source support from main while keeping unified reports parallel. Validation after resolving the merge: - pnpm run format - pnpm typecheck - pnpm run test
|
@coderabbitai merged latest origin/main and resolved the conflict by keeping all-agent loading parallel while adding the new Kilo source to the concurrent loader set. Validation after the merge:
Please review the updated branch again. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 12215
No issues introduced by the merge. (´。• ᵕ •。`) ♡ [approve] |
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-arm64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local 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 fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local 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 fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
Bring in the latest main branch so the PR remains mergeable. Resolve the all-agent adapter conflict by preserving the parallel loader and adding the newly introduced Hermes source to the concurrent load set alongside Kilo. This keeps current source support from main while preserving the all-agent parallelisation. Validation after resolving the merge: - pnpm run format - pnpm typecheck - pnpm run test
|
@coderabbitai merged latest origin/main again and resolved the new Hermes conflict by keeping the all-agent loader parallel and adding Hermes to the concurrent load set. Validation after this merge:
Please review the updated branch again. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 12898
No issues introduced by this merge. (´。• ᵕ •。`) ♡ [approve] |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local 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 fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local 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 fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
Summary:
Testing:
@coderabbitai please review this PR.
Summary by cubic
Parallelized all-agent source loading to speed up unified reports while keeping output order stable. The concurrent set now includes Hermes and Kilo, and a regression test enforces overlapping loaders to prevent a return to serial execution.
load_agent_rows_parallel(scoped threads + channel) with per-agent progress; panic-safe.metadata_agentsfor Session.Written for commit 9f7d1e7. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
Performance
Reliability
Tests