You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Claude daily token/cost bars always render zero (week() rejects QVariantList-wrapped arrays) #130
Dux Shell: v2.1.2
Quickshell: 0.3.2
Compositor: Hyprland
Distro: CachyOS Linux
Claude Code: 2.1.330
Steps to reproduce
Use Claude Code on several days, so the transcripts under ~/.claude/projects cover multiple days of the current week.
Open the AiOverviewControl popout and expand the Claude card.
Look at the daily bars and the Today tokens tile.
Expected behavior
The bars show the per-day token totals (hover shows tokens and cost) and Today tokens shows today's total, matching the DAILY= / DAILY_COSTS= values emitted by providers/get-claude-usage.
Actual behavior
All seven bars are zero-height and Today tokens reads 0 on every day, while Week tokens, Month and Today cost are all correct. This has been the case since the plugin was installed.
Local checks
The data chain is correct up to the view model; the loss is inside ClaudeProfiles.js:
- providers/get-provider-usage claude returns correct analytics, e.g. dailyTokens: [0,0,0,310024191,194803454,224826171,0], dailyCosts: [0,0,0,92.08,55.09,67.39,0], weekTokens: 729653816.
- Instrumenting details() in the running shell shows it receives the correct array but returns zeros: in=[0,0,0,310024191,194803454,224826171,0] out=[0,0,0,0,0,0,0].
- Probing the value inside the QML (V4) runtime: Array.isArray(analytics.dailyTokens) === false, typeof === "object", length === 7, [3] === 310024191. After the JSON data crosses QML var properties it comes back as a QVariantList wrapper, not a JS Array.
- week() in ClaudeProfiles.js guards with Array.isArray(values) ? values : [], so the wrapped array is silently discarded. dailyTokens/dailyCosts are the only array-typed analytics fields, and the only broken ones: weekModels/weekProjects are parsed from comma-separated strings and all scalar fields work.
Suggested fix: inweek(), accept any array-like value with a numeric length, not only true JS arrays. Verified locally: with that change the bars render the correct per-day values.
Thanks for the report, @carrotciallo, and for the detailed investigation — especially confirming that the data was correct up to the view model and isolating the Array.isArray(...) vs QML QVariantList wrapper behavior. That pointed straight at the cause.
What was happening
ClaudeProfiles.week() only accepted Array.isArray(values). In QML, JSON arrays from the payload can cross as array-like wrappers (typeof === "object", with a numeric length, but Array.isArray(...) === false). In that case the function discarded the values and returned seven zeros, which made the daily bars and Today tokens render as zero even when weekTokens, costs, and the other fields were correct.
ClaudeProfiles.week() now accepts plain arrays and array-like objects with a numeric length.
I added QML smoke coverage for the array-like dailyTokens/dailyCosts case.
Validation
I ran locally:
bash tests/test-qml-smoke.sh
When PR #136 is merged and you update, could you confirm whether the daily bars and Today tokens match the get-provider-usage claude values in your environment? If you still see a zeroed case, please share the anonymized scenario and I’ll review it. Thanks for the report!
Activity
bernardopg commentedon Nov 22, 2026
Thanks for the report, @carrotciallo, and for the detailed investigation — especially confirming that the data was correct up to the view model and isolating the
Array.isArray(...)vs QMLQVariantListwrapper behavior. That pointed straight at the cause.What was happening
ClaudeProfiles.week()only acceptedArray.isArray(values). In QML, JSON arrays from the payload can cross as array-like wrappers (typeof === "object", with a numericlength, butArray.isArray(...) === false). In that case the function discarded the values and returned seven zeros, which made the daily bars and Today tokens render as zero even whenweekTokens, costs, and the other fields were correct.Fix
I opened PR #136 with the fix:
ClaudeProfiles.week()now accepts plain arrays and array-like objects with a numericlength.dailyTokens/dailyCostscase.Validation
I ran locally:
bash tests/test-qml-smoke.shWhen PR #136 is merged and you update, could you confirm whether the daily bars and Today tokens match the
get-provider-usage claudevalues in your environment? If you still see a zeroed case, please share the anonymized scenario and I’ll review it. Thanks for the report!