Skip to content

fix: pace adjustment not applied to Claude Code Sonnet/Opus cards#360

Merged
rygel merged 4 commits intodevelopfrom
fix/pace-adjustment-sonnet-opus-period-duration
Mar 20, 2026
Merged

fix: pace adjustment not applied to Claude Code Sonnet/Opus cards#360
rygel merged 4 commits intodevelopfrom
fix/pace-adjustment-sonnet-opus-period-duration

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Mar 20, 2026

Summary

  • The Sonnet and Opus model-specific details in ClaudeCodeProvider were missing PeriodDuration = TimeSpan.FromDays(7), so the synthetic child cards (claude-code.sonnet, claude-code.opus) could not resolve rolling-window info
  • ResolveRollingWindowInfo() returned (null, null) for those cards, causing ColorIndicatorPercent to fall back to raw UsedPercent — keeping the bar yellow even when consumption was well under pace
  • The "All Models" (rolling) and "Current Session" (burst) details were already correct; only Sonnet/Opus were affected

Test plan

  • Build and run locally; confirm Sonnet/Opus cards turn green when usage is below the pace-adjusted threshold
  • CI passes

🤖 Generated with Claude Code

…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>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ 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>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ Within acceptable range


This is an automated performance check

actions-user and others added 2 commits March 20, 2026 10:27
…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>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ Within acceptable range


This is an automated performance check

@rygel rygel merged commit 0d04f98 into develop Mar 20, 2026
20 checks passed
@rygel rygel deleted the fix/pace-adjustment-sonnet-opus-period-duration branch March 20, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants