Skip to content

feat: report agent runtime hours usage in entitlements - #27985

Draft
jaaydenh wants to merge 4 commits into
license-measure-diagnosticsfrom
runtime-hours-entitlements
Draft

feat: report agent runtime hours usage in entitlements#27985
jaaydenh wants to merge 4 commits into
license-measure-diagnosticsfrom
runtime-hours-entitlements

Conversation

@jaaydenh

@jaaydenh jaaydenh commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Populate FeatureAgentRuntimeHours.Actual on every entitlements refresh for licenses that grant the feature. A new GetTotalUsageHBAgentRuntimeV1 query sums runtime_ms over the license's usage period, reading usage_events directly: hb_agent_runtime_v1 is exactly one row per hourly bucket deployment-wide with created_at at the bucket start, enforced by the unique partial index introduced in #27983.

The measurement reuses the shared measureUsage policy from #27984 through a new AgentRuntimeMsFn closure (usage publisher subject): failures publish the stable LicenseAgentRuntimeUsageUnavailableErrorText and log the cause. Usage is floored to whole hours, matching the unit of the agent_runtime_hours_* claims, and at most one warning is emitted per refresh: reaching the allocation supersedes the advisory soft limit. The dashboard renders the soft-limit advisory muted without a sales link and treats the runtime usage-unavailable text as a diagnostic.

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

Closes CODAGT-852.

Populate FeatureAgentRuntimeHours.Actual on every entitlements refresh
for licenses that grant the feature. A new
GetTotalUsageHBAgentRuntimeV1 query sums runtime_ms over the license's
usage period, reading usage_events directly: hb_agent_runtime_v1 is
exactly one row per hourly bucket deployment-wide, enforced by the
unique partial index idx_usage_events_agent_runtime.

The measurement reuses the shared measureUsage policy through a new
AgentRuntimeMsFn closure (usage publisher subject): failures publish
the stable LicenseAgentRuntimeUsageUnavailableErrorText and log the
cause. Usage is floored to whole hours, matching the unit of the
agent_runtime_hours_* claims, and at most one warning is emitted:
reaching the allocation supersedes the advisory soft limit. The
dashboard renders the soft-limit advisory muted without a sales link
and treats the runtime usage-unavailable text as a diagnostic.

Closes CODAGT-852.
@linear-code

linear-code Bot commented Aug 10, 2026

Copy link
Copy Markdown

CODAGT-852

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@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