Skip to content

fix: stagger e2e batch fan-out into waves to avoid CodeBuild batch-orchestration fault - #3491

Closed
Simone319 wants to merge 2 commits into
mainfrom
fix/reduce-e2e-fanout-workers
Closed

fix: stagger e2e batch fan-out into waves to avoid CodeBuild batch-orchestration fault#3491
Simone319 wants to merge 2 commits into
mainfrom
fix/reduce-e2e-fanout-workers

Conversation

@Simone319

Copy link
Copy Markdown
Contributor

Problem

The amplify-category-api-e2e-workflow CodeBuild batch deterministically FAULTs with Internal Service Error ("CodeBuild is experiencing issues") at the IN_PROGRESS batch-orchestration phase, ~22s after publish_to_local_registry completes. All downstream test groups are force-STOPPED. This has blocked e2e since ~May 22, 2026.

Root cause

The generated batch build-graph fans out into ~184 test jobs that all depend solely on publish_to_local_registry, so they are released in a single simultaneous wave. CodeBuild's batch orchestrator faults on that burst.

This is not a concurrency/quota issue (every sampled build had QUEUED=0s and provisioned immediately; maximumBuildsAllowed=300 > 184) and not caused by test growth (the fan-out has been ~180-193 since Nov 2024, and was higher — 205-229 — in 2024 with no faults). Evidence points to a CodeBuild service-side change ~May 21-22, 2026 that reduced batch-orchestration tolerance: the identical 193-group batch ran healthy on May 19 and faulted on May 22 with no repo change. The pr-workflow (only ~11 groups) is unaffected.

Fix

Stagger the fan-out into sequential waves in scripts/split-e2e-tests.ts so the orchestrator never sees a single >~50-job release burst:

  • New constant WAVE_SIZE = 46.
  • Wave 0 (first 46 jobs) depends on publish_to_local_registry; each later job i depends on job i - WAVE_SIZE (strictly-decreasing index → acyclic; max single-event release width = WAVE_SIZE).
  • cleanup_e2e_resources now depends on the final wave's leaf jobs so it still runs after all tests.
  • Regenerated codebuild_specs/e2e_workflow.yml.

No test logic, test isolation, or job count changes — only depend-on edges. Total jobs unchanged (192); max simultaneous release width 174 → 46.

Verification

Triggered an e2e batch on this branch (amplify-category-api-e2e-workflow:a6fe9799-...): after publish_to_local_registry succeeded, wave 1 released ~46-49 jobs and the batch stayed IN_PROGRESS with no FAULT — clearing the +22s death window that killed every prior unstaggered batch, and holding healthy through the run.

Tradeoff

Waves serialize, adding some wall-clock latency — an accepted tradeoff to eliminate the deterministic orchestration FAULT.

Note

The underlying trigger is a CodeBuild service-side regression (~May 22, 2026); this change is a defensive workaround that makes the batch resilient to the lower orchestration ceiling. Worth a CodeBuild support ticket separately.

…chestration fault

The e2e_workflow CodeBuild batch deterministically FAULTed ("Internal
Service Error") ~22s after publish_to_local_registry because all ~184
generated e2e jobs depended solely on publish_to_local_registry and were
released to the batch orchestrator in one simultaneous wave.

Stagger the fan-out into sequential waves of at most WAVE_SIZE (46) jobs:
wave 0 depends on publish_to_local_registry; every later job depends on the
job WAVE_SIZE positions earlier. Each edge points to a strictly smaller
index, so the graph stays acyclic and no single completion event releases
more than ~46 jobs (down from ~184). cleanup_e2e_resources now depends on
the leaf jobs (last wave) so it still runs after every test.

This does not change which tests run or their isolation -- only the release
timing. Tradeoff: waves serialize, adding some wall-clock latency.
@Simone319 Simone319 closed this Jun 29, 2026
@Simone319

Copy link
Copy Markdown
Contributor Author

Closing as the fix is applied in #3497.

@Simone319
Simone319 deleted the fix/reduce-e2e-fanout-workers branch June 29, 2026 12:37
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.

1 participant