mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 10:07:24 +01:00
perf(runner-image): parallelize pack archiving and use cloud-release-32 on master amd64 (#22992)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Runner image workflow (`.github/workflows/runner-image.yml`) builds `ghcr.io/paperclipai/paperclip-runner` for `amd64` and `arm64` whenever Runner inputs change > - Profiling recent builds showed `Build and check (amd64)` taking ~12 minutes versus ~4m 38s on `arm64`, driven by 4-core CPU saturation during `create-provider-pack-archive.mjs` (which compressed every large provider-pack binary serially on a single core) and during OCI tar/gzip export on `ubuntu-latest` > - Because `docker.yml` waits for the Runner image whenever Runner inputs change, slow `amd64` Runner builds sit directly on the release critical path > - This pull request parallelizes zstd layer archive creation in `scripts/create-provider-pack-archive.mjs` with bounded concurrency while preserving byte-for-byte deterministic output, and routes canonical `master` `amd64` runs of `.github/workflows/runner-image.yml` to the larger GitHub-hosted runner (`cloud-release-32`) > - The benefit is cutting `amd64` Runner image build time substantially on `master` (and speeding up provider-pack archiving on every PR and architecture) without weakening the PR/fork security boundary or changing output bytes ## Linked Issues or Issue Description **What existing behavior does this improve?** `scripts/create-provider-pack-archive.mjs` layer compression throughput and `.github/workflows/runner-image.yml` `amd64` runner sizing on canonical `master` pushes. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** `createProviderPackLayers` compresses `overlay.tar.zst` and each large provider-pack file (`0.tar.zst..N.tar.zst`) sequentially on one CPU core. In `.github/workflows/runner-image.yml`, canonical `master` `amd64` builds run on 4-core `ubuntu-latest` (~12 minutes total vs ~4m 38s on `arm64`). **Proposed behavior** `createProviderPackLayers` compresses `overlay.tar.zst` and the indexed large-file archives through a bounded worker pool (`min(availableParallelism(), 8)`), preserving exact file ordering, archive numbering, and byte-for-byte deterministic zstd frames. In `.github/workflows/runner-image.yml`, canonical `master` `amd64` pushes (`paperclipai/paperclip`, `push` to `refs/heads/master`) use `vars.CORE_PUBLICATION_RUNNER || 'cloud-release-32'`, while all PRs, forks, schedules, and `arm64` jobs stay on standard GitHub-hosted runners. **Reason and benefit** Eliminates single-core archiving bottlenecks across all environments and removes the 4-core `amd64` CPU bottleneck on `master` Runner image publications. **Breaking changes** None. ## What Changed - Updated `scripts/create-provider-pack-archive.mjs` to compress `overlay.tar.zst` and large-file archives via a bounded worker pool while preserving exact archive indices, receipt ordering, and byte-for-byte deterministic output. - Added `scripts/__tests__/create-provider-pack-archive.test.mjs` verifying serial (`concurrency: 1`) and parallel (`concurrency: 4`) runs produce identical receipts and archive bytes. - Updated `.github/workflows/runner-image.yml` to route canonical `master` `amd64` pushes to `vars.CORE_PUBLICATION_RUNNER || 'cloud-release-32'` while keeping PRs, forks, schedules, and `arm64` on `matrix.runner`. - Added a workflow guard in `server/src/__tests__/runner-image-workflow.test.ts` verifying only canonical `master` `amd64` pushes use the larger GitHub-hosted runner and never touch self-hosted AWS release fleets. ## Verification - `node --test scripts/__tests__/create-provider-pack-archive.test.mjs` (passed) - Vitest: `server/src/__tests__/runner-image-identity.test.ts` (42/42 passed) - Vitest: `server/src/__tests__/runner-image-workflow.test.ts` (18/18 passed) - PR CI also executes the live `Runner image` workflow end-to-end because both `scripts/create-provider-pack-archive.mjs` and `.github/workflows/runner-image.yml` are in its PR path filter. ## Risks - Low risk. Archive bytes and receipt structure are verified identical between serial and parallel runs. PRs, forks, and schedules remain on `ubuntu-latest` / `ubuntu-24.04-arm`, and `cloud-release-32` is the same GitHub-hosted larger runner already used on `master` by `docker.yml` and `cloud-migrator-artifacts.yml`. ## Model Used - Gemini 3 Pro (Antigravity agent with tool use, shell execution, and local test verification) ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
168253f74d
commit
e18fe61c8f
4 files changed
+103
-5
No files matched your search
@@ -212,6 +212,9 @@ jobs:
|
||||
|
||||
# Multi-arch by native runner, not QEMU, as in docker.yml. GitHub-hosted
|
||||
# runners: the protected release fleets admit only docker.yml on master.
|
||||
# Canonical master amd64 pushes use the larger GitHub-hosted runner
|
||||
# (cloud-release-32) to avoid 4-core CPU bottlenecks in archive compression
|
||||
# and OCI export; PRs, forks, schedules, and arm64 stay on standard runners.
|
||||
#
|
||||
# These legs cannot write to the registry on any event, and they
|
||||
# write no registry build cache. The install runs dependency lifecycle
|
||||
@@ -235,7 +238,7 @@ jobs:
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
runs-on: ${{ matrix.runner }}
|
||||
runs-on: ${{ matrix.arch == 'amd64' && github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064' && github.event_name == 'push' && github.ref == 'refs/heads/master' && (vars.CORE_PUBLICATION_RUNNER || 'cloud-release-32') || matrix.runner }}
|
||||
timeout-minutes: 60
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -729,7 +732,7 @@ jobs:
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
runs-on: ${{ matrix.runner }}
|
||||
runs-on: ${{ matrix.arch == 'amd64' && github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064' && github.event_name == 'push' && github.ref == 'refs/heads/master' && (vars.CORE_PUBLICATION_RUNNER || 'cloud-release-32') || matrix.runner }}
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
Reference in new issue
Block a user