Skip to content

refactor(ec2): decouple creation result from control plane - #5312

Merged
edersonbrilhante merged 1 commit into
mainfrom
refactor-ec2-orchestration-support
Sep 2, 2026
Merged

edersonbrilhante merged 1 commit into
mainfrom
refactor-ec2-orchestration-support

Conversation

@edersonbrilhante

@edersonbrilhante edersonbrilhante commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Separates the result returned by shared EC2 runner creation from the control-plane CreateRunnerResult contract.

createEc2Runner() and Ec2RunnerResourceOperations.create() now return Ec2RunnerCreateResult, containing created instance IDs, the failed-instance count, and bounded AWS failure identifiers.

The control-plane adapter converts that result into its existing CreateRunnerResult and applies retryable or non-retryable classification using scaleErrors. The core contract and existing pool and scale-up behavior remain unchanged.

Test Plan

  • Compute-provider suite: 14 files, 295 tests passed.
  • Control-plane suite: 14 files, 345 tests passed.
  • Control-plane TypeScript type-check passed.
  • ESLint and Prettier passed for changed EC2 TypeScript files.
  • git diff --check and pre-commit checks passed.

Related Issues

Depends on #5301.

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

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

Scanned Files

None

@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch 2 times, most recently from c452fb1 to 6a5790d Compare August 27, 2026 20:15
@edersonbrilhante edersonbrilhante changed the title refactor(ec2): support runner orchestration refactor(ec2): decouple runner creation results Aug 27, 2026
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from 6a5790d to 3179711 Compare August 27, 2026 20:35
@edersonbrilhante edersonbrilhante changed the title refactor(ec2): decouple runner creation results refactor(ec2): decouple creation result from control plane Aug 27, 2026
@edersonbrilhante
edersonbrilhante marked this pull request as ready for review August 27, 2026 20:44
@edersonbrilhante
edersonbrilhante requested a review from a team as a August 27, 2026 20:44
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from 3179711 to 0d1969f Compare August 27, 2026 21:00
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from 0d1969f to f990720 Compare August 28, 2026 11:03
Brend-Smits
Brend-Smits previously approved these changes Sep 2, 2026

@Brend-Smits Brend-Smits left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving — clean refactor, and the classification logic all carried over faithfully (retryable sets, $fault/HTTP checks, the fleet-error path, and the spot→on-demand failover). Bounding the identifiers is a nice touch.

One side note, purely observability: the failure warns now log failureCodes instead of the error. Since createEc2Runner swallows AWS errors and returns a result (only AbortError rethrows), the raw error never reaches the outer logger.error either. Recognised AWS errors still surface as aws-name:/aws-code:, but anything that yields no codes — a non-AWS error, or a name/code filtered out by SAFE_FAILURE_IDENTIFIER — just logs failureCodes: [] with nothing to go on. Might be worth keeping error.message alongside the codes so the odd unexpected failure stays debuggable.

Tiny thing: a CreateFleet failure logs "Create fleet request failed." twice now.

@edersonbrilhante
edersonbrilhante disabled stacked auto-merge September 2, 2026 15:32
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from f990720 to 6f33eb2 Compare September 2, 2026 15:40
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from 6f33eb2 to 9f10450 Compare September 2, 2026 16:42
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from 9f10450 to 3238d64 Compare September 2, 2026 16:46
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from 3238d64 to 0010801 Compare September 2, 2026 16:53
Base automatically changed from refactor-ec2-runner-orchestration-boundary to main September 2, 2026 17:09
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-orchestration-support branch from 0010801 to 5f5dfec Compare September 2, 2026 17:10
@edersonbrilhante
edersonbrilhante merged commit 78dba0d into main Sep 2, 2026
9 checks passed
@edersonbrilhante
edersonbrilhante deleted the refactor-ec2-orchestration-support branch September 2, 2026 17:16
edersonbrilhante added a commit that referenced this pull request Sep 4, 2026
## Description

Improves EC2 failure observability following #5312.

Caught EC2 failures now retain the error message alongside bounded
`failureCodes`, so unexpected failures remain diagnosable even when no
identifier is accepted. The redundant inner CreateFleet warning was also
removed; the outer handler now emits that warning once after converting
the swallowed request failure into its result.

## Test Plan

- Focused EC2 Vitest suite: 72 tests passed.
- ESLint passed for the changed TypeScript file.
- Source-only TypeScript check passed for `runners.ts`.
- Pre-commit checks and `git diff --check` passed.

The broader compute-provider TypeScript project check remains blocked by
existing Vitest configuration/dependency-version errors unrelated to
this change.

## Related Issues

Depends on #5312.
edersonbrilhante added a commit that referenced this pull request Sep 21, 2026
## Description

Adds the TypeScript implementation of the GitHub Actions runner
scale-set control plane on top of the Terraform orchestration introduced
by #5299.

This PR includes:

- A reusable GitHub Actions scale-set client that supports GitHub.com,
GHES, and data-residency endpoints; GitHub App access tokens;
runner-group and scale-set discovery/registration; JIT runner
configuration; runner removal; and message-session polling,
acknowledgement, job acquisition, refresh, and close.
- A long-running scale-set controller service for ECS. It loads
versioned runner configuration from SSM Parameter Store, runs
independent reconcilers for each runner configuration, exposes
liveness/readiness endpoints, and performs bounded shutdown and session
recovery.
- A scale-set compute-provider contract and EC2 implementation. The
provider reconciles capacity from `totalAssignedJobs`, generates JIT
configurations for launches, tracks provider-owned instances with tags,
preserves busy or unknown runners during scale-down, and supports
task-role or assumed-role credentials.
- Configuration, authentication, transport, retry, cancellation,
ownership, lifecycle, health, and reconciliation safeguards. Sensitive
tokens, message bodies, and JIT configurations are excluded from
manifests and logs; disabling TLS verification is scoped to the relevant
client instead of changing global Node.js state.
- Unit-test coverage for the scale-set client and HTTP/session behavior,
service configuration and credentials, controller lifecycle and health,
and EC2 provider configuration, inventory, reconciliation, scale-up, and
scale-down.

The Terraform documentation and workflow changes are tracked separately
in #5347.

## Test Plan

- Added focused TypeScript tests alongside the client, service,
controller, and compute-provider implementations.
- The scale-set service package provides `typecheck`, `build`,
`format-check`, `lint`, and `test` targets for CI validation.
- End-to-end ECS deployment is not part of this PR; the service consumes
the scale-set configuration and IAM contracts supplied by the Terraform
stack.

## Related Issues

- Stacked on #5299.
- Builds on the EC2 orchestration boundary from #5312.
- Follow-up documentation and workflow changes: #5347.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Guilherme Caulada <[email protected]>
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.

3 participants