Repository navigation
Description
What happened?
Unified reports (ccusage, ccusage daily, weekly, monthly, session) load every source with the same shared options and never read <source>.defaults, <source>.commands.<report> or commands.<source>:<report>. The config docs say the opposite:
docs/guide/config-files.md:290: "Source-specific settings are also applied when running unified reports such asccusage daily. In that case, each source receives its own merged options before data is loaded."docs/guide/configuration.md:145says the same.
This is a regression from the TypeScript CLI (up to v19.0.3): apps/ccusage/src/commands/all.ts built one merged option set per agent (mergeAllOptions, merging the config under the name <agent> <kind>) and loaded each agent with it. The native Rust CLI (#977) hands one SharedArgs to every loader.
Where it goes wrong on main (e42e1b4):
rust/crates/ccusage-config/src/config.rs:92:option_mapsreads<agent>.*only when the detected command has an agent, andccusage dailyhas none.rust/crates/ccusage-adapter-all/src/loader.rs:117:load_base_rowsbuilds oneloader_sharedand hands it to all 18 loaders.rust/crates/ccusage-adapter-all/src/loader.rs:685and:698hardcodeCodexSpeed::Auto;:219loads pi withcustom_path: None;:246loads OpenClaw withNone. Socodex.defaults.speed,pi.defaults.piPathandopenclaw.defaults.openClawPathhave no effect on unified reports either, even though the same keys driveccusage codex daily,ccusage pi dailyandccusage openclaw daily.
Steps to reproduce
-
Keep pi sessions outside the default directory, for example
/data/pi/sessions. -
Write
.ccusage/ccusage.json:{ "pi": { "defaults": { "piPath": "/data/pi/sessions" } }, "codex": { "defaults": { "speed": "fast", "since": "20260101" } } } -
Compare
ccusage pi dailywithccusage daily: the focused report shows the pi usage, the unified report does not (pi is missing from theDetected:line). -
Compare
ccusage codex dailywithccusage daily: the unified report prices Codex at the auto-detected tier instead of Fast, and ignores thesincebound, so the Codex totals differ between the two reports.
Expected behavior
A unified report loads each source with the options ccusage <source> <report> would use: defaults, then commands.<report>, then <source>.defaults, then <source>.commands.<report>, with command-line flags still on top, as the docs describe.
I would like to implement this. Proposed approach: resolve one option set per source in the binary by parsing the same command line against that source's view of the config (so flags keep their precedence over config), carry those per-source options on AgentCommandArgs, and have the unified loader use them per source, including the Codex speed and the pi and OpenClaw paths.
Version
20.0.42 (main at e42e1b4)
Activity
pullfrog commentedon Oct 23, 2026
github-actions commentedon Oct 23, 2026
Pullfrog triage: priority:high
Kind: bug
Maintenance fit: maintainable
Confidence: high
Unified reports ignore documented per-source config. Docs promise each source gets merged options, TypeScript CLI did this, Rust code uses one shared options object and hardcodes Codex speed and pi and OpenClaw paths. This drops pi usage and misprices Codex costs.
Decision: kept open; Pullfrog will attempt a focused implementation PR.
viniciusdsandrade commentedon Oct 23, 2026
The fix is ready on my fork. GitHub rejects pull request creation from my account on this repository (GraphQL
CreatePullRequestreports missing permissions, REST returns 404), so I am leaving the branch here:main(e42e1b4):16d203eefix(cli): carry per-source options on unified report args278def57fix(config): expose a source's view of the config for unified reports039cef05fix(cli): resolve source config sections for unified reports776d1778fix(cli): load each unified source with its own options7a65018fdocs(config): say where unified reports read pricing options fromWhat it does: the binary resolves one option set per source the config addresses by parsing the same command line against that source's view of the config (
ConfigContext::for_source), so flags keep precedence over the sections, and carries it onAgentCommandArgs.sources. The unified loader then loads each source with its own shared options, uses the configured Codex speed, and reads the pi and OpenClaw paths. Sources the config does not address keep the unified options, so output without source sections is unchanged. Tests cover the config view, the resolution (flags above sections, the bareccusage,session) and the loader (pi path, per-source date window). I reviewed it by reading and have not run the suite locally, so CI would be the first run.If you
lgtmme I will open the PR with the full description; otherwise feel free to pull the branch as with #1948.fix(cli): apply source-specific config in unified reports (ccusage#1959)
ryoppippi commentedon Nov 10, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of @ryoppippi
Your fix landed in #1959, which kept your commits and credits you as co-author, and shipped in v20.0.43. Unified reports now apply source-specific config sections. Thanks for preparing the branch.