Files
PaperClipAI/.github/workflows
Devin FoleyandPaperclip bda1bf7b52 fix(ci): respect GitHub quota resets during image publication (#22690)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Its image workflow builds immutable images and requires proof for
the exact source.
> - GitHub API quota failures can stop metadata generation and
verification reads.
> - Short retries before the quota reset consume requests without
restoring progress.
> - This pull request removes metadata API reads and makes quota retries
respect server timing and job budgets.
> - The benefit is fewer API requests and clear quota errors without
weakening release proof.

## Linked Issues or Issue Description

Refs #22677, which adds conditional requests for unchanged Actions
polls. This change retains that cache and extends quota recovery.

**What happened?**

[Docker run
45215585951](https://github.com/paperclipai/paperclip/actions/runs/45215585951)
failed in both Docker metadata steps with an installation API rate-limit
error. [Run
45210434846](https://github.com/paperclipai/paperclip/actions/runs/45210434846)
built both architectures but failed during source verification reads.
The reader retried quota-proven HTTP 403 responses after seconds and
then failed with a generic HTTP error. It ignored the primary reset time
and could shorten Retry-After below the server requirement.

**Expected behavior**

Metadata generation should need no GitHub API request. Quota recovery
should wait until GitHub permits another request, within the caller
deadline. Exhausted budgets should identify the quota failure and safe
response-header details. Permission failures must remain immediate.
Missing source, migrator, or attestation proof must still block
publication.

**Steps to reproduce**

1. Return HTTP 403 with zero remaining requests and a reset two minutes
away to the Actions reader.
2. Observe the old reader retry after seconds and exhaust its attempts
before the reset.
3. Return an hour-long Retry-After value. Observe the old reader retry
after its one-minute cap.

**Version**

Master after #22677.

**Deployment mode**

GitHub Actions image publication and release verification.

## What Changed

- Honor primary reset times and Retry-After seconds or dates. Use a
minute-long exponential fallback for secondary throttling without timing
headers.
- Bound the entire wait by a per-read budget and the caller deadline.
Keep permission-denied 403s immediate and preserve ETag caching and
transport retries.
- Emit a typed quota error with allowlisted token-source, resource,
limit, remaining, and reset diagnostics. Do not log tokens, response
bodies, or request URLs.
- Share the Docker observer's 40-minute deadline with its reader. Bound
final proof rechecks to five minutes. Add an explicit `github.token`
source hint beside workflow-issued token bindings.
- Generate Docker tags and OCI labels from checkout and workflow inputs.
Keep release-lane and immutable SHA tags. Feed metadata JSON explicitly
to manifest publication. Stop fetching the GitHub repository
description; keep local license and migration labels.
- Add regression tests and run them in the trusted PR and
source-verification workflows. Document retry budgets and metadata
inputs.

## Verification

- Final acceptance: [CI attempt
3](https://github.com/paperclipai/paperclip/actions/runs/45263398107/attempts/3)
succeeded on `302da8c`. All 68 reported checks are complete, with no
pending or failing checks. Greptile reviewed that exact commit at 5/5
and both review threads are resolved. The voice timeout recovered
without code changes; its earlier cause remains unconfirmed. Prior
failures and local reproduction limits remain below.

- [CI attempt
2](https://github.com/paperclipai/paperclip/actions/runs/45263398107/attempts/2)
recovered the interrupted checks. Its only remaining test failure is
server shard 2/12: `voice-session-store.integration.test.ts`, “retains
both spoken sides once on the public call task and preserves
quarantine,” exceeded 15 seconds on both Vitest attempts. The `ci /
verify` failure is its aggregate. The voice test file is byte-identical
to master and absent from this PR diff; its cause is not established as
an infrastructure fault. A focused local attempt could not start
PostgreSQL because the macOS binary lacks `libzstd.1.dylib`; no voice
test passed locally. Requesting one bounded retry of the affected shard
without code changes; all earlier failures remain recorded here.

- The automatic runner-loss retry helper for the current run failed on a
GitHub job-log download with HTTP 503 ([helper run
45265762243](https://github.com/paperclipai/paperclip/actions/runs/45265762243)).
Once the PR workflow completed, a manual failed-job retry was requested
successfully for unchanged head `302da8c`. Retry results remain pending;
no interrupted check is treated as passed.

- [CI run
45263398107](https://github.com/paperclipai/paperclip/actions/runs/45263398107)
on `302da8c` lost 25 jobs during verification. Inspected the logs for
these 25 jobs: all 25 contain an explicit runner shutdown signal
followed by cancellation, with no additional error records. This
includes Rust, browser, general-server, and serialized-server lanes.
These are interrupted checks and remain unverified until retried.
Greptile reviewed this exact commit at 5/5 with no new findings.

- Combined focused release/metadata and PR policy suite: **1,008 tests
passed**, zero failures. Command: `node --test
scripts/github-actions-rate-limit.test.mjs
scripts/docker-image-metadata.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 scripts/merge-group-image.test.mjs
scripts/__tests__/release-verify-workflow.test.mjs
.github/scripts/tests/*.test.mjs`.
- `pnpm exec vitest run
server/src/services/online-durable-data-migration.test.ts --project
@paperclipai/server`: **32 tests passed** after incorporating upstream
#22686. The final PR diff includes no migration test or runtime change.
- In `packages/paperclip-runner`, `pnpm exec vitest run
src/drivers/acpx/cursor-mode.test.ts
src/drivers/acpx/grok-native-session-options.test.ts --maxWorkers 1`:
**26 tests passed**. This local pass does not explain the earlier CI
timeouts.
- New tests first reproduced ignored primary reset timing, early
Retry-After retries, missing service-error waits, and older-checkout
failures. CLI tests confirm quota exhaustion produces a safe annotation,
no verified output, and no cancellation request. Workflow tests cover
neither, either, and both new test files being present.
- Initial policy CI failed two assertions that expected the old metadata
action and single-file proof test command. Updated them to check both
local metadata steps, the full-SHA tag, and all proof tests. Initial
Greptile findings about service Retry-After and older checkouts are
fixed and resolved.
- [CI attempt
1](https://github.com/paperclipai/paperclip/actions/runs/45259240827/attempts/1)
lost the Build runner and server shards 1, 7, and 12 within four
seconds. Logs explicitly record shutdown signals followed by
cancellation; Build reported no compiler error. Runner lane 2/3 hit
five-second Cursor and Grok test timeouts. E2E shard 2/8 failed document
visibility after outage/reload and the cached-task 404 assertion. Those
test failures are not assumed to be infrastructure faults. Their
aggregate checks also failed. They remain merge blockers until fresh CI
passes.
- Server shard 9 also found a deterministic, pre-existing
blocker-enumeration test failure. Reproduced it on unchanged base
`427d13c38c63`: the source scanner omitted helper-declared blockers.
Upstream #22686 fixes that test. Incorporated its version when updating
from master and removed the duplicate fix from the final diff. A
failed-job retry was accepted after attempt 1 finished; the updated
branch now needs fresh CI.
- Local setup: filtered frozen-lockfile installation changed no
lockfile. Initial server-test startup lacked built plugin SDK output;
`pnpm --filter @paperclipai/plugin-sdk ensure-build-deps` supplied it
before the passing run. Local tests used macOS and Node 25.6.1; CI
checks Linux and its configured Node version.
- `pnpm verify` initially could not start because the fresh worktree
lacked `cli/node_modules/tsx`. The underlying `node
scripts/local-verify.mjs` returned exit 2: workflow changes require
broad CI. No full local Vitest or Docker build was run. Required CI
supplies broad coverage.
- No credentials were changed and no live publication or deployment was
requested. CI retries do not authorize image publication or bypass
proof.

## Risks

- A reset outside the allowed wait still fails closed. Shared repository
quota pressure from other workflows can still delay publication.
- Attestation and source/migrator proof remain required. This change
does not add a privileged token or bypass a check.
- OCI labels now use checkout inputs. The remote repository description
is omitted; source, revision, version, creation time, license, and
schema labels remain available.
- Revert this PR to restore the previous reader and metadata action. No
database or runtime application changes are required.

## Model Used

OpenAI gpt-6.1-sol with xhigh reasoning, through Codex in T3 Code. Used
code editing, GitHub log and upstream action-source inspection, and
local test 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] This is a CI reliability fix; it does not change planned product
scope
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have described the issue in-PR following the bug template
- [x] I have not referenced internal or instance-local issues or links
- [x] My branch name describes the change
- [x] I have run focused tests locally and they pass; the broad
verification limitation is recorded
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation
- [x] I have considered and documented risks
- [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>
2026-11-23 14:39:14 -08:00
..