Skip to content

Remove dead code superseded by the scaleset SDK - #73

Merged
existemi merged 2 commits into
rl/docsfrom
rl/remove-dead-code
Aug 20, 2026
Merged

Remove dead code superseded by the scaleset SDK#73
existemi merged 2 commits into
rl/docsfrom
rl/remove-dead-code

Conversation

@existemi

@existemi existemi commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

Remove the code superseded by the actions/scaleset SDK, now that pkg/github/scalesetclient is the only implementation of ActionsService.

  • Delete pkg/github/app and pkg/github/auth, the hand-rolled JWT, installation-token, and registration-token chain the SDK now performs
  • Delete pkg/http, the retryable client and logger used only by those packages
  • Delete pkg/github/config.go and its tests, the config URL parser the SDK replaces
  • Delete the ActionsClient implementation from pkg/github/actions, keeping the ActionsService interface and the ActionsError type, both of which are still used
  • Delete utils.GetTokenExpirationTime, whose only caller was the removed client, and add coverage for utils.Map, which had none

Nothing constructed ActionsClient: NewActionsClient had no callers outside its own definition. pkg/api and utils.Map are kept because pkg/orka and the runner provisioner still use them, and pkg/github/errors is kept because pkg/github/messagequeue still uses it.

go mod tidy moves hashicorp/go-retryablehttp to an indirect dependency as a result.

Net effect is 990 lines removed.

@existemi
existemi marked this pull request as ready for review August 19, 2026 02:31
@existemi
existemi requested a review from a team as a code owner August 19, 2026 02:31
@ispasov

ispasov commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Clean removal — the interface and ActionsError are correctly kept. Two more bits of now-dead code that fit this PR's purpose:

nit — pkg/github/messagequeue/manager.go: Now that we're on the SDK, this manager's token-refresh retry is dead. Every branch keys on errors.As(err, &ghErrors.MessageQueueTokenExpiredError{}), but the scalesetclient never emits that local type — and it doesn't need to, because the SDK's GetMessage/DeleteMessage/AcquireJobs already refresh on their own scaleset.MessageQueueTokenExpiredError internally. So the RefreshMessageSession-and-retry paths in ReceiveNextMessage/DeleteMessage/AcquireJobs can never fire. Good candidate to simplify down to the single call.

nit — pkg/api/: Looks orphaned now — its only callers were pkg/github/app and pkg/github/auth, both deleted in this PR. An unused package still compiles and won't trip staticcheck, so CI won't flag it. Worth confirming nothing else imports it and removing it here too.

(Heads up: no CI checks have reported on this PR yet — given how much it deletes, worth making sure ci runs green before merge.)

@existemi
existemi force-pushed the rl/remove-dead-code branch from bd787ad to 1c745b3 Compare August 19, 2026 16:49
@existemi
existemi force-pushed the rl/remove-dead-code branch from 1c745b3 to 552b9c3 Compare August 19, 2026 17:34
@existemi

Copy link
Copy Markdown
Contributor Author

nit — pkg/github/messagequeue/manager.go: Now that we're on the SDK, this manager's token-refresh retry is dead. Every branch keys on errors.As(err, &ghErrors.MessageQueueTokenExpiredError{}), but the scalesetclient never emits that local type — and it doesn't need to, because the SDK's GetMessage/DeleteMessage/AcquireJobs already refresh on their own scaleset.MessageQueueTokenExpiredError internally. So the RefreshMessageSession-and-retry paths in ReceiveNextMessage/DeleteMessage/AcquireJobs can never fire. Good candidate to simplify down to the single call.

Good catch. Removing the token expiry logic

nit — pkg/api/: Looks orphaned now — its only callers were pkg/github/app and pkg/github/auth, both deleted in this PR. An unused package still compiles and won't trip staticcheck, so CI won't flag it. Worth confirming nothing else imports it and removing it here too.

Still used in pkg/orka/client for fetching cluster-info to verify connectivity to the cluster

@ispasov

ispasov commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

There is something off and the runner throws an error on start. Still trying to figure out what. Here is the error:

