mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
## Thinking Path > - Paperclip helps people manage work with AI agents. > - A release must pass onboarding before it reaches nightly. > - Onboarding changes already run source browser tests on PRs. > - The published release smoke used a separate scenario, which could drift from those tests. > - That drift blocked the December 1 nightly after onboarding succeeded. > - This PR fixes the stale welcome assertion and shares the scenario between release smoke and relevant PR E2E runs. ## Linked Issues or Issue Description Refs #23334 and #22259. **What happened?** [The December 1 nightly release](https://github.com/paperclipai/paperclip/actions/runs/46614290688) failed twice at `The onboarding chat must queue the lead's live welcome`. PR #23334 changed the welcome to a saved message and a question card. The greeting endpoint succeeded with `started: true` and `runId: null`, but the release test still required a model run. PR browser tests did not run those release expectations against the changed source. **Expected behavior** Onboarding PRs and changes to their shared dependencies must run the release scenario before merge. Known unrelated leaf-page changes and source-unit-test-only changes can omit the extra case. Shared and unfamiliar source paths must keep coverage. The scenario must check the lead's welcome and all three first-chat choices, with no model run before the user sends a choice or message. A mismatch must fail the required `ci / e2e` check. **Steps to reproduce** 1. Start the Docker onboarding harness with `PAPERCLIPAI_VERSION=2026.1130.0-canary.873300` and its provider verification mock. 2. Run the original release smoke test. 3. Observe successful login, setup, hire, and chat entry, followed by a timeout because the run list stays empty. **Paperclip version or commit** Failed release source: `7ce7d99f8af81ae90f97650ef7a8692a86c63a35`. Published package: `2026.1130.0-canary.873300`. **Deployment mode** The release test uses authenticated private Docker mode. The new PR test uses the existing disposable source E2E instance and provider verification fixture. ## What Changed - Check the saved welcome and the three visible choices, then require an empty agent run list. - Move the complete wizard, hire, and chat assertions into one shared onboarding scenario. Keep sign-in in the authenticated release wrapper. - Add the shared scenario to the normal PR E2E suite. Omit only this extra case when eligible source changes are confined to the Costs or Approvals UI page, source unit tests, and audited prose. Shared components, hooks, libraries, server code, mixed changes, and unfamiliar source paths keep it. The repository rules require `ci / e2e` before merge. - Pass the trusted CI change plan to shard selection and bind it to the checked-out commit. Reuse the existing lightweight source-diff eligibility gate for both Vitest and E2E, with the old Vitest export preserved. Full and shadow CI, broad or deleted inputs, invalid plans, and stale plans keep the case. No extra browser job or matrix is added. - Add release smoke files to the E2E and typecheck task inputs. Test that onboarding changes select E2E and that smoke-only changes select their two owners without forcing unrelated lanes. - Document the shared test command and the source and installation coverage. ## Verification The shared browser scenario is unchanged from `2044ada98e953504af68febe4c196f414d0bb1ae`. The selector review fix is based on master’s hosted-shard speed improvement. Selector and eligibility verification covers `236640e419d1177aafb64f3f7dd1ee49848ee707`. - Reproduced the original nightly timeout locally against the exact published canary. - The extracted release scenario passed against that canary in 22.1 seconds. - The new source E2E passed against PR source and the built UI in 32.3 seconds. - Restored the obsolete model-run assertion temporarily. The new source E2E failed with the same `Expected: > 0 / Received: 0` timeout. Restored the correct assertion. The final source confirmation passed in 31.7 seconds. - `node --test scripts/__tests__/e2e-shard.test.mjs .github/scripts/tests/ci-plan.test.mjs scripts/ci/test-selection-workflow.test.mjs`: all 52 tests passed after rebase. Coverage includes unrelated changes, relevant dependencies, rename paths, full/invalid/stale plans, exact CLI shard partitions, and both hosted shard policies. The unrelated-change and wiring tests failed before the filter was implemented. - Regression selection tests failed on `TaskChatComposer.tsx` and shadow mode before this review fix. They now keep the composer, new-agent runtime configuration, AI connection components, hooks, libraries, and mixed source changes. - The 3 existing source-diff eligibility contract tests passed after extraction into the shared module. - `actionlint .github/workflows/pr-trusted.yml` passed. - `node --test scripts/ci/test-selection-inputs.test.mjs`: 4 tests passed. - The Playwright program and focused source scenario typechecks passed. The test-budget check and `git diff --check` passed. - The default local source bootstrap could not load the macOS embedded PostgreSQL binary because its distribution lacked `libzstd.1.dylib`. Source browser verification used a separate disposable Docker PostgreSQL 16 instance. Linux CI will cover the normal embedded database path. - Earlier [hosted release smoke](https://github.com/paperclipai/paperclip/actions/runs/46776940022) passed both Docker onboarding and Linux background-service onboarding at the first fix commit. The service job first hit npm package propagation and passed on retry after publication completed. - `pnpm verify --explain` requested broader CI coverage because the CI task inputs changed. The focused checks above passed; the required CI jobs will provide broad coverage. - [Final-revision CI](https://github.com/paperclipai/paperclip/actions/runs/46782167000) passed on `236640e419d1177aafb64f3f7dd1ee49848ee707`. Both required aggregates, all 16 browser shards, and all selected typecheck, build, server, Runner, and canary dry-run jobs passed. [Incremental CI qualification](https://github.com/paperclipai/paperclip/actions/runs/46782166749) also passed. - [The new source onboarding case](https://github.com/paperclipai/paperclip/actions/runs/46782167000/job/143123174120) ran on the hosted Linux runner and passed in 20.8 seconds. - [Greptile review](https://github.com/paperclipai/paperclip/pull/23432#issuecomment-7330325410) scored `236640e419d1177aafb64f3f7dd1ee49848ee707` 5/5 and confirmed the shared-dependency finding is fixed. There are no unresolved review threads. ## Risks - This changes test coverage and CI selection. It does not change application behavior, release permissions, or publication rules. - The source case stays on for shared and unfamiliar source changes. It skips only the documented leaf pages and source-unit-test-only edits in eligible plans. Local full E2E still includes it. Extend exclusions only after checking that a path cannot affect onboarding. - The trusted PR workflow is loaded from master. Before merge, the current workflow keeps the full fallback because it does not yet pass the change plan to the shard command. The unit and CLI tests qualify the filtered path; after merge, the new workflow environment activates it. - The source test uses local trusted authentication. The authenticated published-package test remains responsible for login and installation checks. Neither run needs paid model completions. - GitHub master rules require code-owner approval for the protected CI changes. Those review requests are already open. There are no conflicts or unresolved review threads. - A replacement nightly still needs a successful release run after this reaches master. This PR does not bypass qualification or promote beta or stable. ## Model Used OpenAI Codex, `gpt-6.1-sol`, with xhigh reasoning effort, terminal tools, GitHub CLI, and Playwright. The harness does not report the context window size. ## 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 - [x] All Paperclip CI gates are green - [x] 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>
2010 lines
116 KiB
YAML
2010 lines
116 KiB
YAML
name: Trusted PR CI
|
|
|
|
# Rollout is intentionally two-step: merge this reusable workflow first, then
|
|
# replace pr.yml with an immutable-SHA caller so the active CI definition cannot
|
|
# drift from this file.
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
# Test reporters write local artifacts only. The workflow_run exporter owns
|
|
# the Honeycomb credential, so fork PRs cannot execute with it.
|
|
env:
|
|
PAPERCLIP_CI_PROFILE_DIR: ${{ github.workspace }}/.ci-profile
|
|
# Empty keeps the PR default of one Vitest retry (scripts/ci/vitest-retry.mjs).
|
|
# Set the CI_VITEST_RETRY repository variable to 0 to switch retries off.
|
|
PAPERCLIP_VITEST_RETRY: ${{ vars.CI_VITEST_RETRY }}
|
|
|
|
concurrency:
|
|
group: pr-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
gate:
|
|
uses: paperclipai/paperclip/.github/workflows/ci-routing.yml@master
|
|
|
|
test_selection:
|
|
name: Select Vitest files
|
|
needs: [gate]
|
|
if: >-
|
|
needs.gate.outputs.full_ci == 'true' && needs.gate.outputs.plan != '' &&
|
|
fromJSON(needs.gate.outputs.plan).mode == 'enabled' &&
|
|
fromJSON(needs.gate.outputs.plan).forceReason == null &&
|
|
(vars.CI_VITEST_SELECTION == '' || vars.CI_VITEST_SELECTION == 'enabled')
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 10
|
|
# An unavailable optimization must not suppress the original test matrix.
|
|
continue-on-error: true
|
|
outputs:
|
|
plan: ${{ steps.publish.outputs.plan }}
|
|
env:
|
|
CI_PLAN: ${{ needs.gate.outputs.plan }}
|
|
CI_RUNNER_PROFILE: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 'hosted' || 'aws' }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
# The merge commit and its two parent trees are the complete diff.
|
|
fetch-depth: 2
|
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
- name: Check source-diff eligibility
|
|
id: eligible
|
|
run: |
|
|
if [[ -f scripts/ci/select-tests.mjs ]]; then
|
|
node scripts/ci/select-tests.mjs --eligible
|
|
else
|
|
echo 'enabled=false' >> "$GITHUB_OUTPUT"
|
|
fi
|
|
# Same trusted bootstrap as every other pnpm setup in this workflow:
|
|
# Node immediately first, and no npm audit, fund or update-notifier calls.
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
if: steps.eligible.outputs.enabled == 'true'
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
if: steps.eligible.outputs.enabled == 'true'
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Setup pnpm
|
|
if: steps.eligible.outputs.enabled == 'true' && steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
- name: Restore dependencies for graph analysis
|
|
if: steps.eligible.outputs.enabled == 'true'
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
- name: Select files and rebalance test lanes
|
|
id: select
|
|
if: steps.eligible.outputs.enabled == 'true'
|
|
timeout-minutes: 5
|
|
run: node scripts/ci/select-tests.mjs
|
|
- name: Upload validated selection and audit
|
|
id: upload_selection
|
|
if: steps.select.outputs.selected == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
with:
|
|
name: vitest-selection-${{ github.run_attempt }}
|
|
path: |
|
|
.ci-test-selection/manifest.json
|
|
.ci-test-selection/audit.json
|
|
include-hidden-files: true
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
# Publish only after upload succeeds. Missing/failed/timed-out selectors
|
|
# produce no plan, and dependent jobs use the original gate's matrix.
|
|
- name: Publish the executable plan
|
|
id: publish
|
|
if: steps.eligible.outputs.enabled == 'true'
|
|
env:
|
|
ARTIFACT_ID: ${{ steps.upload_selection.outputs.artifact-id }}
|
|
run: |
|
|
node --input-type=module <<'NODE'
|
|
import assert from 'node:assert/strict';
|
|
import { appendFileSync, readFileSync } from 'node:fs';
|
|
const plan = JSON.parse(readFileSync('.ci-test-selection/plan.json', 'utf8'));
|
|
if (plan.testSelection) {
|
|
assert.match(process.env.ARTIFACT_ID ?? '', /^[0-9]+$/);
|
|
plan.testSelection.artifactId = process.env.ARTIFACT_ID;
|
|
}
|
|
appendFileSync(process.env.GITHUB_OUTPUT, `plan=${JSON.stringify(plan)}\n`);
|
|
NODE
|
|
|
|
policy:
|
|
needs: [gate]
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 10
|
|
|
|
env:
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: policy
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Select compatible Node test command
|
|
run: |
|
|
# A rerun can use this trusted workflow with a pre-feature checkout.
|
|
if [[ -f scripts/ci-profile/node-test.mjs ]]; then
|
|
echo 'CI_NODE_TEST=scripts/ci-profile/node-test.mjs' >> "$GITHUB_ENV"
|
|
else
|
|
echo 'CI_NODE_TEST=--test' >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
# Only trusted environments write lock content: the lockfile refresh
|
|
# workflow, and Dependabot when the lockfile bytes come from a verified
|
|
# Dependabot commit. Run the policy from the current base-branch tip so a
|
|
# pull request cannot rewrite the check that judges it.
|
|
- name: Block untrusted lockfile edits
|
|
id: lockfile_writer
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
|
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
|
|
HEAD_REF: ${{ github.head_ref }}
|
|
run: |
|
|
# GitHub does not move pull_request.base.sha forward on every push, so
|
|
# it can name an old base-branch commit. The checkout is GitHub's merge
|
|
# commit: its first parent is the current base-branch tip, and its
|
|
# second parent is the PR head. Load the policy from that tip.
|
|
trusted_base="$BASE_SHA"
|
|
if [ "$(git rev-parse --verify --quiet "$GITHUB_SHA^2")" = "$HEAD_SHA" ]; then
|
|
trusted_base="$(git rev-parse "$GITHUB_SHA^1")"
|
|
fi
|
|
policy="$RUNNER_TEMP/lockfile-trust.mjs"
|
|
if git show "$trusted_base:.github/scripts/lockfile-trust.mjs" > "$policy" 2>/dev/null; then
|
|
BASE_SHA="$trusted_base" node "$policy" pr
|
|
# Fail closed if the policy did not run.
|
|
if ! grep -q '^writer=' "$GITHUB_OUTPUT"; then
|
|
echo "::error title=Lockfile policy::lockfile-trust.mjs did not report a lockfile writer."
|
|
exit 1
|
|
fi
|
|
exit 0
|
|
fi
|
|
# The base predates lockfile-trust.mjs: keep the earlier rule.
|
|
echo "writer=none" >> "$GITHUB_OUTPUT"
|
|
if [ "$HEAD_REF" = 'chore/refresh-lockfile' ] || [ "$PR_AUTHOR" = 'dependabot[bot]' ]; then
|
|
exit 0
|
|
fi
|
|
changed="$(git diff --name-only "$trusted_base...$HEAD_SHA")"
|
|
if printf '%s\n' "$changed" | grep -qx 'pnpm-lock.yaml'; then
|
|
echo "Do not commit pnpm-lock.yaml in pull requests. CI owns lockfile updates."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
run_install: false
|
|
|
|
- name: Validate migration ordering against target branch
|
|
run: >-
|
|
node .github/scripts/check-pr-migration-order.mjs
|
|
"${{ github.event.pull_request.base.sha }}"
|
|
"${{ github.event.pull_request.head.sha }}"
|
|
|
|
- name: Validate Dockerfile deps stage
|
|
run: |
|
|
node ./scripts/check-docker-deps-stage.mjs
|
|
node "$CI_NODE_TEST" ./scripts/docker-deps-postinstall.test.mjs
|
|
|
|
- name: Validate Node version policy
|
|
run: pnpm check:node-version
|
|
|
|
- name: Reject git push in adapter/runtime code
|
|
run: node ./scripts/check-no-git-push.mjs
|
|
|
|
- name: Test no-git-push check
|
|
run: node "$CI_NODE_TEST" ./scripts/check-no-git-push.test.mjs
|
|
|
|
- name: Validate feature module boundaries
|
|
run: pnpm check:module-boundaries
|
|
|
|
- name: Test feature module boundary check
|
|
run: node "$CI_NODE_TEST" ./scripts/check-module-boundaries.test.mjs
|
|
|
|
- name: Reject raw query-error rendering
|
|
run: node scripts/check-query-error-rendering.mjs --enforce --summary
|
|
|
|
- name: Test query-error rendering check
|
|
run: node --test ./scripts/check-query-error-rendering.test.mjs
|
|
|
|
- name: Test PR quality-gate scripts
|
|
run: node "$CI_NODE_TEST" '.github/scripts/tests/*.test.mjs'
|
|
|
|
- name: Test general-server shard partition
|
|
run: |
|
|
tests=(./scripts/__tests__/run-vitest-stable-shard.test.mjs)
|
|
if [[ -f ./scripts/__tests__/run-vitest-stable-pr-mode.test.mjs ]]; then tests+=(./scripts/__tests__/run-vitest-stable-pr-mode.test.mjs); fi
|
|
node "$CI_NODE_TEST" "${tests[@]}"
|
|
|
|
- name: Test e2e shard partition
|
|
run: node "$CI_NODE_TEST" ./scripts/__tests__/e2e-shard.test.mjs
|
|
|
|
- name: Check CI test budget policy
|
|
run: |
|
|
if [[ -f ./scripts/check-test-budget.mjs ]]; then
|
|
base_sha="${{ github.event.pull_request.base.sha }}"
|
|
if [[ -n "$base_sha" ]]; then
|
|
node ./scripts/check-test-budget.mjs --base "$base_sha"
|
|
else
|
|
node ./scripts/check-test-budget.mjs
|
|
fi
|
|
fi
|
|
if [[ -f ./scripts/check-test-budget.test.mjs ]]; then
|
|
node "$CI_NODE_TEST" ./scripts/check-test-budget.test.mjs
|
|
fi
|
|
|
|
- name: Test release verify workflow wiring
|
|
run: |
|
|
tests=(./scripts/__tests__/release-verify-workflow.test.mjs ./scripts/__tests__/eval-schedule-monitor.test.mjs ./scripts/__tests__/prepare-runner-release-image.test.mjs ./scripts/cloud-source-verification.test.mjs ./scripts/cloud-readiness-runner-loss.test.mjs ./scripts/standard-image-contract.test.mjs ./scripts/reuse-canary-image.test.mjs)
|
|
for test in ./scripts/github-actions-rate-limit.test.mjs ./scripts/docker-image-metadata.test.mjs; do
|
|
if [[ -f "$test" ]]; then tests+=("$test"); fi
|
|
done
|
|
if [[ -f ./scripts/verify-canary-provenance.test.mjs ]]; then tests+=(./scripts/verify-canary-provenance.test.mjs); fi
|
|
node "$CI_NODE_TEST" "${tests[@]}"
|
|
|
|
- name: Test merge-queue workflow wiring
|
|
# This workflow loads from master and tests the caller's checkout. A
|
|
# rerun of an older pull request has no copy of these tests.
|
|
run: |
|
|
tests=()
|
|
for test in ./scripts/merge-group-image.test.mjs ./scripts/__tests__/merge-queue-checks-workflow.test.mjs; do
|
|
if [[ -f "$test" ]]; then tests+=("$test"); fi
|
|
done
|
|
if (( ${#tests[@]} > 0 )); then node "$CI_NODE_TEST" "${tests[@]}"; fi
|
|
|
|
- name: Test standalone package build concurrency
|
|
run: node "$CI_NODE_TEST" ./scripts/__tests__/build-standalone-concurrency.test.mjs
|
|
|
|
- name: Validate release package manifest
|
|
run: node ./scripts/release-package-map.mjs check
|
|
|
|
- name: Verify release package bootstrap for changed manifests
|
|
run: |
|
|
mapfile -t changed_paths < <(git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}")
|
|
PAPERCLIP_RELEASE_BOOTSTRAP_BASE_SHA="${{ github.event.pull_request.base.sha }}" \
|
|
node ./scripts/check-release-package-bootstrap.mjs "${changed_paths[@]}"
|
|
|
|
# Each lane resolves a stale lockfile inline; this early check still
|
|
# fails fast when the merge tree cannot resolve at all.
|
|
- name: Validate dependency resolution
|
|
run: pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
typecheck_release_registry:
|
|
name: Typecheck + Release Registry
|
|
needs: [gate]
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.typecheck_release_registry.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 20
|
|
|
|
env:
|
|
CI_PLAN: ${{ needs.gate.outputs.plan }}
|
|
PAPERCLIP_CI_BASE_SHA: ${{ needs.gate.outputs.plan != '' && fromJSON(needs.gate.outputs.plan).diff.base || github.event.pull_request.base.sha }}
|
|
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Typecheck + Release Registry
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 2
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') != ''
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
- name: Locate pnpm store
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
id: pnpm_store
|
|
run: |
|
|
echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
echo "arch=$(node -p 'process.arch')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore pnpm store (read only)
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.pnpm_store.outputs.path }}
|
|
key: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
# Manifest-changing and stacked PRs can hold a pnpm-lock.yaml that is
|
|
# stale for the merge tree. Resolve it inline instead of waiting on a
|
|
# policy-job artifact: that dependency put the policy job's queue and
|
|
# runtime (~60s) on every lane's critical path, and policy still
|
|
# validates resolution as a required check in parallel.
|
|
run: |
|
|
if ! pnpm install --frozen-lockfile; then
|
|
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
|
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
fi
|
|
|
|
# The typecheck lane builds @paperclipai/server, whose build script
|
|
# rebuilds the Runner release binary; without the shared Rust cache that
|
|
# is a ~3m40s cold compile of all third-party crates (run 35036001734,
|
|
# 2026-09-15). Same restore-only contract as Verify Paperclip Runner.
|
|
|
|
# rust-cache hashes its absolute cache paths into the entry's version,
|
|
# and GitHub only serves an entry whose key and version both match. The
|
|
# target directory sits under the checkout, and the checkout root
|
|
# differs by runner: /home/runner/_work on the RunsOn fleets that write
|
|
# this cache against /home/runner/work on GitHub-hosted runners. Every
|
|
# key input agreed, yet all 25 completed pull requests on 2026-09-28
|
|
# logged "No cache found" (run 36424309181) and cold-compiled every
|
|
# crate for ~4 minutes in four lanes. Point rust-cache at the same
|
|
# directory through a checkout-independent path so both layouts hash
|
|
# the same version. Keep this block identical in both workflows: the
|
|
# reader and the writer must agree or the version matches nothing.
|
|
- name: Pin the Runner Rust workspace path
|
|
id: runner_rust_workspace
|
|
run: |
|
|
set -euo pipefail
|
|
pinned="$HOME/paperclip-runner-rust"
|
|
# A symlink here is removed as a link, never followed into the checkout.
|
|
rm -rf "$pinned"
|
|
ln -s "$GITHUB_WORKSPACE/packages/paperclip-runner/runner" "$pinned"
|
|
echo "path=$pinned" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Select the pinned Runner Rust toolchain
|
|
working-directory: packages/paperclip-runner
|
|
run: |
|
|
set -uo pipefail
|
|
|
|
# release-verify.yml runs on a single post-merge fleet image; the
|
|
# gate here can route to ubuntu-latest or the public PR fleet, so
|
|
# this tolerates an image without rustup instead of failing every
|
|
# pull request. Without the pin the cache key simply will not match.
|
|
if ! command -v rustup >/dev/null 2>&1; then
|
|
echo '::notice title=Runner Rust cache::rustup is unavailable; building with the image default toolchain'
|
|
exit 0
|
|
fi
|
|
|
|
rustup show
|
|
toolchain="$(rustup show active-toolchain | awk '{print $1}')"
|
|
echo "RUSTUP_TOOLCHAIN=$toolchain" >> "$GITHUB_ENV"
|
|
|
|
# rust-cache hashes every installed toolchain into the cache key, not
|
|
# only the active one. Each runner image also ships its own stable
|
|
# Rust, and those disagree across images: 1.98.0 on the RunsOn fleets
|
|
# against 1.98.1 on ubuntu-latest. Two runners that agreed on the pin
|
|
# therefore still computed different keys, and every GitHub-hosted
|
|
# pull request missed this cache while the fleet hit it. Remove every
|
|
# toolchain except the pin, so the key depends on the pinned compiler
|
|
# and the lockfile alone rather than on what the image happens to
|
|
# carry. Keep this block identical in both workflows: the reader and
|
|
# the writer must agree or the key matches nothing.
|
|
extra_toolchains="$(rustup toolchain list | awk '{print $1}' | grep -vx "$toolchain" || true)"
|
|
if [ -n "$extra_toolchains" ]; then
|
|
echo "$extra_toolchains" | xargs -n1 rustup toolchain uninstall \
|
|
|| echo '::notice title=Runner Rust cache::could not remove an extra toolchain; the cache key may not match'
|
|
fi
|
|
rustup toolchain list
|
|
|
|
- name: Restore Runner Rust dependencies (read only)
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
workspaces: ${{ steps.runner_rust_workspace.outputs.path }} -> target
|
|
shared-key: release-runner-v2-${{ hashFiles('packages/paperclip-runner/runner/Cargo.toml', '.cargo/config', '.cargo/config.toml', 'packages/.cargo/config', 'packages/.cargo/config.toml', 'packages/paperclip-runner/.cargo/config', 'packages/paperclip-runner/.cargo/config.toml', 'packages/paperclip-runner/runner/.cargo/config', 'packages/paperclip-runner/runner/.cargo/config.toml') }}
|
|
# Mirror the master writer: these also feed the cache key.
|
|
cache-workspace-crates: false
|
|
cache-bin: false
|
|
# Restore only. Never let a pull request evict master's entry.
|
|
save-if: false
|
|
|
|
# The Runner's own crate is the one thing the entry above leaves out:
|
|
# rust-cache drops workspace crates when it saves, and a fresh checkout
|
|
# would invalidate cargo's mtime fingerprints for them anyway. So this
|
|
# job compiled paperclip-runner-core in release mode on every run,
|
|
# 28-49s (runs 38169436532 to 38183149920, 2026-10-11), while 221 of
|
|
# the 239 master commits of the preceding week left its inputs alone.
|
|
# The master Rust lane in release-verify.yml saves that crate's release
|
|
# artifacts (about 70 MB) under a key made from the compiler, the
|
|
# checkout root and a hash of every input the build reads. A pull
|
|
# request whose merge tree carries byte-identical inputs restores them
|
|
# and marks them newer than the checkout, so cargo keeps them; any
|
|
# other pull request misses and compiles exactly as before. Exact key
|
|
# only: a prefix match would hand cargo another revision's output. The
|
|
# path list and the key live in scripts/runner-release-crate-cache.mjs
|
|
# and must match the writer's; a guard test holds them together.
|
|
- name: Compute the Runner release crate cache key
|
|
id: runner_release_crate_key
|
|
run: echo "scope=$(node scripts/runner-release-crate-cache.mjs scope)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore the Runner release crate (read only)
|
|
id: runner_release_crate
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: |
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-runner-core-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_runner_core-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runner_core-*.d
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runnerd-*
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd.d
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-process-table-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_process_table-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_process_table-*.d
|
|
key: runner-release-crate-v1-${{ steps.runner_release_crate_key.outputs.scope }}-${{ hashFiles('packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'tests/runner-e2e/fixtures/**') }}
|
|
|
|
- name: Mark the restored Runner release crate current
|
|
if: ${{ steps.runner_release_crate.outputs.cache-hit == 'true' }}
|
|
run: node scripts/runner-release-crate-cache.mjs mark-current
|
|
|
|
# Exact-key master cache for prebuilt Runner dist (read-only restore;
|
|
# prepare-runner-vendor.mjs self-validates the SHA-256 input digest and
|
|
# every output size, rebuilding on any mismatch).
|
|
- name: Restore prebuilt Runner dist (read only)
|
|
id: runner_dist
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: |
|
|
packages/paperclip-runner/dist
|
|
packages/paperclip-runner/node_modules/.cache/paperclip-runner-build-inputs.json
|
|
packages/paperclip-eval-kernel/dist
|
|
key: runner-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'tsconfig.base.json', 'patches/**', 'packages/shared/src/**', 'packages/adapter-utils/src/**', 'packages/plugins/sdk/src/**', 'packages/paperclip-runner/package.json', 'packages/paperclip-runner/tsconfig*.json', 'packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/cursor-*.json', 'packages/paperclip-runner/src/**', 'packages/paperclip-runner/scripts/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/spec/**', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'packages/paperclip-eval-kernel/package.json', 'packages/paperclip-eval-kernel/tsconfig*.json', 'packages/paperclip-eval-kernel/src/**') }}
|
|
|
|
# Prefix-keyed master cache for TS 7 incremental .tsbuildinfo + dts outputs
|
|
# (read-only restore). TypeScript 7 hashes file contents so changed PR files
|
|
# always re-check cleanly while unchanged layers finish 10-18x faster.
|
|
- name: Restore incremental typecheck cache (read only)
|
|
id: typecheck_incremental
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: |
|
|
server/node_modules/.cache/paperclip-typecheck
|
|
ui/node_modules/.cache/paperclip-ui.tsbuildinfo
|
|
key: typecheck-incremental-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'server/tsconfig.json', 'server/src/__tests__/tsconfig.json', 'server/scripts/typecheck-layers.mjs', 'ui/tsconfig.json') }}-${{ github.event.pull_request.base.sha }}
|
|
restore-keys: |
|
|
typecheck-incremental-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'server/tsconfig.json', 'server/src/__tests__/tsconfig.json', 'server/scripts/typecheck-layers.mjs', 'ui/tsconfig.json') }}-
|
|
|
|
- name: Typecheck, CLI guidance safety and release registry tests
|
|
if: ${{ hashFiles('scripts/ci-typecheck-lane.mjs') != '' }}
|
|
run: node scripts/ci-typecheck-lane.mjs
|
|
|
|
- name: Typecheck a checkout that predates the typecheck lane script
|
|
if: ${{ hashFiles('scripts/ci-typecheck-lane.mjs') == '' }}
|
|
env:
|
|
PAPERCLIP_TYPECHECK_LOW_MEMORY: "1"
|
|
run: |
|
|
pnpm run typecheck:build-gaps
|
|
node scripts/typecheck-test-programs.mjs --low-memory
|
|
pnpm --filter @paperclipai/server typecheck
|
|
node scripts/typecheck-test-projects.mjs --low-memory --reuse-declarations
|
|
pnpm exec vitest run --project @paperclipai/server server/src/__tests__/cli-invocation-safety.test.ts
|
|
pnpm run test:release-registry
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
general_tests:
|
|
name: General tests (${{ matrix.group_label }})
|
|
needs: [gate, test_selection]
|
|
if: ${{ always() && !cancelled() && needs.gate.result == 'success' && needs.gate.outputs.full_ci == 'true' && ((needs.test_selection.outputs.plan || needs.gate.outputs.plan) == '' || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.general_tests.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
|
matrix: ${{ fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan) != '' && toJSON((needs.gate.outputs.runner == 'ubuntu-latest' && fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.general_tests.hosted_matrix) || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.general_tests.matrix) || (needs.gate.outputs.runner == 'ubuntu-latest' && '{"include":[{"group":"general-server-without-chat","group_label":"server (1/8)","shard_index":0,"shard_count":8,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (2/8)","shard_index":1,"shard_count":8,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (3/8)","shard_index":2,"shard_count":8,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (4/8)","shard_index":3,"shard_count":8,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (5/8)","shard_index":4,"shard_count":8,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (6/8)","shard_index":5,"shard_count":8,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (7/8)","shard_index":6,"shard_count":8,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (8/8)","shard_index":7,"shard_count":8,"task":"ci:server"},{"group":"general-chat","group_label":"chat (1/1)","shard_index":0,"shard_count":1,"task":"ci:chat"},{"group":"general-workspaces-a","group_label":"workspaces-a (1/1)","shard_index":0,"shard_count":1,"task":"ci:workspaces-a"},{"group":"general-workspaces-b","group_label":"workspaces-b (1/1)","shard_index":0,"shard_count":1,"task":"ci:workspaces-b"},{"group":"general-workspaces-c","group_label":"workspaces-c","task":"ci:db"}]}' || '{"include":[{"group":"general-server-without-chat","group_label":"server (1/20)","shard_index":0,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (2/20)","shard_index":1,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (3/20)","shard_index":2,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (4/20)","shard_index":3,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (5/20)","shard_index":4,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (6/20)","shard_index":5,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (7/20)","shard_index":6,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (8/20)","shard_index":7,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (9/20)","shard_index":8,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (10/20)","shard_index":9,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (11/20)","shard_index":10,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (12/20)","shard_index":11,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (13/20)","shard_index":12,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (14/20)","shard_index":13,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (15/20)","shard_index":14,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (16/20)","shard_index":15,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (17/20)","shard_index":16,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (18/20)","shard_index":17,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (19/20)","shard_index":18,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (20/20)","shard_index":19,"shard_count":20,"task":"ci:server"},{"group":"general-chat","group_label":"chat (1/3)","shard_index":0,"shard_count":3,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (2/3)","shard_index":1,"shard_count":3,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (3/3)","shard_index":2,"shard_count":3,"task":"ci:chat"},{"group":"general-workspaces-a","group_label":"workspaces-a (1/2)","shard_index":0,"shard_count":2,"task":"ci:workspaces-a"},{"group":"general-workspaces-a","group_label":"workspaces-a (2/2)","shard_index":1,"shard_count":2,"task":"ci:workspaces-a"},{"group":"general-workspaces-b","group_label":"workspaces-b (1/2)","shard_index":0,"shard_count":2,"task":"ci:workspaces-b"},{"group":"general-workspaces-b","group_label":"workspaces-b (2/2)","shard_index":1,"shard_count":2,"task":"ci:workspaces-b"},{"group":"general-workspaces-c","group_label":"workspaces-c","task":"ci:db"}]}')) }}
|
|
|
|
env:
|
|
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
|
PAPERCLIP_CI_TEST_SELECTION: ${{ matrix.selection && '.ci-test-selection/manifest.json' || '' }}
|
|
PAPERCLIP_CI_SELECTION_HASH: ${{ matrix.selection && fromJSON(needs.test_selection.outputs.plan).testSelection.hash || '' }}
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: General tests (${{ matrix.group_label }})
|
|
# The reporting-lock policy test skips a Dependabot lockfile, which the
|
|
# policy job verifies and the lockfile refresh admits after merge.
|
|
PAPERCLIP_CI_PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Download selected test files
|
|
if: matrix.selection
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
|
with:
|
|
artifact-ids: ${{ fromJSON(needs.test_selection.outputs.plan).testSelection.artifactId }}
|
|
path: .ci-test-selection
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') != ''
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
- name: Locate pnpm store
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
id: pnpm_store
|
|
run: |
|
|
echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
echo "arch=$(node -p 'process.arch')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore pnpm store (read only)
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.pnpm_store.outputs.path }}
|
|
key: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
# Manifest-changing and stacked PRs can hold a pnpm-lock.yaml that is
|
|
# stale for the merge tree. Resolve it inline instead of waiting on a
|
|
# policy-job artifact: that dependency put the policy job's queue and
|
|
# runtime (~60s) on every lane's critical path, and policy still
|
|
# validates resolution as a required check in parallel.
|
|
run: |
|
|
if ! pnpm install --frozen-lockfile; then
|
|
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
|
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
fi
|
|
|
|
- name: Run grouped general test suites through Turbo
|
|
if: hashFiles('turbo.json', '.github/actions/run-ci-task/action.yml') != ''
|
|
uses: ./.github/actions/run-ci-task
|
|
with:
|
|
task: ${{ matrix.task }}
|
|
args: ${{ matrix.shard_count && format('["--shard-index","{0}","--shard-count","{1}"]', matrix.shard_index, matrix.shard_count) || '[]' }}
|
|
partition: ${{ strategy.job-index || 0 }}
|
|
force: ${{ needs.gate.outputs.profile_ci == 'true' || (needs.test_selection.outputs.plan || needs.gate.outputs.plan) == '' || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).mode != 'enabled' || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).forceReason != null }}
|
|
|
|
- name: Run grouped general test suites
|
|
if: hashFiles('turbo.json') == ''
|
|
run: |
|
|
if [ -n "${{ matrix.shard_count }}" ]; then
|
|
pnpm test:run:general -- --group '${{ matrix.group }}' \
|
|
--shard-index ${{ matrix.shard_index }} --shard-count ${{ matrix.shard_count }}
|
|
else
|
|
pnpm test:run:general -- --group '${{ matrix.group }}'
|
|
fi
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
docker_context_integrity:
|
|
name: Docker context integrity
|
|
needs: gate
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.docker_context_integrity.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 15
|
|
|
|
env:
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Docker context integrity
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Not every runner the gate can select ships the Buildx plugin —
|
|
# the image-build workflows set it up explicitly, so this lane does
|
|
# too rather than failing before it checks anything.
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
|
|
|
|
- name: Set up Docker Compose
|
|
uses: docker/setup-compose-action@54042514f505b273907334ae2b9cdbb9a0213c1a # v2
|
|
with:
|
|
version: v5.5.1
|
|
|
|
- name: Verify Compose signing secret forwarding
|
|
run: node --test scripts/docker-compose-secrets.test.mjs
|
|
|
|
# Same .dockerignore semantics as the real image builds: a
|
|
# context-slimming change that strips a committed build input must
|
|
# fail here, on the pull request, instead of failing every
|
|
# post-merge image build. (2026-09-04: a new **/*.md ignore rule
|
|
# stripped the committed capability contract out of the context;
|
|
# every Docker build on master failed its drift check and no cloud
|
|
# image published for eight hours while PR CI stayed green.)
|
|
- name: Run generated-file drift checks against the Docker build context
|
|
run: docker buildx build --file .github/docker-context-checks.Dockerfile .
|
|
|
|
- name: Verify Tailscale runtime clients
|
|
run: docker buildx build --file Dockerfile --target tailscale-client .
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
# Sandbox providers are outside the root workspace, so no other lane runs their
|
|
# tests. The `//#ci:sandbox-providers` inputs in turbo.json select this job: the
|
|
# providers, the plugin SDK, and the shared package the SDK depends on.
|
|
sandbox_provider_tests:
|
|
name: Sandbox provider tests
|
|
needs: [gate]
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.sandbox_provider_tests.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 15
|
|
|
|
env:
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Sandbox provider tests
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
# The script installs the providers from their own lockfiles, links the
|
|
# in-repo plugin SDK, and runs every provider suite. Daytona's capacity
|
|
# tests kill a process at a file-size limit inside the exported
|
|
# directory. On a runner that allows core dumps, its core file joins the
|
|
# export and changes the transferred file count, so turn core dumps off.
|
|
- name: Run sandbox provider tests
|
|
run: |
|
|
ulimit -c 0
|
|
node scripts/test-sandbox-providers.mjs
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
verify_runner_e2e_support:
|
|
name: Runner support suite (${{ matrix.shard_label }})
|
|
needs: [gate]
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.verify_runner_e2e_support.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
|
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON((needs.gate.outputs.runner == 'ubuntu-latest' && fromJSON(needs.gate.outputs.plan).jobs.verify_runner_e2e_support.hosted_matrix) || fromJSON(needs.gate.outputs.plan).jobs.verify_runner_e2e_support.matrix) || (needs.gate.outputs.runner == 'ubuntu-latest' && '{"include":[{"shard_index":0,"shard_count":2,"shard_label":"1/2","task":"ci:runner-e2e-support"},{"shard_index":1,"shard_count":2,"shard_label":"2/2","task":"ci:runner-e2e-support"}]}' || '{"include":[{"shard_index":0,"shard_count":4,"shard_label":"1/4","task":"ci:runner-e2e-support"},{"shard_index":1,"shard_count":4,"shard_label":"2/4","task":"ci:runner-e2e-support"},{"shard_index":2,"shard_count":4,"shard_label":"3/4","task":"ci:runner-e2e-support"},{"shard_index":3,"shard_count":4,"shard_label":"4/4","task":"ci:runner-e2e-support"}]}')) }}
|
|
|
|
env:
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Runner support suite (${{ matrix.shard_label }})
|
|
PAPERCLIP_CI_PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
|
|
|
# The paid Runner workflows depend on this suite: workflow security
|
|
# policy, evidence oracles, cost receipts and controller recovery. It
|
|
# used to run only in a manual Docker Runner check, so master changes
|
|
# broke it unseen (#19527, #19529). It needs no provider credentials.
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
# Builds the plugin SDK first, then runs Vitest and the node:test files.
|
|
- name: Run the Runner support suite
|
|
run: |
|
|
if grep -q 'shard-index' tests/runner-e2e/run-unit.mjs; then
|
|
node tests/runner-e2e/run-unit.mjs --shard-index ${{ matrix.shard_index }} --shard-count ${{ matrix.shard_count }}
|
|
elif [ "${{ matrix.shard_index }}" = "0" ]; then
|
|
pnpm test:e2e:runner:unit
|
|
else
|
|
echo "Checkout predates sharded run-unit.mjs; shard 0 covers full suite."
|
|
fi
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
verify:
|
|
name: verify
|
|
if: ${{ always() }}
|
|
needs: [gate, test_selection, policy, typecheck_release_registry, general_tests, verify_paperclip_runner, build, docker_context_integrity, sandbox_provider_tests, verify_serialized_server, canary_dry_run, verify_runner_e2e_support]
|
|
runs-on: ubuntu-slim
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Validate every planned suite result
|
|
env:
|
|
FULL_CI: ${{ needs.gate.outputs.full_ci }}
|
|
CI_PLAN: ${{ needs.test_selection.outputs.plan || needs.gate.outputs.plan }}
|
|
CI_RESULTS: ${{ toJSON(needs) }}
|
|
run: |
|
|
node --input-type=module <<'NODE'
|
|
import assert from 'node:assert/strict';
|
|
const results = JSON.parse(process.env.CI_RESULTS);
|
|
assert.equal(results.gate.result, 'success', 'CI routing must succeed');
|
|
assert.equal(results.policy.result, 'success', 'Policy must succeed');
|
|
assert.ok(['true', 'false'].includes(process.env.FULL_CI), 'Valid scope required');
|
|
const plan = process.env.CI_PLAN ? JSON.parse(process.env.CI_PLAN) : null;
|
|
if (plan) assert.equal(plan.version, 1, 'Supported task plan required');
|
|
if (plan?.testSelection) assert.equal(results.test_selection.result, 'success', 'Published selection must succeed');
|
|
for (const job of ["typecheck_release_registry","general_tests","verify_paperclip_runner","build","docker_context_integrity","sandbox_provider_tests","verify_serialized_server","canary_dry_run","verify_runner_e2e_support"]) {
|
|
if (plan) assert.equal(typeof plan.jobs[job]?.run, 'boolean', 'Missing suite decision: ' + job);
|
|
const selected = process.env.FULL_CI === 'true' && (!plan || plan.jobs[job].run);
|
|
assert.equal(results[job].result, selected ? 'success' : 'skipped', job);
|
|
}
|
|
NODE
|
|
|
|
verify_paperclip_runner:
|
|
name: Verify Paperclip Runner (${{ matrix.lane_label }})
|
|
needs: [gate]
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.verify_paperclip_runner.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
|
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON((needs.gate.outputs.runner == 'ubuntu-latest' && fromJSON(needs.gate.outputs.plan).jobs.verify_paperclip_runner.hosted_matrix) || fromJSON(needs.gate.outputs.plan).jobs.verify_paperclip_runner.matrix) || (needs.gate.outputs.runner == 'ubuntu-latest' && '{"include":[{"lane_label":"static checks","command":"check:static","release_crate":true,"task":"ci:runner-static"},{"lane_label":"rust","command":"check:runner","release_crate":true,"task":"ci:runner-rust"},{"lane_label":"vitest package (1/3)","command":"test:typescript:vitest --package-lane=1/3","task":"ci:runner-package"},{"lane_label":"vitest package (2/3)","command":"test:typescript:vitest --package-lane=2/3","task":"ci:runner-package"},{"lane_label":"vitest package (3/3)","command":"test:typescript:vitest --package-lane=3/3","task":"ci:runner-package"},{"lane_label":"vitest native server","command":"test:typescript:vitest --native-server","release_crate":true,"task":"ci:runner-vitest"}]}' || '{"include":[{"lane_label":"static checks","command":"check:static","release_crate":true,"task":"ci:runner-static"},{"lane_label":"rust","command":"check:runner","release_crate":true,"task":"ci:runner-rust"},{"lane_label":"vitest package (1/6)","command":"test:typescript:vitest --package-lane=1/6","task":"ci:runner-package"},{"lane_label":"vitest package (2/6)","command":"test:typescript:vitest --package-lane=2/6","task":"ci:runner-package"},{"lane_label":"vitest package (3/6)","command":"test:typescript:vitest --package-lane=3/6","task":"ci:runner-package"},{"lane_label":"vitest package (4/6)","command":"test:typescript:vitest --package-lane=4/6","task":"ci:runner-package"},{"lane_label":"vitest package (5/6)","command":"test:typescript:vitest --package-lane=5/6","task":"ci:runner-package"},{"lane_label":"vitest package (6/6)","command":"test:typescript:vitest --package-lane=6/6","task":"ci:runner-package"},{"lane_label":"vitest native server (1/2)","command":"test:typescript:vitest --native-server=1/2","release_crate":true,"task":"ci:runner-vitest"},{"lane_label":"vitest native server (2/2)","command":"test:typescript:vitest --native-server=2/2","release_crate":true,"task":"ci:runner-vitest"}]}')) }}
|
|
|
|
env:
|
|
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Verify Paperclip Runner (${{ matrix.lane_label }})
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') != ''
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
- name: Locate pnpm store
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
id: pnpm_store
|
|
run: |
|
|
echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
echo "arch=$(node -p 'process.arch')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore pnpm store (read only)
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.pnpm_store.outputs.path }}
|
|
key: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
# Manifest-changing and stacked PRs can hold a pnpm-lock.yaml that is
|
|
# stale for the merge tree. Resolve it inline instead of waiting on a
|
|
# policy-job artifact: that dependency put the policy job's queue and
|
|
# runtime (~60s) on every lane's critical path, and policy still
|
|
# validates resolution as a required check in parallel.
|
|
run: |
|
|
if ! pnpm install --frozen-lockfile; then
|
|
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
|
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
fi
|
|
|
|
# Same restore-only contract as the pnpm store above, for the Rust
|
|
# dependency tree: master's post-merge verification is the sole writer
|
|
# of release-runner-v2, and PR merge refs must not save branch-scoped
|
|
# copies of a ~680MB target directory. Every key input below has to
|
|
# match that writer in release-verify.yml exactly or each PR misses and
|
|
# recompiles all 313 third-party crates in both profiles. A miss is a
|
|
# slow run, never a wrong one.
|
|
|
|
# rust-cache hashes its absolute cache paths into the entry's version,
|
|
# and GitHub only serves an entry whose key and version both match. The
|
|
# target directory sits under the checkout, and the checkout root
|
|
# differs by runner: /home/runner/_work on the RunsOn fleets that write
|
|
# this cache against /home/runner/work on GitHub-hosted runners. Every
|
|
# key input agreed, yet all 25 completed pull requests on 2026-09-28
|
|
# logged "No cache found" (run 36424309181) and cold-compiled every
|
|
# crate for ~4 minutes in four lanes. Point rust-cache at the same
|
|
# directory through a checkout-independent path so both layouts hash
|
|
# the same version. Keep this block identical in both workflows: the
|
|
# reader and the writer must agree or the version matches nothing.
|
|
- name: Pin the Runner Rust workspace path
|
|
id: runner_rust_workspace
|
|
run: |
|
|
set -euo pipefail
|
|
pinned="$HOME/paperclip-runner-rust"
|
|
# A symlink here is removed as a link, never followed into the checkout.
|
|
rm -rf "$pinned"
|
|
ln -s "$GITHUB_WORKSPACE/packages/paperclip-runner/runner" "$pinned"
|
|
echo "path=$pinned" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Select the pinned Runner Rust toolchain
|
|
working-directory: packages/paperclip-runner
|
|
run: |
|
|
set -uo pipefail
|
|
|
|
# release-verify.yml runs on a single post-merge fleet image; the
|
|
# gate here can route to ubuntu-latest or the public PR fleet, so
|
|
# this tolerates an image without rustup instead of failing every
|
|
# pull request. Without the pin the cache key simply will not match.
|
|
if ! command -v rustup >/dev/null 2>&1; then
|
|
echo '::notice title=Runner Rust cache::rustup is unavailable; building with the image default toolchain'
|
|
exit 0
|
|
fi
|
|
|
|
rustup show
|
|
toolchain="$(rustup show active-toolchain | awk '{print $1}')"
|
|
echo "RUSTUP_TOOLCHAIN=$toolchain" >> "$GITHUB_ENV"
|
|
|
|
# rust-cache hashes every installed toolchain into the cache key, not
|
|
# only the active one. Each runner image also ships its own stable
|
|
# Rust, and those disagree across images: 1.98.0 on the RunsOn fleets
|
|
# against 1.98.1 on ubuntu-latest. Two runners that agreed on the pin
|
|
# therefore still computed different keys, and every GitHub-hosted
|
|
# pull request missed this cache while the fleet hit it. Remove every
|
|
# toolchain except the pin, so the key depends on the pinned compiler
|
|
# and the lockfile alone rather than on what the image happens to
|
|
# carry. Keep this block identical in both workflows: the reader and
|
|
# the writer must agree or the key matches nothing.
|
|
extra_toolchains="$(rustup toolchain list | awk '{print $1}' | grep -vx "$toolchain" || true)"
|
|
if [ -n "$extra_toolchains" ]; then
|
|
echo "$extra_toolchains" | xargs -n1 rustup toolchain uninstall \
|
|
|| echo '::notice title=Runner Rust cache::could not remove an extra toolchain; the cache key may not match'
|
|
fi
|
|
rustup toolchain list
|
|
|
|
- name: Restore Runner Rust dependencies (read only)
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
workspaces: ${{ steps.runner_rust_workspace.outputs.path }} -> target
|
|
shared-key: release-runner-v2-${{ hashFiles('packages/paperclip-runner/runner/Cargo.toml', '.cargo/config', '.cargo/config.toml', 'packages/.cargo/config', 'packages/.cargo/config.toml', 'packages/paperclip-runner/.cargo/config', 'packages/paperclip-runner/.cargo/config.toml', 'packages/paperclip-runner/runner/.cargo/config', 'packages/paperclip-runner/runner/.cargo/config.toml') }}
|
|
# Mirror the master writer: these also feed the cache key.
|
|
cache-workspace-crates: false
|
|
cache-bin: false
|
|
# Restore only. Never let a pull request evict master's entry.
|
|
save-if: false
|
|
|
|
# The Runner's own crate is the one thing the entry above leaves out:
|
|
# rust-cache drops workspace crates when it saves, and a fresh checkout
|
|
# would invalidate cargo's mtime fingerprints for them anyway. So this
|
|
# job compiled paperclip-runner-core in release mode on every run,
|
|
# 28-49s (runs 38169436532 to 38183149920, 2026-10-11), while 221 of
|
|
# the 239 master commits of the preceding week left its inputs alone.
|
|
# The master Rust lane in release-verify.yml saves that crate's release
|
|
# artifacts (about 70 MB) under a key made from the compiler, the
|
|
# checkout root and a hash of every input the build reads. A pull
|
|
# request whose merge tree carries byte-identical inputs restores them
|
|
# and marks them newer than the checkout, so cargo keeps them; any
|
|
# other pull request misses and compiles exactly as before. Exact key
|
|
# only: a prefix match would hand cargo another revision's output. The
|
|
# path list and the key live in scripts/runner-release-crate-cache.mjs
|
|
# and must match the writer's; a guard test holds them together.
|
|
#
|
|
# Only the lanes that build the release crate restore it: `static checks`
|
|
# runs `check:api-authority` (which builds `paperclip-runnerd` in release
|
|
# mode), the Rust lane's release tests link the lib, and `vitest native
|
|
# server` builds the binary in its beforeAll. The package vitest lanes
|
|
# only use the debug crate cache.
|
|
- name: Compute the Runner release crate cache key
|
|
id: runner_release_crate_key
|
|
if: ${{ matrix.release_crate == true }}
|
|
run: echo "scope=$(node scripts/runner-release-crate-cache.mjs scope)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore the Runner release crate (read only)
|
|
id: runner_release_crate
|
|
if: ${{ matrix.release_crate == true }}
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: |
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-runner-core-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_runner_core-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runner_core-*.d
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runnerd-*
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd.d
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-process-table-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_process_table-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_process_table-*.d
|
|
key: runner-release-crate-v1-${{ steps.runner_release_crate_key.outputs.scope }}-${{ hashFiles('packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'tests/runner-e2e/fixtures/**') }}
|
|
|
|
- name: Mark the restored Runner release crate current
|
|
if: ${{ steps.runner_release_crate.outputs.cache-hit == 'true' }}
|
|
run: node scripts/runner-release-crate-cache.mjs mark-current
|
|
|
|
- name: Compute the Runner debug crate cache key
|
|
id: runner_debug_crate_key
|
|
if: hashFiles('scripts/runner-debug-crate-cache.mjs') != ''
|
|
run: node scripts/runner-debug-crate-cache.mjs plan
|
|
|
|
- name: Restore the Runner debug crate (read only)
|
|
id: runner_debug_crate
|
|
if: hashFiles('scripts/runner-debug-crate-cache.mjs') != ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.runner_debug_crate_key.outputs.paths }}
|
|
key: ${{ steps.runner_debug_crate_key.outputs.key }}
|
|
|
|
- name: Mark the restored Runner debug crate current
|
|
if: ${{ steps.runner_debug_crate.outputs.cache-hit == 'true' }}
|
|
run: node scripts/runner-debug-crate-cache.mjs mark-current
|
|
|
|
- name: Verify Runner Rust through Turbo
|
|
if: matrix.command == 'check:runner' && hashFiles('turbo.json') != ''
|
|
uses: ./.github/actions/run-ci-task
|
|
with:
|
|
task: ci:runner-rust
|
|
args: '[]'
|
|
partition: ${{ strategy.job-index || 0 }}
|
|
force: ${{ needs.gate.outputs.profile_ci == 'true' || needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).mode != 'enabled' || fromJSON(needs.gate.outputs.plan).forceReason != null }}
|
|
|
|
- name: Verify Paperclip Runner
|
|
if: matrix.command != 'check:runner' || hashFiles('turbo.json') == ''
|
|
# pnpm appends trailing args to the end of the script's shell chain,
|
|
# so the vitest lanes' --shard lands on `vitest run`. Do not add a
|
|
# `--` separator: pnpm forwards it literally and vitest would then
|
|
# read the shard flag as a test filter.
|
|
run: pnpm --filter @paperclipai/paperclip-runner ${{ matrix.command }}
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
build:
|
|
name: Build
|
|
needs: [gate]
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.build.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 20
|
|
|
|
env:
|
|
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Build
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') != ''
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
- name: Locate pnpm store
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
id: pnpm_store
|
|
run: |
|
|
echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
echo "arch=$(node -p 'process.arch')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore pnpm store (read only)
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.pnpm_store.outputs.path }}
|
|
key: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
# Manifest-changing and stacked PRs can hold a pnpm-lock.yaml that is
|
|
# stale for the merge tree. Resolve it inline instead of waiting on a
|
|
# policy-job artifact: that dependency put the policy job's queue and
|
|
# runtime (~60s) on every lane's critical path, and policy still
|
|
# validates resolution as a required check in parallel.
|
|
run: |
|
|
if ! pnpm install --frozen-lockfile; then
|
|
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
|
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
fi
|
|
|
|
# pnpm build reaches the Runner package's build:binary step; without the
|
|
# shared Rust cache that is a ~3m40s cold compile of all third-party
|
|
# crates (run 35036001734, 2026-09-15). Same restore-only contract as
|
|
# Verify Paperclip Runner.
|
|
|
|
# rust-cache hashes its absolute cache paths into the entry's version,
|
|
# and GitHub only serves an entry whose key and version both match. The
|
|
# target directory sits under the checkout, and the checkout root
|
|
# differs by runner: /home/runner/_work on the RunsOn fleets that write
|
|
# this cache against /home/runner/work on GitHub-hosted runners. Every
|
|
# key input agreed, yet all 25 completed pull requests on 2026-09-28
|
|
# logged "No cache found" (run 36424309181) and cold-compiled every
|
|
# crate for ~4 minutes in four lanes. Point rust-cache at the same
|
|
# directory through a checkout-independent path so both layouts hash
|
|
# the same version. Keep this block identical in both workflows: the
|
|
# reader and the writer must agree or the version matches nothing.
|
|
- name: Pin the Runner Rust workspace path
|
|
id: runner_rust_workspace
|
|
run: |
|
|
set -euo pipefail
|
|
pinned="$HOME/paperclip-runner-rust"
|
|
# A symlink here is removed as a link, never followed into the checkout.
|
|
rm -rf "$pinned"
|
|
ln -s "$GITHUB_WORKSPACE/packages/paperclip-runner/runner" "$pinned"
|
|
echo "path=$pinned" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Select the pinned Runner Rust toolchain
|
|
working-directory: packages/paperclip-runner
|
|
run: |
|
|
set -uo pipefail
|
|
|
|
# release-verify.yml runs on a single post-merge fleet image; the
|
|
# gate here can route to ubuntu-latest or the public PR fleet, so
|
|
# this tolerates an image without rustup instead of failing every
|
|
# pull request. Without the pin the cache key simply will not match.
|
|
if ! command -v rustup >/dev/null 2>&1; then
|
|
echo '::notice title=Runner Rust cache::rustup is unavailable; building with the image default toolchain'
|
|
exit 0
|
|
fi
|
|
|
|
rustup show
|
|
toolchain="$(rustup show active-toolchain | awk '{print $1}')"
|
|
echo "RUSTUP_TOOLCHAIN=$toolchain" >> "$GITHUB_ENV"
|
|
|
|
# rust-cache hashes every installed toolchain into the cache key, not
|
|
# only the active one. Each runner image also ships its own stable
|
|
# Rust, and those disagree across images: 1.98.0 on the RunsOn fleets
|
|
# against 1.98.1 on ubuntu-latest. Two runners that agreed on the pin
|
|
# therefore still computed different keys, and every GitHub-hosted
|
|
# pull request missed this cache while the fleet hit it. Remove every
|
|
# toolchain except the pin, so the key depends on the pinned compiler
|
|
# and the lockfile alone rather than on what the image happens to
|
|
# carry. Keep this block identical in both workflows: the reader and
|
|
# the writer must agree or the key matches nothing.
|
|
extra_toolchains="$(rustup toolchain list | awk '{print $1}' | grep -vx "$toolchain" || true)"
|
|
if [ -n "$extra_toolchains" ]; then
|
|
echo "$extra_toolchains" | xargs -n1 rustup toolchain uninstall \
|
|
|| echo '::notice title=Runner Rust cache::could not remove an extra toolchain; the cache key may not match'
|
|
fi
|
|
rustup toolchain list
|
|
|
|
- name: Restore Runner Rust dependencies (read only)
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
workspaces: ${{ steps.runner_rust_workspace.outputs.path }} -> target
|
|
shared-key: release-runner-v2-${{ hashFiles('packages/paperclip-runner/runner/Cargo.toml', '.cargo/config', '.cargo/config.toml', 'packages/.cargo/config', 'packages/.cargo/config.toml', 'packages/paperclip-runner/.cargo/config', 'packages/paperclip-runner/.cargo/config.toml', 'packages/paperclip-runner/runner/.cargo/config', 'packages/paperclip-runner/runner/.cargo/config.toml') }}
|
|
# Mirror the master writer: these also feed the cache key.
|
|
cache-workspace-crates: false
|
|
cache-bin: false
|
|
# Restore only. Never let a pull request evict master's entry.
|
|
save-if: false
|
|
|
|
# The Runner's own crate is the one thing the entry above leaves out:
|
|
# rust-cache drops workspace crates when it saves, and a fresh checkout
|
|
# would invalidate cargo's mtime fingerprints for them anyway. So this
|
|
# job compiled paperclip-runner-core in release mode on every run,
|
|
# 28-49s (runs 38169436532 to 38183149920, 2026-10-11), while 221 of
|
|
# the 239 master commits of the preceding week left its inputs alone.
|
|
# The master Rust lane in release-verify.yml saves that crate's release
|
|
# artifacts (about 70 MB) under a key made from the compiler, the
|
|
# checkout root and a hash of every input the build reads. A pull
|
|
# request whose merge tree carries byte-identical inputs restores them
|
|
# and marks them newer than the checkout, so cargo keeps them; any
|
|
# other pull request misses and compiles exactly as before. Exact key
|
|
# only: a prefix match would hand cargo another revision's output. The
|
|
# path list and the key live in scripts/runner-release-crate-cache.mjs
|
|
# and must match the writer's; a guard test holds them together.
|
|
- name: Compute the Runner release crate cache key
|
|
id: runner_release_crate_key
|
|
run: echo "scope=$(node scripts/runner-release-crate-cache.mjs scope)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore the Runner release crate (read only)
|
|
id: runner_release_crate
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: |
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-runner-core-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_runner_core-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runner_core-*.d
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runnerd-*
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd.d
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-process-table-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_process_table-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_process_table-*.d
|
|
key: runner-release-crate-v1-${{ steps.runner_release_crate_key.outputs.scope }}-${{ hashFiles('packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'tests/runner-e2e/fixtures/**') }}
|
|
|
|
- name: Mark the restored Runner release crate current
|
|
if: ${{ steps.runner_release_crate.outputs.cache-hit == 'true' }}
|
|
run: node scripts/runner-release-crate-cache.mjs mark-current
|
|
|
|
- name: Build Runner Evalbook viewer
|
|
run: pnpm --filter @paperclipai/paperclip-runner build:issue-thread
|
|
|
|
# On ordinary PRs, Typecheck + Release Registry checks every server type in
|
|
# parallel, so server build only needs JS emit (`PAPERCLIP_TSC_EMIT_ONLY=1`).
|
|
# Full-CI / release builds emit full declarations and re-check types.
|
|
- name: Build
|
|
env:
|
|
PAPERCLIP_TSC_EMIT_ONLY: ${{ !(contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
|
run: pnpm build
|
|
|
|
# Always verify the production runtime bundle builds cleanly (~4s).
|
|
# Full embedded-Postgres boot smoke (~53s) runs on full-ci / release
|
|
# verification; ordinary PRs already boot the server in e2e_shards.
|
|
- name: Build production runtime bundle
|
|
run: |
|
|
pnpm --filter @paperclipai/server build:runtime
|
|
if [ "${PAPERCLIP_CI_FULL:-}" = "1" ]; then
|
|
scripts/server-boot-smoke.sh node server/dist-runtime/index.mjs
|
|
fi
|
|
|
|
# Clean public npm install verification (`verify-grok-npm-install.mjs`,
|
|
# ~231s) is covered by release-smoke.yml and docker-runner-check.yml
|
|
# rather than running on every pull request Build job.
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
verify_serialized_server:
|
|
name: Verify serialized server suites (${{ matrix.shard_label }})
|
|
needs: [gate, test_selection]
|
|
if: ${{ always() && !cancelled() && needs.gate.result == 'success' && needs.gate.outputs.full_ci == 'true' && ((needs.test_selection.outputs.plan || needs.gate.outputs.plan) == '' || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.verify_serialized_server.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
|
matrix: ${{ fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan) != '' && toJSON((needs.gate.outputs.runner == 'ubuntu-latest' && fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.verify_serialized_server.hosted_matrix) || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.verify_serialized_server.matrix) || (needs.gate.outputs.runner == 'ubuntu-latest' && '{"include":[{"shard_index":0,"shard_count":4,"shard_label":"1/4","task":"ci:serialized"},{"shard_index":1,"shard_count":4,"shard_label":"2/4","task":"ci:serialized"},{"shard_index":2,"shard_count":4,"shard_label":"3/4","task":"ci:serialized"},{"shard_index":3,"shard_count":4,"shard_label":"4/4","task":"ci:serialized"}]}' || '{"include":[{"shard_index":0,"shard_count":9,"shard_label":"1/9","task":"ci:serialized"},{"shard_index":1,"shard_count":9,"shard_label":"2/9","task":"ci:serialized"},{"shard_index":2,"shard_count":9,"shard_label":"3/9","task":"ci:serialized"},{"shard_index":3,"shard_count":9,"shard_label":"4/9","task":"ci:serialized"},{"shard_index":4,"shard_count":9,"shard_label":"5/9","task":"ci:serialized"},{"shard_index":5,"shard_count":9,"shard_label":"6/9","task":"ci:serialized"},{"shard_index":6,"shard_count":9,"shard_label":"7/9","task":"ci:serialized"},{"shard_index":7,"shard_count":9,"shard_label":"8/9","task":"ci:serialized"},{"shard_index":8,"shard_count":9,"shard_label":"9/9","task":"ci:serialized"}]}')) }}
|
|
|
|
env:
|
|
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
|
PAPERCLIP_CI_TEST_SELECTION: ${{ matrix.selection && '.ci-test-selection/manifest.json' || '' }}
|
|
PAPERCLIP_CI_SELECTION_HASH: ${{ matrix.selection && fromJSON(needs.test_selection.outputs.plan).testSelection.hash || '' }}
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Verify serialized server suites (${{ matrix.shard_label }})
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Download selected test files
|
|
if: matrix.selection
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
|
with:
|
|
artifact-ids: ${{ fromJSON(needs.test_selection.outputs.plan).testSelection.artifactId }}
|
|
path: .ci-test-selection
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') != ''
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
- name: Locate pnpm store
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
id: pnpm_store
|
|
run: |
|
|
echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
echo "arch=$(node -p 'process.arch')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore pnpm store (read only)
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.pnpm_store.outputs.path }}
|
|
key: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
# Manifest-changing and stacked PRs can hold a pnpm-lock.yaml that is
|
|
# stale for the merge tree. Resolve it inline instead of waiting on a
|
|
# policy-job artifact: that dependency put the policy job's queue and
|
|
# runtime (~60s) on every lane's critical path, and policy still
|
|
# validates resolution as a required check in parallel.
|
|
run: |
|
|
if ! pnpm install --frozen-lockfile; then
|
|
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
|
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
fi
|
|
|
|
- name: Run serialized server test shard through Turbo
|
|
if: hashFiles('turbo.json', '.github/actions/run-ci-task/action.yml') != ''
|
|
uses: ./.github/actions/run-ci-task
|
|
with:
|
|
task: ci:serialized
|
|
args: ${{ format('["--shard-index","{0}","--shard-count","{1}"]', matrix.shard_index, matrix.shard_count) }}
|
|
partition: ${{ strategy.job-index || 0 }}
|
|
force: ${{ needs.gate.outputs.profile_ci == 'true' || (needs.test_selection.outputs.plan || needs.gate.outputs.plan) == '' || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).mode != 'enabled' || fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).forceReason != null }}
|
|
|
|
- name: Run serialized server test shard
|
|
if: hashFiles('turbo.json') == ''
|
|
run: pnpm test:run:serialized -- --shard-index ${{ matrix.shard_index }} --shard-count ${{ matrix.shard_count }}
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
canary_dry_run:
|
|
name: Canary Dry Run
|
|
needs: [gate]
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.canary_dry_run.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 20
|
|
|
|
env:
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: Canary Dry Run
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') != ''
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
- name: Locate pnpm store
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
id: pnpm_store
|
|
run: |
|
|
echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
echo "arch=$(node -p 'process.arch')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore pnpm store (read only)
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.pnpm_store.outputs.path }}
|
|
key: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
# Manifest-changing and stacked PRs can hold a pnpm-lock.yaml that is
|
|
# stale for the merge tree. Resolve it inline instead of waiting on a
|
|
# policy-job artifact: that dependency put the policy job's queue and
|
|
# runtime (~60s) on every lane's critical path, and policy still
|
|
# validates resolution as a required check in parallel.
|
|
run: |
|
|
if ! pnpm install --frozen-lockfile; then
|
|
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
|
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
fi
|
|
|
|
# release.sh's Step 2/7 workspace build reaches the Runner package's
|
|
# build:binary step; without the shared Rust cache that is a ~3m40s cold
|
|
# compile of all third-party crates (run 35036001734, 2026-09-15). Same
|
|
# restore-only contract as Verify Paperclip Runner.
|
|
|
|
# rust-cache hashes its absolute cache paths into the entry's version,
|
|
# and GitHub only serves an entry whose key and version both match. The
|
|
# target directory sits under the checkout, and the checkout root
|
|
# differs by runner: /home/runner/_work on the RunsOn fleets that write
|
|
# this cache against /home/runner/work on GitHub-hosted runners. Every
|
|
# key input agreed, yet all 25 completed pull requests on 2026-09-28
|
|
# logged "No cache found" (run 36424309181) and cold-compiled every
|
|
# crate for ~4 minutes in four lanes. Point rust-cache at the same
|
|
# directory through a checkout-independent path so both layouts hash
|
|
# the same version. Keep this block identical in both workflows: the
|
|
# reader and the writer must agree or the version matches nothing.
|
|
- name: Pin the Runner Rust workspace path
|
|
id: runner_rust_workspace
|
|
run: |
|
|
set -euo pipefail
|
|
pinned="$HOME/paperclip-runner-rust"
|
|
# A symlink here is removed as a link, never followed into the checkout.
|
|
rm -rf "$pinned"
|
|
ln -s "$GITHUB_WORKSPACE/packages/paperclip-runner/runner" "$pinned"
|
|
echo "path=$pinned" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Select the pinned Runner Rust toolchain
|
|
working-directory: packages/paperclip-runner
|
|
run: |
|
|
set -uo pipefail
|
|
|
|
# release-verify.yml runs on a single post-merge fleet image; the
|
|
# gate here can route to ubuntu-latest or the public PR fleet, so
|
|
# this tolerates an image without rustup instead of failing every
|
|
# pull request. Without the pin the cache key simply will not match.
|
|
if ! command -v rustup >/dev/null 2>&1; then
|
|
echo '::notice title=Runner Rust cache::rustup is unavailable; building with the image default toolchain'
|
|
exit 0
|
|
fi
|
|
|
|
rustup show
|
|
toolchain="$(rustup show active-toolchain | awk '{print $1}')"
|
|
echo "RUSTUP_TOOLCHAIN=$toolchain" >> "$GITHUB_ENV"
|
|
|
|
# rust-cache hashes every installed toolchain into the cache key, not
|
|
# only the active one. Each runner image also ships its own stable
|
|
# Rust, and those disagree across images: 1.98.0 on the RunsOn fleets
|
|
# against 1.98.1 on ubuntu-latest. Two runners that agreed on the pin
|
|
# therefore still computed different keys, and every GitHub-hosted
|
|
# pull request missed this cache while the fleet hit it. Remove every
|
|
# toolchain except the pin, so the key depends on the pinned compiler
|
|
# and the lockfile alone rather than on what the image happens to
|
|
# carry. Keep this block identical in both workflows: the reader and
|
|
# the writer must agree or the key matches nothing.
|
|
extra_toolchains="$(rustup toolchain list | awk '{print $1}' | grep -vx "$toolchain" || true)"
|
|
if [ -n "$extra_toolchains" ]; then
|
|
echo "$extra_toolchains" | xargs -n1 rustup toolchain uninstall \
|
|
|| echo '::notice title=Runner Rust cache::could not remove an extra toolchain; the cache key may not match'
|
|
fi
|
|
rustup toolchain list
|
|
|
|
- name: Restore Runner Rust dependencies (read only)
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
workspaces: ${{ steps.runner_rust_workspace.outputs.path }} -> target
|
|
shared-key: release-runner-v2-${{ hashFiles('packages/paperclip-runner/runner/Cargo.toml', '.cargo/config', '.cargo/config.toml', 'packages/.cargo/config', 'packages/.cargo/config.toml', 'packages/paperclip-runner/.cargo/config', 'packages/paperclip-runner/.cargo/config.toml', 'packages/paperclip-runner/runner/.cargo/config', 'packages/paperclip-runner/runner/.cargo/config.toml') }}
|
|
# Mirror the master writer: these also feed the cache key.
|
|
cache-workspace-crates: false
|
|
cache-bin: false
|
|
# Restore only. Never let a pull request evict master's entry.
|
|
save-if: false
|
|
|
|
# The Runner's own crate is the one thing the entry above leaves out:
|
|
# rust-cache drops workspace crates when it saves, and a fresh checkout
|
|
# would invalidate cargo's mtime fingerprints for them anyway. So this
|
|
# job compiled paperclip-runner-core in release mode on every run,
|
|
# 28-49s (runs 38169436532 to 38183149920, 2026-10-11), while 221 of
|
|
# the 239 master commits of the preceding week left its inputs alone.
|
|
# The master Rust lane in release-verify.yml saves that crate's release
|
|
# artifacts (about 70 MB) under a key made from the compiler, the
|
|
# checkout root and a hash of every input the build reads. A pull
|
|
# request whose merge tree carries byte-identical inputs restores them
|
|
# and marks them newer than the checkout, so cargo keeps them; any
|
|
# other pull request misses and compiles exactly as before. Exact key
|
|
# only: a prefix match would hand cargo another revision's output. The
|
|
# path list and the key live in scripts/runner-release-crate-cache.mjs
|
|
# and must match the writer's; a guard test holds them together.
|
|
- name: Compute the Runner release crate cache key
|
|
id: runner_release_crate_key
|
|
run: echo "scope=$(node scripts/runner-release-crate-cache.mjs scope)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore the Runner release crate (read only)
|
|
id: runner_release_crate
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: |
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-runner-core-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_runner_core-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runner_core-*.d
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_runnerd-*
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd
|
|
packages/paperclip-runner/runner/target/release/paperclip-runnerd.d
|
|
packages/paperclip-runner/runner/target/release/.fingerprint/paperclip-process-table-*
|
|
packages/paperclip-runner/runner/target/release/deps/libpaperclip_process_table-*
|
|
packages/paperclip-runner/runner/target/release/deps/paperclip_process_table-*.d
|
|
key: runner-release-crate-v1-${{ steps.runner_release_crate_key.outputs.scope }}-${{ hashFiles('packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'tests/runner-e2e/fixtures/**') }}
|
|
|
|
- name: Mark the restored Runner release crate current
|
|
if: ${{ steps.runner_release_crate.outputs.cache-hit == 'true' }}
|
|
run: node scripts/runner-release-crate-cache.mjs mark-current
|
|
|
|
# `release.sh` always executes its Step 2/7 workspace build, even when
|
|
# `--skip-verify` bypasses the initial verification gate. release.sh
|
|
# also requires a clean working tree, and the install step may have
|
|
# resolved a stale lockfile in place (manifest-changing or stacked
|
|
# PRs), so stage any changed lockfile into an ephemeral local commit:
|
|
# release.sh then sees a clean tree and its workspace build sees a
|
|
# lockfile that matches the manifests.
|
|
- name: Release canary dry run via release.sh internal build
|
|
run: |
|
|
git checkout -B master HEAD
|
|
if git diff --quiet pnpm-lock.yaml; then
|
|
git checkout -- pnpm-lock.yaml
|
|
else
|
|
git add pnpm-lock.yaml
|
|
git -c user.email=ci@paperclip.local -c user.name=CI \
|
|
commit --no-verify -m "ci(canary): stage regenerated lockfile"
|
|
fi
|
|
./scripts/release.sh canary --skip-verify --dry-run
|
|
|
|
# The clean public npm install verification for the built-in Grok
|
|
# provider used to run here, after the dry run. It only needs `pnpm
|
|
# build` output, which the Build lane also produces, so it moved there:
|
|
# see "Verify built-in Grok from a clean public npm install" in `build`.
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
e2e_shards:
|
|
name: e2e shard (${{ matrix.shard_label }})
|
|
needs: [gate]
|
|
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.run) }}
|
|
runs-on: ${{ needs.gate.outputs.runner }}
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
|
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON((needs.gate.outputs.runner == 'ubuntu-latest' && fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.hosted_matrix) || fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.matrix) || (needs.gate.outputs.runner == 'ubuntu-latest' && '{"include":[{"shard_index":0,"shard_count":4,"shard_label":"1/4","task":"ci:e2e"},{"shard_index":1,"shard_count":4,"shard_label":"2/4","task":"ci:e2e"},{"shard_index":2,"shard_count":4,"shard_label":"3/4","task":"ci:e2e"},{"shard_index":3,"shard_count":4,"shard_label":"4/4","task":"ci:e2e"}]}' || '{"include":[{"shard_index":0,"shard_count":16,"shard_label":"1/16","task":"ci:e2e"},{"shard_index":1,"shard_count":16,"shard_label":"2/16","task":"ci:e2e"},{"shard_index":2,"shard_count":16,"shard_label":"3/16","task":"ci:e2e"},{"shard_index":3,"shard_count":16,"shard_label":"4/16","task":"ci:e2e"},{"shard_index":4,"shard_count":16,"shard_label":"5/16","task":"ci:e2e"},{"shard_index":5,"shard_count":16,"shard_label":"6/16","task":"ci:e2e"},{"shard_index":6,"shard_count":16,"shard_label":"7/16","task":"ci:e2e"},{"shard_index":7,"shard_count":16,"shard_label":"8/16","task":"ci:e2e"},{"shard_index":8,"shard_count":16,"shard_label":"9/16","task":"ci:e2e"},{"shard_index":9,"shard_count":16,"shard_label":"10/16","task":"ci:e2e"},{"shard_index":10,"shard_count":16,"shard_label":"11/16","task":"ci:e2e"},{"shard_index":11,"shard_count":16,"shard_label":"12/16","task":"ci:e2e"},{"shard_index":12,"shard_count":16,"shard_label":"13/16","task":"ci:e2e"},{"shard_index":13,"shard_count":16,"shard_label":"14/16","task":"ci:e2e"},{"shard_index":14,"shard_count":16,"shard_label":"15/16","task":"ci:e2e"},{"shard_index":15,"shard_count":16,"shard_label":"16/16","task":"ci:e2e"}]}')) }}
|
|
|
|
env:
|
|
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
|
PAPERCLIP_CI_PROFILE_JOB: e2e shard (${{ matrix.shard_label }})
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Initialize CI profile
|
|
continue-on-error: true
|
|
if: env.PAPERCLIP_CI_PROFILE == 'true'
|
|
run: node scripts/ci-profile/initialize.mjs
|
|
|
|
- name: Setup Node.js for pnpm bootstrap
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
|
|
- name: Check preinstalled pnpm
|
|
id: pnpm_preinstalled
|
|
run: |
|
|
expected="$(node -e 'const m = /^pnpm@([^+\s]+)(?:\+.*)?$/.exec(JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).packageManager || ""); process.stdout.write(m ? m[1] : "");')"
|
|
if [ -x "$HOME/setup-pnpm/node_modules/.bin/pnpm" ] && [ -n "$expected" ] && [ "$("$HOME/setup-pnpm/node_modules/.bin/pnpm" --version 2>/dev/null || true)" = "$expected" ]; then
|
|
echo "PNPM_HOME=$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_ENV"
|
|
echo "$HOME/setup-pnpm/node_modules/.bin" >> "$GITHUB_PATH"
|
|
echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Setup pnpm
|
|
if: steps.pnpm_preinstalled.outputs.hit != 'true'
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
env:
|
|
NPM_CONFIG_AUDIT: "false"
|
|
NPM_CONFIG_FUND: "false"
|
|
NPM_CONFIG_UPDATE_NOTIFIER: "false"
|
|
with:
|
|
version: 9.15.4
|
|
|
|
# Share the checked-in lockfile key with master. PR merge refs must not
|
|
# save full copies of the store or evict the post-merge build caches.
|
|
- name: Restore materialized dependencies and shared builds
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') != ''
|
|
uses: ./.github/actions/setup-ci-dependencies
|
|
|
|
- name: Locate pnpm store
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
id: pnpm_store
|
|
run: |
|
|
echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
echo "arch=$(node -p 'process.arch')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore pnpm store (read only)
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ${{ steps.pnpm_store.outputs.path }}
|
|
key: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: node-cache-${{ runner.os }}-${{ steps.pnpm_store.outputs.arch }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
if: hashFiles('.github/actions/setup-ci-dependencies/action.yml') == ''
|
|
# Manifest-changing and stacked PRs can hold a pnpm-lock.yaml that is
|
|
# stale for the merge tree. Resolve it inline instead of waiting on a
|
|
# policy-job artifact: that dependency put the policy job's queue and
|
|
# runtime (~60s) on every lane's critical path, and policy still
|
|
# validates resolution as a required check in parallel.
|
|
run: |
|
|
if ! pnpm install --frozen-lockfile; then
|
|
echo '::notice title=Lockfile::checked-in lockfile is stale for this merge tree; resolving it inline'
|
|
pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
fi
|
|
|
|
- name: Verify runner Chrome
|
|
# GitHub's Ubuntu runner image already ships Google Chrome, so use that
|
|
# directly for the headless e2e lane instead of downloading Playwright
|
|
# browser bundles inside the 30 minute job budget.
|
|
run: google-chrome --version
|
|
|
|
- name: Generate Paperclip config
|
|
run: |
|
|
mkdir -p ~/.paperclip/instances/default
|
|
cat > ~/.paperclip/instances/default/config.json << 'CONF'
|
|
{
|
|
"$meta": { "version": 1, "updatedAt": "2026-01-01T00:00:00.000Z", "source": "onboard" },
|
|
"database": { "mode": "embedded-postgres" },
|
|
"logging": { "mode": "file" },
|
|
"server": { "deploymentMode": "local_trusted", "host": "127.0.0.1", "port": 3100 },
|
|
"auth": { "baseUrlMode": "auto" },
|
|
"storage": { "provider": "local_disk" },
|
|
"secrets": { "provider": "local_encrypted", "strictMode": false }
|
|
}
|
|
CONF
|
|
|
|
# Reuse master's exact UI build on non-UI PRs so all 8 E2E shards skip
|
|
# rebuilding Vite (~35s each). Exact key only (no restore-keys): a UI
|
|
# change misses and Playwright builds server/ui-dist inline.
|
|
- name: Restore prebuilt UI assets (read only)
|
|
id: e2e_ui_dist
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: server/ui-dist
|
|
key: e2e-ui-dist-v2-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig*.json', 'ui/package.json', 'ui/index.html', 'ui/vite.config.*', 'ui/tsconfig*.json', 'ui/src/**', 'ui/public/**', 'packages/shared/package.json', 'packages/shared/src/**', 'packages/adapter-utils/package.json', 'packages/adapter-utils/src/**', 'packages/adapters/*/package.json', 'packages/adapters/*/src/**', 'packages/plugins/sdk/package.json', 'packages/plugins/sdk/src/**', 'announcements/examples/animated/**') }}
|
|
|
|
- name: Run e2e tests
|
|
env:
|
|
CI_PLAN: ${{ needs.gate.outputs.plan }}
|
|
PAPERCLIP_E2E_SKIP_LLM: "true"
|
|
PAPERCLIP_PLAYWRIGHT_CHANNEL: "chrome"
|
|
PAPERCLIP_E2E_SKIP_UI_BUILD: ${{ steps.e2e_ui_dist.outputs.cache-hit == 'true' && '1' || '' }}
|
|
run: |
|
|
# Playwright's own --shard balances by test count, and one spec
|
|
# (smoke-lab) is ~40% of the lane's wall clock. Partition by recorded
|
|
# spec duration instead so both runners finish together.
|
|
specs="$(node ./scripts/e2e-shard.mjs \
|
|
--shard-index ${{ matrix.shard_index }} --shard-count ${{ matrix.shard_count }})"
|
|
echo "shard ${{ matrix.shard_label }} specs: $specs"
|
|
# specs is an intentional argument list.
|
|
# shellcheck disable=SC2086
|
|
pnpm run test:e2e $specs
|
|
|
|
- name: Upload Playwright report
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
if: always()
|
|
with:
|
|
name: playwright-report-${{ matrix.shard_index }}
|
|
path: |
|
|
tests/e2e/playwright-report/
|
|
tests/e2e/test-results/
|
|
retention-days: 14
|
|
|
|
- name: Upload CI profile timings
|
|
continue-on-error: true
|
|
if: always() && env.PAPERCLIP_CI_PROFILE == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ci-profile-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
path: .ci-profile/*.ndjson
|
|
include-hidden-files: true
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
e2e:
|
|
name: e2e
|
|
if: ${{ always() }}
|
|
needs: [gate, policy, e2e_shards]
|
|
runs-on: ubuntu-slim
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Validate every planned suite result
|
|
env:
|
|
FULL_CI: ${{ needs.gate.outputs.full_ci }}
|
|
CI_PLAN: ${{ needs.gate.outputs.plan }}
|
|
CI_RESULTS: ${{ toJSON(needs) }}
|
|
run: |
|
|
node --input-type=module <<'NODE'
|
|
import assert from 'node:assert/strict';
|
|
const results = JSON.parse(process.env.CI_RESULTS);
|
|
assert.equal(results.gate.result, 'success', 'CI routing must succeed');
|
|
assert.equal(results.policy.result, 'success', 'Policy must succeed');
|
|
assert.ok(['true', 'false'].includes(process.env.FULL_CI), 'Valid scope required');
|
|
const plan = process.env.CI_PLAN ? JSON.parse(process.env.CI_PLAN) : null;
|
|
if (plan) assert.equal(plan.version, 1, 'Supported task plan required');
|
|
for (const job of ["e2e_shards"]) {
|
|
if (plan) assert.equal(typeof plan.jobs[job]?.run, 'boolean', 'Missing suite decision: ' + job);
|
|
const selected = process.env.FULL_CI === 'true' && (!plan || plan.jobs[job].run);
|
|
assert.equal(results[job].result, selected ? 'success' : 'skipped', job);
|
|
}
|
|
NODE
|