Skip to content

feat: report stable license measurement diagnostics and tolerate unusable runtime hours claims - #27984

Draft
jaaydenh wants to merge 3 commits into
runtime-invariantsfrom
license-measure-diagnostics
Draft

feat: report stable license measurement diagnostics and tolerate unusable runtime hours claims#27984
jaaydenh wants to merge 3 commits into
runtime-invariantsfrom
license-measure-diagnostics

Conversation

@jaaydenh

@jaaydenh jaaydenh commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Two coupled changes to the license/entitlements layer, preparing for runtime-hours usage reporting.

Stable measurement diagnostics. A new measureUsage helper owns the usage-query failure policy: a query failure publishes the stable codersdk.LicenseManagedAgentUsageUnavailableErrorText on the entitlements Errors channel (so the alertable coderd_license_errors gauge keeps counting measurement failures) while the raw cause goes to the coderd log through the new FeatureArguments.Logger. A nil usage closure becomes a hard developer error, and a failure with a dead context still aborts the whole refresh instead of logging a false alarm. The managed agent count closure switches from AsSystemRestricted to the narrower AsUsagePublisher subject. The dashboard recognizes diagnostic texts and renders them muted, with a "License notices" heading instead of the exceedance heading and without a sales link.

Tolerate unusable runtime hour claims. Unusable agent_runtime_hours_* claim combinations no longer reject the whole license: rejecting a signed license over a cosmetic threshold claim would drop the deployment to unlicensed. decodeAgentRuntimeHours drops the unusable claims, surfaces the stable LicenseAgentRuntimeHoursClaimsIgnoredWarningText (deduplicated across licenses), and logs the affected license and claims; validateAgentRuntimeHours and its license-invalidating errors are removed.

Part 2 of a 3-PR stack splitting up #27796 (see there for review history). Stack: #27983 → this PR → #27985.

…able runtime hours claims

Two coupled changes to the license/entitlements layer.

Measurement diagnostics: extract a measureUsage helper that owns the
usage-query failure policy. A query failure now publishes the stable
codersdk.LicenseManagedAgentUsageUnavailableErrorText on the
entitlements Errors channel (keeping the alertable coderd_license_errors
gauge counting) while the raw cause goes to the coderd log through the
new FeatureArguments.Logger. A nil usage closure becomes a hard
developer error, and a failure with a dead context still aborts the
whole refresh. The managed agent count closure switches from
AsSystemRestricted to the narrower AsUsagePublisher subject. The
dashboard recognizes diagnostic texts and renders them muted, without
the exceedance heading or a sales link.

Claim tolerance: unusable agent_runtime_hours_* claim combinations no
longer reject the whole license. decodeAgentRuntimeHours drops the
unusable claims, reports them in a stable
LicenseAgentRuntimeHoursClaimsIgnoredWarningText warning (deduplicated
across licenses), and logs the affected license and claims;
validateAgentRuntimeHours and its license-invalidating errors are
removed. Rejecting a signed license over a cosmetic threshold claim
would drop the deployment to unlicensed.

Part of the stack for #27796.
@jaaydenh
jaaydenh requested a review from ibetitsmike August 10, 2026 12:43
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.

1 participant