mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-09 07:10:34 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Required CI checks protect changes to its native Runner and control plane. > - Recent Runner jobs restored a Rust cache but still rebuilt dependencies for 74–92 seconds. > - New workspace install hooks disabled the materialized JavaScript dependency cache. > - A single transport file also kept 326 test cases on one worker. > - This pull request corrects the cache inputs, replays known install hooks, and separates independent transport test groups. > - The same checks can finish sooner without removing test cases or widening runner access. ## Linked Issues or Issue Description Refs #18794 and #18544. Related dependency-action version update: #17698; this change fixes the cache input contract used by the currently pinned action. **What happened?** Recent PR jobs such as #18783 and #18825 restored an exact Rust dependency cache from October 16. The virtual workspace's development profile changed on October 30. Rust Cache 2.9.2 hashes member manifests but omits that virtual manifest. Rebuilding cannot replace an immutable exact cache entry. The JavaScript cache also rejected the new server and Runner Copilot postinstall hooks. **Expected behavior** Changing a Cargo profile selects a new dependency cache. An exact JavaScript dependency restore still performs required workspace install hooks. Independent transport fixtures use the existing file workers while retaining all assertions and real deadlines. **Steps to reproduce** Inspect the Rust dependency cache hit and following `build:rust` in the recent Runner package jobs. Run `node scripts/ci-dependency-cache.mjs` on the previous revision to see `cacheable: false`. Run the original transport file to measure the serial test work. ## What Changed - Add the virtual workspace manifest and ancestor Cargo configuration to all shared Rust dependency keys. Keep reader/writer identities aligned and preserve master-only cache writes and CODEOWNERS-only AWS routing. - Recognize only the exact reviewed root, server, and Runner postinstall commands. Include the server/Runner installer scripts in the dependency key. Replay workspace postinstall hooks after a materialized restore. Unknown lifecycle hooks still disable reuse. - Move attachment recovery, warm attachment, live adoption, and suspension fixtures into separate files. Keep the large event-backlog cases in the original file to avoid starting another expensive fixture group at the same time. Share five stateless test helpers outside production source. - Extend the opt-in `profile-ci` benchmark with a PR-scoped Rust cache producer and a fresh-host consumer. Require exact dependency/workspace hits and reject any Cargo unit that is rebuilt. Retain the JSON build evidence. Existing setup qualification checks real JavaScript cache restores. - Schedule the ten measured files over 50 seconds first, in approximate duration order. Package CI uses up to four workers, bounded by available CPUs; local runs retain Vitest defaults. The AWS runner has four CPUs and 16 GiB RAM; the three-worker run averaged 44% CPU and peaked at 15% memory. Preserve Vitest selection and shard membership and default ordering for other files. Job count and AWS authorization are unchanged. - Scope the optional paired server benchmark to changes in its measured inputs. Cache-only changes qualify exact restores and run the shared package tests using restored dependencies. - Update the cache and test documentation and the existing native cache contract guard. ## Verification - All 586 `.github/scripts/tests/*.test.mjs` policy tests passed, including cache trust and runner routing guards. Actionlint passed for all three changed workflows. - All 169 original top-level transport test definitions remain byte-identical. The original file passed all 326 cases in 317.99 seconds on this macOS host. A clean preliminary split passed the exact same named cases in 183.01 seconds with the same four-worker cap. - Preserve the first failed experiment: its parallel run overlapped the policy suite and timed out in the 1,024-event settled backlog case at 60 seconds; 325 cases passed. A clean repeat passed, but that does not establish the earlier failure's sole cause. The final layout keeps the backlog cases in the original file. The final layout passed the same 326 cases in 186.35 seconds (41.4% faster than the 317.99-second baseline). The original test bodies and all timeouts remain unchanged. - Fresh-host Rust qualification passed: all 308 compilation units were fresh, and Cargo completed in 1.59 seconds on a new runner ([final-head run](https://github.com/paperclipai/paperclip/actions/runs/41745082837/job/126296908816)). JavaScript setup dropped from 46 seconds cold to 23 seconds with exact dependency/build restores; all 1,052 shared-package cases passed against the restored tree ([final-head job](https://github.com/paperclipai/paperclip/actions/runs/41745082837/job/126295937797)). The previous qualification also passed (43 to 19 seconds) and confirmed all three postinstall hooks replayed. These are qualification results, not an end-to-end PR timing claim. - Initial full AWS package run passed 4,907 cases with 10 existing skips. The original-file remainder fell to 118.7 seconds, but the 100-second deadline file started last, leaving the full package at 417.43 seconds. Starting only three long files first passed 4,911 cases (including four new sequencer guards) in 422.54 seconds, so reordering alone did not improve full-package time. Summed file execution was 1,202 seconds across three busy workers. The final four-worker configuration passed **4,912 cases, with the same 10 existing skips**, in **324.99 seconds**, a **23.1% reduction** from 422.54 seconds. The five added cases guard ordering, selection, sharding, and path handling. Peak memory was 17.95% of the 16 GiB runner; average CPU was 49.14% ([final-head package job](https://github.com/paperclipai/paperclip/actions/runs/41745082974/job/126296339480)). - Local workspace typecheck and build passed. The complete local `pnpm test:run` passed all six chat partitions but reported failures in one existing OAuth redirect case and one gateway authority case in the general-server group. Both focused repetitions passed (three OAuth cases and one gateway case), and a complete repeat of both files passed all 593 cases in 42.89 seconds; that does not explain the original failures. The broad local run was stopped after 61 minutes once full final-head CI had passed; its remaining general/workspace/serialized work was not completed locally, and it is not reported as a pass. Original failure logs were retained. Full final-head CI provides the complete suite validation. Sequencer selection/shard guards and the 11-case transport suspension smoke passed. The corrected release workflow guard passed all 71 tests. - The first CI run failed only the policy guard that still expected the old native cache key; downstream aggregate checks also failed. That guard now checks the new profile/config prefix and existing host/target/protocol suffix. A second policy run found that the new sequencer test imported Vitest in the dependency-free policy lane; it now runs in the Runner package lane, where all four cases pass. Greptile reviewed final head `8011f84189` at 5/5 with no actionable findings and confirmed this issue fixed. Final-head policy, typecheck, build, and review passed. At 23:52:46 UTC on November 3, several AWS jobs were terminated together: the Runner package process received SIGTERM and browser logs recorded a runner shutdown signal. The failed/cancelled jobs passed on the same-head retry, including required `ci / verify`; no assertion or timeout was changed in response. The final concurrency adjustment at `fe5a69bb0b` also received Greptile 5/5 with no actionable findings. Final-head required CI, including `ci / verify`, passed ([aggregate](https://github.com/paperclipai/paperclip/actions/runs/41745082974/job/126300554711)). Local timings exclude install, build, cache transfer, and CI queue time. ## Risks A new Rust key needs one successful canonical master build before ordinary PRs can hit it. The fresh-host qualification uses separate PR-scoped entries. Parallel test files can increase I/O contention; case execution inside each file, timeouts, and assertions are unchanged. Two extracted suites exceed 1,000 lines because they retain existing multi-stage recovery fixtures unchanged; one parameterized fixture alone is 1,059 lines. No production execution logic, lockfile, credentials, runner trust gates, or required check is removed. ## Model Used OpenAI GPT-6 through Codex, with reasoning, repository editing, command execution, and GitHub inspection. The host does not expose a more precise model snapshot or 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 — targeted checks passed; the broad-run failures and repetitions are documented above - [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>
530 lines
24 KiB
Markdown
530 lines
24 KiB
Markdown
# Release Automation Setup
|
|
|
|
This document covers the GitHub and npm setup required for the current Paperclip release model:
|
|
|
|
- automatic canaries from `master`
|
|
- manual stable promotion from a chosen source ref
|
|
- npm trusted publishing via GitHub OIDC
|
|
- protected release infrastructure in a public repository
|
|
|
|
Repo-side files that depend on this setup:
|
|
|
|
- `.github/workflows/release.yml`
|
|
- `.github/CODEOWNERS`
|
|
|
|
Note:
|
|
|
|
- the release workflows intentionally use `pnpm install --no-frozen-lockfile`
|
|
- this matches the repo's current policy where `pnpm-lock.yaml` is refreshed by GitHub automation after manifest changes land on `master`
|
|
- the publish jobs then restore `pnpm-lock.yaml` before running `scripts/release.sh`, so the release script still sees a clean worktree
|
|
|
|
## 1. Merge the Repo Changes First
|
|
|
|
Before touching GitHub or npm settings, merge the release automation code so the referenced workflow filenames already exist on the default branch.
|
|
|
|
Required files:
|
|
|
|
- `.github/workflows/release.yml`
|
|
- `.github/CODEOWNERS`
|
|
|
|
## 2. Configure npm Trusted Publishing
|
|
|
|
Do this for every public package that Paperclip publishes.
|
|
|
|
At minimum that includes:
|
|
|
|
- `paperclipai`
|
|
- `@paperclipai/server`
|
|
- `@paperclipai/ui`
|
|
- public packages under `packages/`
|
|
|
|
### 2.1. In npm, open each package settings page
|
|
|
|
For each package:
|
|
|
|
1. open npm as an owner of the package
|
|
2. go to the package settings / publishing access area
|
|
3. add a trusted publisher for the GitHub repository `paperclipai/paperclip`
|
|
|
|
### 2.2. Add one trusted publisher entry per package
|
|
|
|
npm currently allows one trusted publisher configuration per package.
|
|
|
|
Configure:
|
|
|
|
- workflow: `.github/workflows/release.yml`
|
|
|
|
Repository:
|
|
|
|
- `paperclipai/paperclip`
|
|
|
|
Environment name:
|
|
|
|
- leave the npm trusted-publisher environment field blank
|
|
|
|
Why:
|
|
|
|
- the single `release.yml` workflow handles both canary and stable publishing
|
|
- GitHub environments `npm-canary` and `npm-stable` still enforce different approval rules on the GitHub side
|
|
|
|
### 2.2.1. Newly added public packages need a bootstrap phase
|
|
|
|
Trusted publishing is configured on the npm package itself, not at the repo scope.
|
|
That means a brand-new public package must not be auto-enrolled into CI publishing until its npm package exists and its trusted publisher has been configured.
|
|
|
|
Repo policy:
|
|
|
|
1. add every non-private package to [`scripts/release-package-manifest.json`](../scripts/release-package-manifest.json)
|
|
2. set `"publishFromCi": true` only when CI is expected to publish that package
|
|
3. if the package is not ready for CI publishing yet, keep `"publishFromCi": false`
|
|
4. complete the package bootstrap before merging any PR that changes a release-enabled new package
|
|
|
|
Bootstrap sequence for a new package:
|
|
|
|
1. publish the package once from a trusted maintainer machine using normal npm auth
|
|
2. open that package on npm and add the `paperclipai/paperclip` trusted publisher for `.github/workflows/release.yml`
|
|
3. rerun or dry-run the release flow as needed to confirm CI publishing now works
|
|
4. only then enable `"publishFromCi": true`
|
|
|
|
PR CI enforces this by checking changed release-enabled package manifests against npm. That keeps `master` canary publishing healthy while preserving the no-long-lived-token model for normal CI releases.
|
|
|
|
### 2.3. Verify trusted publishing before removing old auth
|
|
|
|
After the workflows are live:
|
|
|
|
1. run a canary publish
|
|
2. confirm npm publish succeeds without any `NPM_TOKEN`
|
|
3. run a stable dry-run
|
|
4. run one real stable publish
|
|
|
|
Only after that should you remove old token-based access.
|
|
|
|
## 3. Remove Legacy npm Tokens
|
|
|
|
After trusted publishing works:
|
|
|
|
1. revoke any repository or organization `NPM_TOKEN` secrets used for publish
|
|
2. revoke any personal automation token that used to publish Paperclip
|
|
3. if npm offers a package-level setting to restrict publishing to trusted publishers, enable it
|
|
|
|
Goal:
|
|
|
|
- no long-lived npm publishing token should remain in GitHub Actions
|
|
|
|
## 4. Create GitHub Environments
|
|
|
|
Create three environments in the GitHub repository:
|
|
|
|
- `npm-canary`
|
|
- `npm-beta`
|
|
- `npm-stable`
|
|
|
|
Path:
|
|
|
|
1. GitHub repository
|
|
2. `Settings`
|
|
3. `Environments`
|
|
4. `New environment`
|
|
|
|
## 5. Configure `npm-canary`
|
|
|
|
Recommended settings for `npm-canary`:
|
|
|
|
- environment name: `npm-canary`
|
|
- required reviewers: none
|
|
- wait timer: none
|
|
- deployment branches and tags:
|
|
- selected branches only
|
|
- allow `master`
|
|
|
|
Reasoning:
|
|
|
|
- every push to `master` should be able to publish a canary automatically
|
|
- no human approval should be required for canaries
|
|
|
|
The scheduled nightly lane also publishes under `npm-canary`: it is the same
|
|
trust level (fully automated, no human gate), its runs execute on `master` so
|
|
the branch rule is satisfied, and reusing the environment means the nightly
|
|
lane required no new environments and no npm trusted-publisher changes
|
|
(publishing still happens from `release.yml`, see section 2.2).
|
|
|
|
## 5.1. Configure `npm-beta`
|
|
|
|
Recommended settings for `npm-beta`:
|
|
|
|
- environment name: `npm-beta`
|
|
- required reviewers: at least one maintainer
|
|
- prevent self-review: enabled when your team size allows it
|
|
- wait timer: none
|
|
- deployment branches and tags:
|
|
- selected branches only
|
|
- allow `master`
|
|
|
|
Reasoning:
|
|
|
|
- beta promotions are deliberate human decisions; the required reviewer on
|
|
this environment is the promotion gate
|
|
- create this environment before the first `channel: beta` dispatch. If the
|
|
workflow runs first, GitHub auto-creates the environment with no
|
|
protection rules, and that first beta would publish without approval
|
|
|
|
Like nightly, beta publishing lives in `release.yml`, so no npm
|
|
trusted-publisher changes are needed (see section 2.2).
|
|
|
|
## 6. Configure `npm-stable`
|
|
|
|
Recommended settings for `npm-stable`:
|
|
|
|
- environment name: `npm-stable`
|
|
- required reviewers: at least one maintainer other than the person triggering the workflow when possible
|
|
- prevent self-review: enabled
|
|
- admin bypass: disabled if your team can tolerate it
|
|
- wait timer: optional
|
|
- deployment branches and tags:
|
|
- selected branches only
|
|
- allow `master`
|
|
|
|
Reasoning:
|
|
|
|
- stable publishes should require an explicit human approval gate
|
|
- the workflow is manual, but the environment should still be the real control point
|
|
|
|
## 7. Protect `master`
|
|
|
|
Open the branch protection settings for `master`.
|
|
|
|
Recommended rules:
|
|
|
|
1. require pull requests before merging
|
|
2. require status checks to pass before merging
|
|
3. require review from code owners
|
|
4. dismiss stale approvals when new commits are pushed
|
|
5. restrict who can push directly to `master`
|
|
|
|
At minimum, make sure workflow and release script changes cannot land without review.
|
|
|
|
## 8. Enforce CODEOWNERS Review
|
|
|
|
This repo now includes `.github/CODEOWNERS`, but GitHub only enforces it if branch protection requires code owner reviews.
|
|
|
|
In branch protection for `master`, enable:
|
|
|
|
- `Require review from Code Owners`
|
|
|
|
Then verify the owner entries are correct for your actual maintainer set.
|
|
|
|
Current file:
|
|
|
|
- `.github/CODEOWNERS`
|
|
|
|
If `@cryppadotta` is not the right reviewer identity in the public repo, change it before enabling enforcement.
|
|
|
|
## 8.1. Let the Lockfile Bot Merge Lockfile Refreshes
|
|
|
|
`.github/workflows/refresh-lockfile.yml` regenerates `pnpm-lock.yaml` from the manifests on `master` and merges the result without CI or review. Contributors never commit the lockfile, so the bot is the only path for lockfile changes.
|
|
|
|
Resolution keeps locked versions, but it picks the newest matching version for an added or widened dependency. A release-age gate (`.github/scripts/check-lockfile-release-age.mjs`) therefore checks every package version that the refresh adds. The bot merges only when each one has been on npm for at least 3 days. If any version is newer, or the gate cannot verify it, the bot leaves a comment on the PR and does not merge. A maintainer can review and merge it, or the daily scheduled refresh merges it after the versions are old enough. A held run saves its lockfile, and the hash of the `master` lockfile it started from, as an artifact. The next run resolves from that lockfile only while `master` still has the same lockfile. Held versions therefore stay put while their manifests are unchanged, even when newer releases appear, and a lockfile change on `master` replaces them. The gate also holds any added entry whose resolution is not a plain npm registry tarball. Change the age with `--min-age-days` in the workflow.
|
|
|
|
The merge uses a dedicated GitHub App. Do not reuse `commitperclip` or bypass the built-in `github-actions` app. Those identities are available to other workflows, including release jobs that run dependency install scripts, so a bypass for them would let any of those workflows land code on `master`.
|
|
|
|
1. Create an organization-owned GitHub App, for example `paperclip-lockfile-bot`:
|
|
- Disable the webhook.
|
|
- Repository permissions: `Contents: Read and write`, `Pull requests: Read and write`. Leave everything else at `No access`.
|
|
- Allow installation only on this account.
|
|
2. Install the app on `paperclipai/paperclip` only.
|
|
3. Create a GitHub environment named `lockfile-refresh`. Under deployment branches and tags, allow only `master`. Add no required reviewers.
|
|
4. In that environment, add:
|
|
- variable `LOCKFILE_BOT_CLIENT_ID`: the app's client ID
|
|
- secret `LOCKFILE_BOT_PRIVATE_KEY`: a private key generated for the app
|
|
5. In the `master` ruleset, add the app as a bypass actor with bypass mode `For pull requests only`. The app can then merge PRs past required checks and code owner review, but it cannot push to `master` directly.
|
|
|
|
The workflow mints the app token after dependency resolution finishes and merges only the commit it pushed (`--match-head-commit`). A commit anyone else pushes to `chore/refresh-lockfile` makes the merge fail.
|
|
|
|
## 9. Protect Release Infrastructure Specifically
|
|
|
|
These files should always trigger code owner review:
|
|
|
|
- `.github/workflows/release.yml`
|
|
- `scripts/release.sh`
|
|
- `scripts/release-lib.sh`
|
|
- `scripts/release-package-map.mjs`
|
|
- `scripts/create-github-release.sh`
|
|
- `scripts/rollback-latest.sh`
|
|
- `doc/RELEASING.md`
|
|
- `doc/PUBLISHING.md`
|
|
|
|
If you want stronger controls, add a repository ruleset that explicitly blocks direct pushes to:
|
|
|
|
- `.github/workflows/**`
|
|
- `scripts/release*`
|
|
|
|
## 10. Do Not Store a Claude Token in GitHub Actions
|
|
|
|
Do not add a personal Claude or Anthropic token for automatic changelog generation.
|
|
|
|
Recommended policy:
|
|
|
|
- stable changelog generation happens locally from a trusted maintainer machine
|
|
- canaries never generate changelogs
|
|
|
|
This keeps LLM spending intentional and avoids a high-value token sitting in Actions.
|
|
|
|
## 11. Verify the Canary Workflow
|
|
|
|
After setup:
|
|
|
|
1. merge a harmless commit to `master`
|
|
2. open the `Release` workflow run triggered by that push
|
|
3. confirm it passes verification
|
|
4. confirm publish succeeds under the `npm-canary` environment
|
|
5. confirm npm now shows a new `canary` release
|
|
6. confirm a git tag named `canary/vYYYY.MDD.P-canary.N` was pushed
|
|
|
|
Install-path check:
|
|
|
|
```bash
|
|
npm install --prefix "$(mktemp -d)" paperclipai@canary --no-audit --no-fund
|
|
```
|
|
|
|
The release script runs this clean-prefix install after publishing every workspace
|
|
package dependency-first and publishing `paperclipai` last. A package that is not
|
|
yet registry-visible stops the train before the channel entrypoint can advance.
|
|
|
|
## 12. Verify the Stable Workflow
|
|
|
|
After at least one good canary exists:
|
|
|
|
1. resolve the target stable version with `./scripts/release.sh stable --date YYYY-MM-DD --print-version`
|
|
2. prepare `releases/vYYYY.MDD.P.md` on the source commit you want to promote
|
|
3. open `Actions` -> `Release`
|
|
4. run it with:
|
|
- `source_ref`: the tested commit SHA or canary tag source commit
|
|
- `stable_date`: leave blank or set the intended UTC date like `2026-03-18`
|
|
do not enter a version like `2026.318.0`; the workflow computes that from the date
|
|
- `dry_run`: `true`
|
|
5. confirm the dry-run succeeds
|
|
6. rerun with `dry_run: false`
|
|
7. approve the `npm-stable` environment when prompted
|
|
8. confirm npm `latest` points to the new stable version
|
|
9. confirm git tag `vYYYY.MDD.P` exists
|
|
10. confirm the GitHub Release was created
|
|
|
|
Implementation note:
|
|
|
|
- the GitHub Actions stable workflow calls `create-github-release.sh` with `PUBLISH_REMOTE=origin`
|
|
- local maintainer usage can still pass `PUBLISH_REMOTE=public-gh` explicitly when needed
|
|
|
|
## 13. Suggested Maintainer Policy
|
|
|
|
Use this policy going forward:
|
|
|
|
- canaries are automatic and cheap
|
|
- stables are manual and approved
|
|
- only stables get public notes and announcements
|
|
- release notes are committed before stable publish
|
|
- rollback uses `npm dist-tag`, not unpublish
|
|
|
|
## 14. Troubleshooting
|
|
|
|
### Trusted publishing fails with an auth error
|
|
|
|
Check:
|
|
|
|
1. the workflow filename on GitHub exactly matches the filename configured in npm
|
|
2. the package has the trusted publisher entry for the correct repository
|
|
3. the job has `id-token: write`
|
|
4. the job is running from the expected repository, not a fork
|
|
|
|
### Stable workflow runs but never asks for approval
|
|
|
|
Check:
|
|
|
|
1. the `publish` job uses environment `npm-stable`
|
|
2. the environment actually has required reviewers configured
|
|
3. the workflow is running in the canonical repository, not a fork
|
|
|
|
### CODEOWNERS does not trigger
|
|
|
|
Check:
|
|
|
|
1. `.github/CODEOWNERS` is on the default branch
|
|
2. branch protection on `master` requires code owner review
|
|
3. the owner identities in the file are valid reviewers with repository access
|
|
|
|
## Related Docs
|
|
|
|
- [doc/RELEASING.md](RELEASING.md)
|
|
- [doc/PUBLISHING.md](PUBLISHING.md)
|
|
- [doc/plans/2026-03-17-release-automation-and-versioning.md](plans/2026-03-17-release-automation-and-versioning.md)
|
|
|
|
## Runner verification dependency cache
|
|
|
|
`release-verify.yml` runs `Verify Paperclip Runner` on two independent runners.
|
|
The protocol lane runs `check:eval-kernel` and `check:protocol`. The Rust lane
|
|
runs `check:runner` and `check:api-authority`. Together they retain every check
|
|
in `check:all`; both lanes must pass before Cloud source verification or
|
|
readiness can succeed. A failed lane does not cancel the other lane.
|
|
|
|
Both lanes restore Cargo dependencies with the pinned Rust Cache action. The
|
|
compiler comes from the Runner package's `rust-toolchain.toml` before the action
|
|
computes its key. Compiler and Cargo metadata changes select a new cache. The
|
|
`release-runner-v2` shared key avoids separate copies for these lanes. Its suffix
|
|
hashes the virtual workspace's `runner/Cargo.toml` and ancestor Cargo configuration.
|
|
Rust Cache discovers member manifests through Cargo metadata, which omits this
|
|
virtual manifest. Without the suffix, changing `[profile.dev]` can restore an
|
|
exact but obsolete dependency cache on every run. GitHub caches are immutable,
|
|
so the successful rebuild cannot replace that old entry. The profile/configuration
|
|
hash also partitions fallback restores. Every reader and writer uses the same
|
|
inputs, including the separate typecheck and cross-target caches.
|
|
Only the Rust lane saves this cache. After verification it also runs `build:rust`
|
|
to warm the debug dependencies used by the protocol lane; its own tests already
|
|
warm release dependencies. The cache writer is shorter than the protocol lane.
|
|
|
|
GitHub matches a cache entry on its key and on a version hash of the absolute
|
|
paths in the entry. The master writer runs on the RunsOn fleet, where the
|
|
checkout is `/home/runner/_work/paperclip/paperclip`. The trusted PR workflow
|
|
restores the same entry read-only on GitHub-hosted runners, where the checkout
|
|
is `/home/runner/work/paperclip/paperclip`. A `Pin the Runner Rust workspace
|
|
path` step in both workflows links `$HOME/paperclip-runner-rust` to the Runner
|
|
crate and passes that path to the cache action, so both layouts hash the same
|
|
paths and the PR lanes can restore master's entry. The guard tests under
|
|
`.github/scripts/tests/` require this step, with identical text, before every
|
|
Rust cache step in both workflows.
|
|
|
|
Workspace crates and installed Cargo binaries are excluded from this entry.
|
|
Every run runs all assigned checks, including on a cache hit. In release
|
|
verification, only an own-repository master-push run verifying that push's exact
|
|
SHA can restore the cache, and only a successful Rust lane saves it. The PR
|
|
workflow restores master's cache read only. Tag and manual candidate release
|
|
verification compile without this cache. A miss or eviction costs compilation
|
|
time but does not change the checks. To discard old dependency caches, increment
|
|
the shared-key version and let the next successful master verification warm it.
|
|
|
|
### Installed JavaScript dependencies
|
|
|
|
`setup-ci-dependencies` can restore exact `node_modules` trees and separately
|
|
certified shared/SDK build outputs. `scripts/ci-dependency-cache.mjs` hashes
|
|
manifests, resolution, patches, install scripts, and the runtime/checkout layout.
|
|
The root workspace-link hook and the server/Runner Copilot asset hooks are known
|
|
postinstall commands. An exact dependency restore replays these hooks before
|
|
validating workspace links and build outputs. Copilot defers installation in an
|
|
unbuilt source checkout; its normal build installs and verifies the assets.
|
|
Provider assets are not included in the dependency cache. Any unrecognized
|
|
workspace lifecycle hook still disables materialized reuse. Only a frozen install
|
|
from the canonical master push can publish the shared entries.
|
|
|
|
For CI cache changes, the `profile-ci` label runs the paired setup benchmark
|
|
and exercises restored dependencies with the shared-package tests. The longer
|
|
server test comparison runs when its measured scripts or fixtures change;
|
|
cache-only changes do not require unchanged test commands to run faster.
|
|
It also builds Rust units on one GitHub-hosted runner and restores the dependency
|
|
and workspace caches on a second runner with a fresh checkout. Both restores
|
|
must be exact, and Cargo must report every unit as fresh. These qualification
|
|
caches are scoped to the PR and run; they cannot populate master's caches.
|
|
|
|
### Runner release crate cache
|
|
|
|
The dependency entry leaves the Runner's own crate out, and a fresh checkout
|
|
invalidates cargo's mtime fingerprints for workspace crates anyway, so every
|
|
pull request build compiled `paperclip-runner-core` in release mode from
|
|
scratch (28-49s per job on 2026-10-11) although most master commits leave its
|
|
inputs untouched. A second, content-addressed entry holds only that crate's
|
|
release artifacts: its fingerprints, the lib's rlib and rmeta, the
|
|
`paperclip-runnerd` binary and their dep-info, about 70 MB. The path list and
|
|
the key inputs live in `scripts/runner-release-crate-cache.mjs`, which both
|
|
workflows call, and `scripts/__tests__/runner-release-crate-cache.test.mjs`
|
|
holds the readers and the writer to them.
|
|
|
|
The key is `runner-release-crate-v1-<scope>-<hashFiles>`. The scope names the
|
|
platform, the pinned compiler (`rustc --version --verbose`: release, commit and
|
|
host) and a hash of the checkout root, because cargo's dep-info records the
|
|
protocol files the crate includes by relative path as absolute paths. The
|
|
`hashFiles` part covers every input the build reads: the toolchain pin, the
|
|
manifests and lockfile, the crate sources, the protocol schemas and fixtures,
|
|
and the three fixture trees the test modules include (two under the Runner
|
|
package and `tests/runner-e2e/fixtures` at the repository root). Any change
|
|
to any of them selects a new key. A guard test resolves every `include_str!`
|
|
and `include_bytes!` in the crate, whether its argument is a literal or a
|
|
`concat!` of literals, `env!("CARGO_MANIFEST_DIR")` and macro metavariables,
|
|
and fails on an include that lands outside these patterns or uses a form it
|
|
cannot resolve. Readers pass no `restore-keys`: a prefix match would hand
|
|
cargo another revision's output.
|
|
|
|
The writer is the Rust lane of the same master-push verification, after its
|
|
checks and the debug warm-up. It looks the key up first and, on a miss, runs
|
|
`cargo clean --release -p paperclip-runner-core` and then the package's
|
|
`build:binary` (the exact command the readers run) before saving, so the entry
|
|
carries no test-profile variants. In the trusted PR workflow, the Typecheck,
|
|
Build and Canary Dry Run jobs and the two Verify Paperclip Runner lanes that
|
|
build the crate (`rust` and the final vitest shard) restore the entry
|
|
read-only right after the dependency restore. On a hit, `mark-current` sets
|
|
the mtime of every restored artifact to now, so cargo's freshness check sees
|
|
every source as older than the build and keeps the artifacts. A restore that
|
|
lacks any file cargo reads or checks for either unit (the fingerprint hash
|
|
and dep-info of each unit, the lib's rlib and rmeta, the binary under
|
|
`deps`; measured with cargo 1.97.1, which recompiles without any one of
|
|
them and recreates the uplifted binary without any of the rest) is removed
|
|
instead, the job log names the missing file, and cargo compiles as on a
|
|
miss. `pnpm build`
|
|
then prints `Finished release profile` in well under a second for that crate.
|
|
On a miss nothing changes: cargo compiles the crate as before.
|
|
|
|
The trust boundary is unchanged: only master writes, a pull request can only
|
|
restore master's entry, and it restores only artifacts built from inputs
|
|
byte-identical to its own merge tree.
|
|
|
|
The trust boundary is the protected master branch, not the cache-key text.
|
|
GitHub does not let master restore caches created by a child branch, sibling
|
|
branch, tag, or PR merge ref. Both permitted restore scopes (current branch and
|
|
default branch) are master here. A workflow with authority to execute arbitrary
|
|
code on master can affect verification directly and is already trusted. The
|
|
cache contains dependency build artifacts, not credentials or workspace output.
|
|
See [GitHub cache access restrictions](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache).
|
|
|
|
## Chat integration test shards
|
|
|
|
Release verification runs the large chat integration file on three independent
|
|
runners. Five other server shards cover every remaining general server file.
|
|
The ordinary local test command and trusted PR workflow keep their complete
|
|
`general-server` group. Each chat case shuts down its services, pauses its own
|
|
still-active endpoints, and retires its active/waiting conversations after
|
|
assertions. This keeps workers in later cases from claiming earlier
|
|
fixtures in the shared test database. Application assertions stay unchanged.
|
|
|
|
Each chat job collects active tests with Vitest, groups cases by source line,
|
|
and balances those groups by case count. Parameterized cases and loop-generated
|
|
cases on one line stay together. The job re-collects with the exact line filters
|
|
it will execute and fails if the selected case identities differ. Hooks and test
|
|
execution remain sequential inside each runner with its own temporary home.
|
|
|
|
Run one shard locally with:
|
|
|
|
```sh
|
|
pnpm test:run:general -- --group general-chat --shard-index 0 --shard-count 3
|
|
```
|
|
|
|
Use indexes 0, 1, and 2 to run the complete chat suite. The CLI validates that
|
|
each shard has work and that collection includes usable source locations. A
|
|
Vitest collection or filtering change fails verification instead of dropping
|
|
tests. Splitting adds three release-verification jobs and repeats collection and
|
|
fixture setup; it does not make a single test faster.
|
|
|
|
The file-duration manifest also records the native Codex Runner integration
|
|
suite's measured import and execution cost, so the existing file balancer
|
|
accounts for it in both ordinary PR and release verification.
|
|
|
|
|
|
## Cloud readiness runner placement
|
|
|
|
When AWS routing is enabled, Cloud image builds use `paperclip-cloud-build-x64`
|
|
and source verification uses `paperclip-post-merge-x64`. The artifact wait and
|
|
the `Cloud source verified v1` and `Cloud deployable v1` marker jobs run on
|
|
GitHub-hosted runners. These small jobs must not hold or wait for capacity in
|
|
the source-verification fleet. During a merge
|
|
burst, even a completed build must wait for its marker before consumers can
|
|
recognize readiness.
|
|
|
|
Runner placement does not change readiness requirements: exact-source artifacts,
|
|
all source checks, and the image verification must still pass. The versioned
|
|
markers and their dependency gates are unchanged.
|