feat: report agent runtime hours usage in entitlements - #27985
Draft
jaaydenh wants to merge 4 commits into
Draft
Conversation
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.
Docs previewCheck 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. |
This was referenced Aug 10, 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.
Populate
FeatureAgentRuntimeHours.Actualon every entitlements refresh for licenses that grant the feature. A newGetTotalUsageHBAgentRuntimeV1query sumsruntime_msover the license's usage period, readingusage_eventsdirectly:hb_agent_runtime_v1is exactly one row per hourly bucket deployment-wide withcreated_atat the bucket start, enforced by the unique partial index introduced in #27983.The measurement reuses the shared
measureUsagepolicy from #27984 through a newAgentRuntimeMsFnclosure (usage publisher subject): failures publish the stableLicenseAgentRuntimeUsageUnavailableErrorTextand log the cause. Usage is floored to whole hours, matching the unit of theagent_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.