Fix GitHub Actions usage overcount for queued jobs - #30
Open
snazy wants to merge 1 commit into
Open
Conversation
GitHub Actions job records can contain non-null `started_at` and `completed_at` timestamps even when the job never received a runner. In that state GitHub reports runner_name as empty and steps as empty, but the dashboard previously calculated usage as `completed_at - started_at` for every completed job timestamp pair. Jobs cancelled after waiting for unavailable capacity or impossible runner labels could therefore add days of wall-clock queue time to runner-minute usage. Count runner usage only for jobs with a non-empty `runner_name`, while still counting cancelled jobs that were actually assigned to a runner. Store `runner_name` in serialized job records so future API responses can make the same distinction. Normalize cached DB rows before returning API data. For new records this uses `runner_name`; for legacy serialized records that do not have `runner_name`, it falls back to empty steps as the no-runner signal. This lets detailed cached rows stop preserving inflated `seconds_used` values. Add regression coverage for real runner jobs, queued/cancelled no-runner jobs, cancelled jobs after runner assignment, and legacy cached row normalization. Generated-By: Codex-5.5 w/ my review
Member
Author
|
The core changes should all be covered by the new tests. Only thing I could not verify is the behavior using a "real" |
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.
GitHub Actions job records can contain non-null
started_atandcompleted_attimestamps even when the job never received a runner. In that state GitHub reports runner_name as empty and steps as empty, but the dashboard previously calculated usage ascompleted_at - started_atfor every completed job timestamp pair. Jobs cancelled after waiting for unavailable capacity or impossible runner labels could therefore add days of wall-clock queue time to runner-minute usage.Count runner usage only for jobs with a non-empty
runner_name, while still counting cancelled jobs that were actually assigned to a runner. Storerunner_namein serialized job records so future API responses can make the same distinction.Normalize cached DB rows before returning API data. For new records this uses
runner_name; for legacy serialized records that do not haverunner_name, it falls back to empty steps as the no-runner signal. This lets detailed cached rows stop preserving inflatedseconds_usedvalues.Add regression coverage for real runner jobs, queued/cancelled no-runner jobs, cancelled jobs after runner assignment, and legacy cached row normalization.
Generated-By: Codex-5.5 w/ my review