Files
PaperClipAI/.github/workflows/canary-finalize.yml
T
DottaandClaude Opus 5.5 0e8447fe77 fix(release): retry the finalize install while a large tarball lags its npm metadata (#21925)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Since #21917, each canary's npm confirmation, git tag, Docker build
and onboarding smoke run in `canary-finalize.yml`
> - The first canary through it, `2026.1116.0-canary.814700`, passed the
master-position, visibility, provenance (31 of 31) and dist-tag checks
> - It then failed the clean-prefix install: the 524 MB
`@paperclipai/server` tarball returned 404 while npm already listed the
version
> - Without a tag, nightly cannot select that canary, and no Docker
image or smoke runs for it
> - This pull request retries that install for a bounded time
> - The benefit is that a large tarball's normal lag no longer stops a
canary from finishing

## Linked Issues or Issue Description

**What happened?**
Canary finalize run 43927092510 for `2026.1116.0-canary.814700`:
`npm error 404 Not Found - GET
https://registry.npmjs.org/@paperclipai/server/-/server-2026.1116.0-canary.814700.tgz`.
npm's packument records that version at 18:31:41Z. The install ran at
18:32:03Z, and the tarball still returned 404 at 18:34:39 and 18:35:15.
`@paperclipai/shared` and `paperclipai` tarballs at the same version
returned 200.

**Expected behavior**
Finalize waits, within a bound, until the published tarball downloads,
then tags the canary.

Refs #21917

## What Changed

- `scripts/release-lib.sh`: `wait_for_npm_installable` retries
`verify_npm_installable` up to N attempts with a fixed delay.
- `scripts/confirm-canary-publication.sh`: uses it with 40 attempts × 30
s (`NPM_INSTALL_VERIFY_ATTEMPTS`, `NPM_INSTALL_VERIFY_DELAY_SECONDS`).
- `.github/workflows/canary-finalize.yml`: `confirm_canary` timeout 45 →
75 min, to fit the existing 30-minute visibility budget plus the
20-minute install budget.
- Test and `doc/RELEASING.md`.

## Verification

- `node --test scripts/release-lib.test.mjs`: 23 of 23 pass, including a
new test: immediate success, recovery after 3 failures (4 attempts,
warning names attempt 3/5), and failure after the bound (4 of 4
attempts).
- `node --test scripts/__tests__/release-verify-workflow.test.mjs`: 73
of 73 pass.
- After merge: the next canary's finalize run passes the install and
pushes its tag. `canary.814700` itself is recovered by rerunning its
finalize run once its tarball downloads.

## Risks

- Low. A tarball that never appears still fails finalize, after 20
minutes instead of at once.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with
tool use and code execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 14:24:40 -06:00

152 lines
5.3 KiB
YAML

name: Canary finalize
run-name: Canary finalize ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: Canary version that publish_canary published
required: true
type: string
source_sha:
description: Full source commit SHA of that canary
required: true
type: string
release_run_id:
description: Release workflow run that published it
required: true
type: string
permissions: {}
concurrency:
group: canary-finalize-${{ inputs.version }}
cancel-in-progress: false
env:
NPM_PUBLISH_VERIFY_ATTEMPTS: "180"
NPM_PUBLISH_VERIFY_DELAY_SECONDS: "10"
jobs:
confirm_canary:
name: Confirm canary on npm and tag it
if: github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
timeout-minutes: 75
permissions:
contents: write
actions: write
outputs:
version: ${{ steps.inputs.outputs.version }}
source_sha: ${{ steps.inputs.outputs.source_sha }}
release_run_id: ${{ steps.inputs.outputs.release_run_id }}
steps:
- name: Validate inputs
id: inputs
env:
VERSION: ${{ inputs.version }}
SOURCE_SHA: ${{ inputs.source_sha }}
RELEASE_RUN_ID: ${{ inputs.release_run_id }}
run: |
set -euo pipefail
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-canary\.[0-9]+$ ]] || { echo "Error: not a canary version" >&2; exit 1; }
[[ "$SOURCE_SHA" =~ ^[0-9a-f]{40}$ ]] || { echo "Error: not a full commit SHA" >&2; exit 1; }
[[ "$RELEASE_RUN_ID" =~ ^[1-9][0-9]*$ ]] || { echo "Error: not a run id" >&2; exit 1; }
{
echo "version=$VERSION"
echo "source_sha=$SOURCE_SHA"
echo "release_run_id=$RELEASE_RUN_ID"
} >> "$GITHUB_OUTPUT"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ steps.inputs.outputs.source_sha }}
fetch-depth: 0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 24
- name: Configure git author
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Confirm the canary and push its tag
env:
VERSION: ${{ steps.inputs.outputs.version }}
SOURCE_SHA: ${{ steps.inputs.outputs.source_sha }}
PUBLISH_REMOTE: origin
run: ./scripts/confirm-canary-publication.sh "$VERSION" "$SOURCE_SHA"
- name: Build Docker images for the canary tag
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.inputs.outputs.version }}
RELEASE_RUN_ID: ${{ steps.inputs.outputs.release_run_id }}
run: |
{
echo "## Canary published"
echo ""
echo "- Published canary: \`$VERSION\` ([release run](https://github.com/$GITHUB_REPOSITORY/actions/runs/$RELEASE_RUN_ID))"
echo "- Docker build dispatched at \`canary/v$VERSION\`"
} >> "$GITHUB_STEP_SUMMARY"
gh workflow run docker.yml --ref "refs/tags/canary/v$VERSION" --repo "$GITHUB_REPOSITORY"
smoke_canary_onboarding:
needs: confirm_canary
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
actions: read
env:
PAPERCLIPAI_VERSION: ${{ needs.confirm_canary.outputs.version }}
PAPERCLIP_PLAYWRIGHT_CHANNEL: chrome
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.confirm_canary.outputs.source_sha }}
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
with:
version: 9.15.4
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 24
- name: Restore canary smoke lockfile
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: canary-smoke-lockfile-${{ needs.confirm_canary.outputs.source_sha }}
run-id: ${{ needs.confirm_canary.outputs.release_run_id }}
github-token: ${{ github.token }}
- name: Install test dependencies
run: pnpm install --frozen-lockfile
- name: Show browser version
run: google-chrome --version
- name: Smoke exact published canary through onboarding
env:
PAPERCLIP_CANARY_SMOKE_SERVER_LOG: ${{ runner.temp }}/canary-onboarding-server.log
run: pnpm run test:canary-onboarding-smoke
- name: Upload failed canary onboarding diagnostics
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: canary-onboarding-smoke-${{ needs.confirm_canary.outputs.version }}
if-no-files-found: warn
retention-days: 14
path: |
${{ runner.temp }}/canary-onboarding-server.log
tests/canary-onboarding/playwright-report/
tests/canary-onboarding/test-results/