Skip to content

Conversation

stuartp44
Copy link
Contributor

@stuartp44 stuartp44 commented Aug 22, 2025

This PR helps with dealing with 404 issues when terminating runners and checking if the runner is actually there or not. At the moment, we don't recognize the fact 404 is actually a good response for runners that are no longer there. This means the rest of the logic is ignored to do last chance checking. This PR helps by returning null for a 404, hence able to act on this or the runner data if we get it. For all other logic, we still return the previous error.

Copy link
Contributor

github-actions bot commented Aug 22, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@npalm npalm requested review from npalm and Copilot August 22, 2025 14:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves 404 error handling in the scale-down logic for GitHub self-hosted runners. When checking runner state, 404 responses are now treated as valid indicators that a runner no longer exists on GitHub, rather than as errors that block further processing.

  • Returns null from getGitHubSelfHostedRunnerState when a 404 error occurs, allowing downstream logic to handle missing runners appropriately
  • Updates dependent functions to handle the new nullable return type
  • Adds comprehensive test coverage for 404 error scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scale-down.ts Adds 404 error handling to treat missing runners as valid state, updates function signatures and logic
scale-down.test.ts Adds test cases for 404 error handling scenarios including orphan detection and busy state checking

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…est.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@stuartp44
Copy link
Contributor Author

When looking at the API spec, it looks like 404 is not even a valid return code. Get a self-hosted runner for an organization. I have reached out to Github to ask if this a documentation problem or if its a API problem.

@stuartp44
Copy link
Contributor Author

@npalm any update on this?

@stuartp44
Copy link
Contributor Author

Copy link
Member

@npalm npalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartp44 thx, tested and looks good!

@npalm npalm merged commit 95aa6a2 into main Aug 25, 2025
6 checks passed
@npalm npalm deleted the stu/add_404_handling branch August 25, 2025 20:00
npalm pushed a commit that referenced this pull request Aug 25, 2025
🤖 I have created a release *beep* *boop*
---


##
[6.7.4](v6.7.3...v6.7.4)
(2025-08-25)


### Bug Fixes

* add handling for 404 errors in scale-down tests and improve error
logging
([#4726](#4726))
([95aa6a2](95aa6a2))
@stuartp44
* **lambda:** bump the aws group in /lambdas with 7 updates
([#4709](#4709))
([0e74b3d](0e74b3d))
* **lambda:** bump the aws-powertools group in /lambdas with 4 updates
([#4718](#4718))
([9a63469](9a63469))
* remove progress and control codes from log output
([#4699](#4699))
([1c6b424](1c6b424))
@aarongorka

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: runners-releaser[bot] <194412594+runners-releaser[bot]@users.noreply.github.com>
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.

Stale orphan EC2 instances not terminated when GitHub runner API returns no state or fetch fails
2 participants