make run
{"level":"info","ts":"2026-08-20T15:10:20+03:00","msg":"refreshing token","githubConfigUrl":"https://github.com/ispasov/gift-service"}
{"level":"info","ts":"2026-08-20T15:10:20+03:00","msg":"getting access token for GitHub App auth","accessTokenURL":"https://api.github.com/app/installations/65583604/access_tokens"}
{"level":"debug","ts":"2026-08-20T15:10:20+03:00","msg":"performing request","method":"POST","url":"https://api.github.com/app/installations/65583604/access_tokens"}
{"level":"info","ts":"2026-08-20T15:10:20+03:00","msg":"getting runner registration token","registrationTokenURL":"https://api.github.com/repos/ispasov/gift-service/actions/runners/registration-token"}
{"level":"debug","ts":"2026-08-20T15:10:20+03:00","msg":"performing request","method":"POST","url":"https://api.github.com/repos/ispasov/gift-service/actions/runners/registration-token"}
{"level":"info","ts":"2026-08-20T15:10:21+03:00","msg":"getting Actions tenant URL and JWT","registrationURL":"https://api.github.com/actions/runner-registration"}
{"level":"debug","ts":"2026-08-20T15:10:21+03:00","msg":"performing request","method":"POST","url":"https://api.github.com/actions/runner-registration"}
{"level":"debug","ts":"2026-08-20T15:10:21+03:00","msg":"performing request","method":"GET","url":"https://broker.actions.githubusercontent.com/rest/_apis/runtime/runnerscalesets?api-version=6.0-preview&name=github-runner&runnerGroupId=1"}
{"level":"info","ts":"2026-08-20T15:10:22+03:00","logger":"main","msg":"reusing existing runner scale set github-runner (id=172)"}
{"level":"info","ts":"2026-08-20T15:10:22+03:00","logger":"main","msg":"Prometheus metrics available at :8080/metrics"}
{"level":"debug","ts":"2026-08-20T15:10:24+03:00","msg":"performing request","method":"POST","url":"https://broker.actions.githubusercontent.com/rest/_apis/runtime/runnerscalesets/172/sessions?api-version=6.0-preview"}
{"level":"info","ts":"2026-08-20T15:10:25+03:00","logger":"runner-manager-172","msg":"unable to create message session, client-side error (status 404), won't retry: 404 - had issue communicating with Actions backend: failed to create message session: failed to do the session request: request POST https://broker.actions.githubusercontent.com/rest/_apis/runtime/runnerscalesets/172/sessions?api-version=6.0-preview failed(status=\"404 Not Found\", github_request_id=\"EC7B:14673C:A12415:A3A43D:6A86EEB0\"): unexpected status code 404 Not Found: GitHub.Actions.Runtime.WebApi.RunnerScaleSetNotFoundException, GitHub.Actions.Runtime.WebApi: No runner scale set found with identifier 172."}
{"level":"info","ts":"2026-08-20T15:10:25+03:00","logger":"main","msg":"metrics poller shutting down"}
panic: failed to create session. create message session http request failed. 404 - had issue communicating with Actions backend: failed to create message session: failed to do the session request: request POST https://broker.actions.githubusercontent.com/rest/_apis/runtime/runnerscalesets/172/sessions?api-version=6.0-preview failed(status="404 Not Found", github_request_id="EC7B:14673C:A12415:A3A43D:6A86EEB0"): unexpected status code 404 Not Found: GitHub.Actions.Runtime.WebApi.RunnerScaleSetNotFoundException, GitHub.Actions.Runtime.WebApi: No runner scale set found with identifier 172.

@ispasov

ispasov commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Update - it started running again. Something delete the scaleset right after the integration found it.
That's why thelogs say - "Reusing", but then it fails with 404.. Strange

@ispasov

ispasov commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

@existemi
I am hitting some issues when stopping and starting the integration.
ping me in slack so we can discuss it

@ispasov ispasov closed this Aug 20, 2026
@ispasov ispasov reopened this Aug 20, 2026
@ispasov

ispasov commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Closed this by mistake sorry :)
But this comment still stands : #73 (comment)

@ispasov

ispasov commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

We discussed this with @existemi .
I am no longer able to reproduce this issue. I am approving the PR. Will look into the logs in more details

@existemi
existemi force-pushed the rl/remove-dead-code branch from 1375556 to 3bd4cf2 Compare August 20, 2026 14:53
@existemi
existemi merged commit 4f394ae into main Aug 20, 2026
4 checks passed
@existemi
existemi deleted the rl/remove-dead-code branch August 20, 2026 20:38
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.

2 participants