mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-20 18:26:40 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Paperclip Runner ships pinned harnesses that run those agents. > - Some new models require a new harness release before they can run. > - The lockfile bot waits three days before it can merge new dependency versions automatically. > - That wait held the Claude and Codex refresh in #22231. > - This PR waives the wait for a fixed set of harness packages so model updates can ship as soon as npm confirms the releases. ## Linked Issues or Issue Description Refs #22231, #22278, #14942, #15572, and #18238. **What happened?** The refresh in #22231 held 16 new Claude Agent SDK and Codex versions even though the new model support needed those harness updates. **Expected behavior** Verified npm releases of named harness packages can pass the gate immediately. The gate applies the normal minimum age to other packages. **Steps to reproduce** Compare the parent and head of #22231 across the three lockfiles managed by the bot. Run the gate with the publish times in its hold comment and a clock within three days of the releases. ## What Changed - Exempt 28 exact package names from the minimum age. These cover the Claude Agent SDK, Codex CLI, their provider-specific ACP bridges, OpenCode, and the Copilot binaries pinned by Runner. - Take package identities from the Runner manifest and active provider profiles, then check the managed lockfiles for platform binaries. Codex platform aliases use the same registry name with a platform suffix on each version. Pi and Kimi use separate npm locks. Gemini, Grok, the local Cursor CLI, and Antigravity use separate install paths. The Cursor Cloud SDK gets model availability from the service. - Keep the npm publish-time and resolution checks for every entry. Update the bot report and setup documentation. ## Verification - Replayed the exact #22231 lockfile diff using the bot's recorded publish times and a fixed clock. The previous gate held all 16 versions. The new gate verified all 16 and held zero. - Ran the workflow CLI against the same three lockfile pairs and the live npm registry. It wrote `eligible=true` and reported 16 passing versions. - Reconciled the 28 exact names with the Runner manifest, provider profiles, all three bot-managed pnpm lockfiles, and the npm manifests for Claude Agent SDK 0.3.328, Codex 0.170.0, and OpenCode 1.18.34. - Ran `node --test '.github/scripts/tests/*.test.mjs'` locally. All 810 tests passed. The new cases cover mixed refreshes, similar names, registry errors, missing publish times, and non-registry resolutions. - Ran `git diff --check`. - GitHub Actions passed the required typecheck, build, test, and e2e checks on `9c8bccac51`. The Canary runner shut down on the first attempt, and browser shard 7 had a test-company cleanup error. Both passed on the failed-jobs retry. [CI attempt 2](https://github.com/paperclipai/paperclip/actions/runs/44610325309/attempts/2) - Standard Greptile scored the same revision 5/5. [Review](https://github.com/paperclipai/paperclip/pull/22349#issuecomment-7021573041) ## Risks An npm release of an allowlisted harness can reach master during its first three days through the existing automatic merge path. A compromised release can use that same path. Every added version still needs an npm publish time and a registry resolution. Review new platform package names before adding them to the allowlist. Superagent requests security review for this policy change. [Scanner finding](https://github.com/paperclipai/paperclip/pull/22349#discussion_r4634801827) ## Model Used OpenAI GPT-6 in Codex, with shell and code execution. The exact model snapshot and context window were not reported. ## 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>
232 lines
8.7 KiB
JavaScript
232 lines
8.7 KiB
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { spawnSync } from 'node:child_process';
|
|
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import path from 'node:path';
|
|
import {
|
|
addedPackageVersions,
|
|
addedPackageVersionsAcross,
|
|
checkReleaseAge,
|
|
formatReport,
|
|
parseLockfilePackages,
|
|
} from '../check-lockfile-release-age.mjs';
|
|
|
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
const now = new Date('2026-10-30T00:00:00Z');
|
|
const daysAgo = days => new Date(now.getTime() - days * DAY_MS);
|
|
|
|
const REGISTRY = '{integrity: sha512-x}';
|
|
|
|
// Each entry is a key, or [key, resolution] for a non-registry resolution.
|
|
const lockfile = entries => [
|
|
"lockfileVersion: '9.0'",
|
|
'',
|
|
'importers:',
|
|
'',
|
|
' .:',
|
|
' dependencies:',
|
|
' left-pad:',
|
|
' specifier: ^1.3.0',
|
|
' version: 1.3.0',
|
|
'',
|
|
'packages:',
|
|
'',
|
|
...entries.flatMap(entry => {
|
|
const [key, resolution] = Array.isArray(entry) ? entry : [entry, REGISTRY];
|
|
return [` ${key}:`, ` resolution: ${resolution}`, ' engines: {node: \'>=18\'}', ''];
|
|
}),
|
|
'snapshots:',
|
|
'',
|
|
' snapshot-only@9.9.9:',
|
|
' dependencies: {}',
|
|
'',
|
|
].join('\n');
|
|
|
|
const timesFrom = table => async (name, version) => {
|
|
const value = table[`${name}@${version}`];
|
|
if (value instanceof Error) throw value;
|
|
return value ?? null;
|
|
};
|
|
|
|
test('parses plain, quoted and scoped package keys from the packages section only', () => {
|
|
const packages = parseLockfilePackages(lockfile([
|
|
"'@scope/pkg@2.0.0'",
|
|
'left-pad@1.3.0',
|
|
['gitdep@https://codeload.github.com/o/r/tar.gz/abc', '{tarball: https://codeload.github.com/o/r/tar.gz/abc}'],
|
|
]));
|
|
assert.deepEqual([...packages].sort(), [
|
|
['@scope/pkg@2.0.0', REGISTRY],
|
|
['gitdep@https://codeload.github.com/o/r/tar.gz/abc', '{tarball: https://codeload.github.com/o/r/tar.gz/abc}'],
|
|
['left-pad@1.3.0', REGISTRY],
|
|
]);
|
|
});
|
|
|
|
test('lists only package versions the refresh adds', () => {
|
|
const base = lockfile(['left-pad@1.3.0', 'old@1.0.0']);
|
|
const head = lockfile(['left-pad@1.3.0', 'old@1.1.0', "'@scope/new@0.1.0'"]);
|
|
assert.deepEqual(addedPackageVersions(base, head), [
|
|
{ key: '@scope/new@0.1.0', name: '@scope/new', version: '0.1.0', resolution: REGISTRY },
|
|
{ key: 'old@1.1.0', name: 'old', version: '1.1.0', resolution: REGISTRY },
|
|
]);
|
|
});
|
|
|
|
test('lists the versions each lockfile adds, once', () => {
|
|
const pairs = [
|
|
[lockfile(['left-pad@1.3.0']), lockfile(['left-pad@1.3.0', 'shared@2.0.0', 'root-only@1.0.0'])],
|
|
[lockfile([]), lockfile(['shared@2.0.0', 'provider-only@3.0.0'])],
|
|
];
|
|
assert.deepEqual(addedPackageVersionsAcross(pairs).map(entry => entry.key), ['provider-only@3.0.0', 'root-only@1.0.0', 'shared@2.0.0']);
|
|
});
|
|
|
|
test('the CLI rejects unpaired lockfiles before any registry lookup', () => {
|
|
const root = mkdtempSync(path.join(tmpdir(), 'release-age-cli-'));
|
|
try {
|
|
const file = path.join(root, 'pnpm-lock.yaml');
|
|
writeFileSync(file, lockfile([]));
|
|
const result = spawnSync(process.execPath, [
|
|
path.resolve('.github/scripts/check-lockfile-release-age.mjs'),
|
|
'--base', file, '--head', file, '--base', file, '--min-age-days', '3',
|
|
], { encoding: 'utf8' });
|
|
assert.equal(result.status, 2, result.stderr);
|
|
assert.match(result.stderr, /Usage/);
|
|
} finally {
|
|
rmSync(root, { recursive: true, force: true });
|
|
}
|
|
});
|
|
|
|
test('lists an existing version whose resolution changed', () => {
|
|
const swapped = ['left-pad@1.3.0', '{tarball: https://example.com/left-pad-1.3.0.tgz}'];
|
|
assert.deepEqual(addedPackageVersions(lockfile(['left-pad@1.3.0']), lockfile([swapped])), [
|
|
{ key: 'left-pad@1.3.0', name: 'left-pad', version: '1.3.0', resolution: swapped[1] },
|
|
]);
|
|
});
|
|
|
|
test('holds unquoted URL keys and registry-looking keys with non-registry resolutions', async () => {
|
|
const entries = addedPackageVersions(lockfile([]), lockfile([
|
|
['gitdep@https://codeload.github.com/o/r/tar.gz/abc', '{tarball: https://codeload.github.com/o/r/tar.gz/abc}'],
|
|
['sneaky@1.0.0', '{integrity: sha512-x, tarball: https://example.com/sneaky.tgz}'],
|
|
]));
|
|
const result = await checkReleaseAge(entries, {
|
|
fetchPublishTime: timesFrom({ 'sneaky@1.0.0': daysAgo(400) }),
|
|
now,
|
|
minAgeMs: DAY_MS,
|
|
});
|
|
assert.equal(result.eligible, false);
|
|
assert.equal(result.checked, 2);
|
|
assert.deepEqual(
|
|
Object.fromEntries(result.held.map(h => [h.name, h.reason])),
|
|
{
|
|
gitdep: 'not a registry version',
|
|
sneaky: 'not a registry resolution: {integrity: sha512-x, tarball: https://example.com/sneaky.tgz}',
|
|
},
|
|
);
|
|
});
|
|
|
|
test('is eligible when every added version is old enough', async () => {
|
|
const entries = addedPackageVersions(lockfile([]), lockfile(['a@1.0.0', "'@s/b@2.0.0'"]));
|
|
const result = await checkReleaseAge(entries, {
|
|
fetchPublishTime: timesFrom({ 'a@1.0.0': daysAgo(30), '@s/b@2.0.0': daysAgo(3.5) }),
|
|
now,
|
|
minAgeMs: 3 * DAY_MS,
|
|
});
|
|
assert.deepEqual(result, { eligible: true, checked: 2, held: [] });
|
|
});
|
|
|
|
test('is eligible when the refresh adds no package versions', async () => {
|
|
const result = await checkReleaseAge([], { fetchPublishTime: timesFrom({}), now, minAgeMs: DAY_MS });
|
|
assert.equal(result.eligible, true);
|
|
});
|
|
|
|
test('holds a version newer than the minimum age', async () => {
|
|
const entries = addedPackageVersions(lockfile([]), lockfile(['old@1.0.0', 'fresh@1.0.1']));
|
|
const result = await checkReleaseAge(entries, {
|
|
fetchPublishTime: timesFrom({ 'old@1.0.0': daysAgo(30), 'fresh@1.0.1': daysAgo(0.5) }),
|
|
now,
|
|
minAgeMs: 3 * DAY_MS,
|
|
});
|
|
assert.equal(result.eligible, false);
|
|
assert.deepEqual(result.held.map(h => h.key), ['fresh@1.0.1']);
|
|
assert.match(result.held[0].reason, /0\.5 days ago/);
|
|
});
|
|
|
|
test('gives only named harness releases an exception to the minimum age', async () => {
|
|
const harnessKeys = [
|
|
'@agentclientprotocol/claude-agent-acp@0.73.0',
|
|
'@agentclientprotocol/codex-acp@1.6.2',
|
|
'@anthropic-ai/claude-agent-sdk@0.3.328',
|
|
'@anthropic-ai/claude-agent-sdk-linux-x64-musl@0.3.328',
|
|
'@github/copilot-darwin-arm64@1.0.88',
|
|
'@openai/codex@0.170.0',
|
|
'@openai/codex@0.170.0-win32-arm64',
|
|
'opencode-ai@1.18.34',
|
|
'opencode-linux-x64-baseline-musl@1.18.34',
|
|
];
|
|
const harnesses = addedPackageVersions(lockfile([]), lockfile(harnessKeys));
|
|
const other = addedPackageVersions(lockfile([]), lockfile([
|
|
'@agentclientprotocol/sdk@1.9.0',
|
|
'@anthropic-ai/claude-agent-sdk-lookalike@1.0.0',
|
|
'fresh@1.0.1',
|
|
]));
|
|
const options = { fetchPublishTime: async () => daysAgo(0.5), now, minAgeMs: 3 * DAY_MS };
|
|
|
|
const result = await checkReleaseAge(harnesses, options);
|
|
assert.deepEqual(result, { eligible: true, checked: harnessKeys.length, held: [] });
|
|
assert.match(formatReport(result, 3), /passed the release-age gate/);
|
|
|
|
const mixed = await checkReleaseAge([...harnesses, ...other], options);
|
|
assert.equal(mixed.eligible, false);
|
|
assert.deepEqual(mixed.held.map(h => h.key), other.map(h => h.key));
|
|
});
|
|
|
|
test('still requires a verified npm release for allowlisted names', async () => {
|
|
const entries = addedPackageVersions(lockfile([]), lockfile([
|
|
'@openai/codex@0.170.0',
|
|
'@openai/codex@0.171.0',
|
|
['@openai/codex@0.172.0', '{tarball: https://example.com/codex.tgz}'],
|
|
'@openai/codex@https://example.com/codex.tgz',
|
|
]));
|
|
const result = await checkReleaseAge(entries, {
|
|
fetchPublishTime: timesFrom({ '@openai/codex@0.170.0': new Error('npm registry returned 503') }),
|
|
now,
|
|
minAgeMs: 3 * DAY_MS,
|
|
});
|
|
assert.equal(result.eligible, false);
|
|
assert.deepEqual(result.held.map(h => h.reason), [
|
|
'registry lookup failed: npm registry returned 503',
|
|
'no publish time on npm',
|
|
'not a registry resolution: {tarball: https://example.com/codex.tgz}',
|
|
'not a registry version',
|
|
]);
|
|
});
|
|
|
|
test('fails closed on lookup errors, missing publish times and non-registry versions', async () => {
|
|
const entries = addedPackageVersions(
|
|
lockfile([]),
|
|
lockfile(['broken@1.0.0', 'unpublished@1.0.0', "'gitdep@https://codeload.github.com/o/r/tar.gz/abc'"]),
|
|
);
|
|
const result = await checkReleaseAge(entries, {
|
|
fetchPublishTime: timesFrom({ 'broken@1.0.0': new Error('npm registry returned 503') }),
|
|
now,
|
|
minAgeMs: DAY_MS,
|
|
});
|
|
assert.equal(result.eligible, false);
|
|
assert.deepEqual(
|
|
Object.fromEntries(result.held.map(h => [h.name, h.reason])),
|
|
{
|
|
broken: 'registry lookup failed: npm registry returned 503',
|
|
gitdep: 'not a registry version',
|
|
unpublished: 'no publish time on npm',
|
|
},
|
|
);
|
|
});
|
|
|
|
test('report lists held versions behind a stable marker', () => {
|
|
const report = formatReport(
|
|
{ eligible: false, checked: 1, held: [{ key: 'fresh@1.0.1', reason: 'too new' }] },
|
|
3,
|
|
);
|
|
assert.match(report, /^<!-- lockfile-release-age -->/);
|
|
assert.match(report, /- `fresh@1\.0\.1`: too new/);
|
|
});
|