fix: pace adjustment not applied to Claude Code Sonnet/Opus cards#360
Merged
fix: pace adjustment not applied to Claude Code Sonnet/Opus cards#360
Conversation
…ails The pace-aware quota colour feature requires PeriodDuration on each ProviderUsageDetail so synthetic child cards (claude-code.sonnet, claude-code.opus) can compute elapsedFraction and apply the squash formula. Without it ResolveRollingWindowInfo() returned (null, null) and ColorIndicatorPercent fell back to raw UsedPercent — keeping the bar yellow even when the user was well under pace. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Build Performance Report⏱️ Build Time: 12 minutes 📊 Comparison with main branch:
✅ Within acceptable range This is an automated performance check |
…e source Previously each provider set PeriodDuration on individual ProviderUsageDetail objects, which meant: - It was missing from all Sonnet/Opus/ModelSpecific details - The UI depended on that value surviving JSON serialisation through the monitor HTTP API and database storage (fragile) - Every provider had to remember to set it on every detail they created Now PeriodDuration is declared once per window in QuotaWindowDefinition (the natural home — it's a property of the window type, not of a runtime detail). ProviderUsageDisplayCatalog.CreateAggregateDetailUsage reads it from the matching declaredWindow, so synthetic-child ProviderUsage objects always receive the correct duration regardless of what the detail carries. ProviderCardViewModel.ResolveRollingWindowInfo now looks up the catalog for non-synthetic cards instead of relying on detail.PeriodDuration surviving JSON round-trips. UsageAlertsService.GetEffectiveAlertPercent uses the same catalog lookup, making alert suppression consistent with the UI colour calculation. All per-detail PeriodDuration assignments removed from ClaudeCode, GitHubCopilot, OpenAI and Codex providers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Build Performance Report⏱️ Build Time: 12 minutes 📊 Comparison with main branch:
✅ Within acceptable range This is an automated performance check |
…odDuration Duration is declared upfront in QuotaWindowDefinition. No fallback to detail-level values, no JSON round-trip dependency. ProviderUsageDetail no longer carries PeriodDuration at all. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Build Performance Report⏱️ Build Time: 12 minutes 📊 Comparison with main branch:
✅ Within acceptable range This is an automated performance check |
This was referenced Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClaudeCodeProviderwere missingPeriodDuration = TimeSpan.FromDays(7), so the synthetic child cards (claude-code.sonnet,claude-code.opus) could not resolve rolling-window infoResolveRollingWindowInfo()returned(null, null)for those cards, causingColorIndicatorPercentto fall back to rawUsedPercent— keeping the bar yellow even when consumption was well under paceTest plan
🤖 Generated with Claude Code