Skip to content

GitHub Runner Scaler: Fix/7969 respect paging for jobs - #7973

Open
jangraevell-pd wants to merge 11 commits into
kedacore:mainfrom
jangraevell-pd:fix/7969-github-scaler-respect-paging-for-jobs
Open

GitHub Runner Scaler: Fix/7969 respect paging for jobs#7973
jangraevell-pd wants to merge 11 commits into
kedacore:mainfrom
jangraevell-pd:fix/7969-github-scaler-respect-paging-for-jobs

Conversation

@jangraevell-pd

@jangraevell-pd jangraevell-pd commented Aug 6, 2026

Copy link
Copy Markdown

Fixes the GitHub Runner scaler's 100-job hard limit described in #7969.

getWorkflowRunJobs only ever requested a single page (per_page=100) of a
workflow run's jobs and never followed pagination. For a run with more than
100 jobs, the still-queued/in-progress jobs beyond the 100th were silently
never counted towards the scaler's queue length, causing scaling to stop as
soon as the first 100 jobs of a run finished.

Changes:

  • getWorkflowRunJobs now loops through pages (&page=N), accumulating jobs until a page returns fewer than githubJobsPerPage (100) jobs.
  • Extracted the per-page fetch/ETag/previousJobs-cache handling into a new fetchWorkflowRunJobsPage(ctx, workflowRunID, repoName, page) helper.
  • Added a regression test (TestNewGitHubRunnerScaler_QueueLength_SingleRepo_150Jobs_100Completed) simulating a 150-job run (100 completed on page 1, 50 still queued on page 2) with a page-aware mock server, asserting the correct queue length of 50.
  • Added a Changelog entry.

Checklist

Unchecked items are not applicable (no new scaler, no scaler schema/metadata changes, no Helm/manifest or docs/UX changes).

Fixes #7969

Signed-off-by: Jan Grävell <jan.graevell@prodyna.com>
Signed-off-by: Jan Grävell <jan.graevell@prodyna.com>
Signed-off-by: Jan Grävell <jan.graevell@prodyna.com>
@jangraevell-pd
jangraevell-pd requested a review from a team as a code owner August 6, 2026 09:08
@snyk-io

snyk-io Bot commented Aug 6, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Thank you for your contribution! 🙏

Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected.

While you are waiting, make sure to:

  • Add an entry in our changelog in alphabetical order and link related issue
  • Update the documentation, if needed
  • Add unit & e2e tests for your changes
  • GitHub checks are passing
  • Is the DCO check failing? Here is how you can fix DCO issues

Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient.

Learn more about our contribution guide.

@keda-automation
keda-automation requested a review from a team August 6, 2026 09:08
Signed-off-by: Jan Grävell <141423264+jangraevell-pd@users.noreply.github.com>
Comment thread CHANGELOG.md Outdated
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer

Copy link
Copy Markdown
Member

Thanks for the fix.

I think there's an issue: when enableEtags is on, a 304 on page 1 returns the cached combined job list, but page 1's ETag says nothing about later pages. Once the first 100 jobs are completed, page 1 stops changing while jobs on page 2+ do, so the queue length freezes until the run finishes. Caching per page (keying previousJobs by URL instead of repo name) would solve this and would also make the ETags for pages beyond the first actually useful, since right now a 304 there always leads to dropping the etag and refetching. While you're at it, please use the new githubJobsPerPage constant in the URL instead of the hardcoded per_page=100, and update the test comment that says it's "expected to fail until pagination is implemented", since the fix now lives in the same PR.

@jangraevell-pd

Copy link
Copy Markdown
Author

Will have a look this evening. Your annotation seems valid.

…g can be used for all pages instead of only the first one.

Signed-off-by: Jan Grävell <jan.graevell@prodyna.com>
@keda-automation
keda-automation requested a review from a team August 10, 2026 23:00
Comment thread pkg/scalers/github_runner_scaler.go
@rickbrouwer rickbrouwer added the merge-conflict This PR has a merge conflict label Aug 18, 2026
…-github-scaler-respect-paging-for-jobs

# Conflicts:
#	CHANGELOG.md
#	pkg/scalers/github_runner_scaler.go
#	pkg/scalers/github_runner_scaler_test.go
@keda-automation
keda-automation requested a review from a team August 25, 2026 12:44
@jangraevell-pd jangraevell-pd changed the title Fix/7969 GitHub scaler respect paging for jobs GitHub Runner Scaler: Fix/7969 respect paging for jobs Aug 25, 2026
@rickbrouwer rickbrouwer removed the merge-conflict This PR has a merge conflict label Aug 25, 2026
Signed-off-by: Jan Grävell <jan.graevell@prodyna.com>
@jangraevell-pd
jangraevell-pd force-pushed the fix/7969-github-scaler-respect-paging-for-jobs branch from 7fded19 to b1da0b3 Compare August 25, 2026 16:46
Signed-off-by: Jan Grävell <jan.graevell@prodyna.com>
@jangraevell-pd

Copy link
Copy Markdown
Author

@rickbrouwer how do we continue from here? Do I need to do something?

@rickbrouwer

Copy link
Copy Markdown
Member

Can you check this? With enableEtags, a 304 on page 1 returns cached=true and page 2 is never fetched, but ETags are per page. Once page 1 is fully completed it stops changing, so the queue length freezes. Must the cache be per page instead? Do you know this?

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.

KEDA does not work on runs having more than 100 Jobs

3 participants