Description
What happened?
In ccusage.json, when both a generic report section (such as commands.daily) and a source-specific space-form command section (such as commands."codex daily") are defined, the generic report section overwrites the source-specific section:
{
"commands": {
"daily": {
"mode": "display"
},
"codex daily": {
"mode": "calculate"
}
}
}When running ccusage codex daily or resolving codex in ccusage daily, mode is evaluated as display rather than calculate.
In rust/crates/ccusage-config/src/config.rs:136-150 (ConfigContext::option_maps), commands[&self.command.raw] ("codex daily") is pushed to maps before commands[&self.command.report] ("daily"). Because maps apply sequentially and later entries override earlier ones, commands.daily clobbers commands."codex daily".
In contrast, the colon form commands."codex:daily" is pushed after commands.daily, so codex:daily correctly wins over daily. Space-form commands should have the same precedence as colon-form commands and override the generic report section.
Steps to reproduce
- Create a
ccusage.jsonwith:
{
"commands": {
"daily": {
"mode": "display",
"since": "20260101"
},
"codex daily": {
"mode": "calculate"
}
}
}- Run
ccusage codex daily --json --offline. - Observed: the command runs in
displaymode instead ofcalculatemode.
Expected behavior
commands."codex daily" takes precedence over commands.daily, so ccusage codex daily runs in calculate mode with since = "20260101", matching the documented option precedence in docs/guide/config-files.md.
Version
20.0.46 (and commit 5aa9d3f on main)
Activity
pullfrog commentedon Oct 31, 2026
github-actions commentedon Oct 31, 2026
Pullfrog triage: priority:medium
Kind: bug
Maintenance fit: maintainable
Confidence: high
Specific space-form command config is overridden by generic report config because option_maps applies generic after specific, opposite to documented precedence and colon-form behavior. Code read confirms the ordering defect with clear reproduction.
Decision: kept open.
viniciusdsandrade commentedon Oct 31, 2026
The fix is ready on my fork. GitHub rejects pull request creation from outside accounts on this repository (GraphQL
CreatePullRequestreports missing permissions), so I am leaving the branch and compare links here:main(5aa9d3f):bfd7f348fix(config): apply space-form command config over generic report options971b3aeftest(cli): verify space-form command config overrides generic report in unified viewdfb23d3fdocs(config): document space-form command precedence alongside colon-formWhat it does:
ConfigContext::option_mapsnow pushes generic report options (commands[&self.command.report]) before source-specific command sections (commands[&self.command.raw]and colon-formcommands[&colon_name]) when an agent command is invoked or resolved for a unified source. This ensures both space-form and colon-form command settings consistently take precedence over generic report settings incommands, matching the option precedence hierarchy documented in docs/guide/config-files.md.Tests cover focused and unified source resolution for space-form commands alongside generic report sections. I reviewed the changes by reading and have not run the suite locally, so CI would be the first run.
If you can approve the PR or pull the branch as with #1959, the fix is ready to merge.
fix(config): let space-form command sections override generic report …
ryoppippi commentedon Nov 10, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of @ryoppippi
Your fix landed in #2006, which kept your commits and credits you as co-author, and shipped in v20.0.47. Space-form sections such as
commands."claude daily"now override the genericcommands.daily. Thanks for preparing the branch.