Repository navigation
feat(artifact-delivery): fall back to the requester's GitHub token - #495
Merged
Merged
Conversation
A run polls its Resolution once a second, so one slow build spent the whole guest allowance of 60 requests a minute and failed with RATE_LIMITED. Polls now draw from their own allowance (ADR-0012). GitHub answers a secondary rate limit with 403 or 429 and Retry-After. A 403 failed the run as SOURCE_ACCESS_DENIED, and a 429 threw into the queue retry ladder. Both now fail as RATE_LIMITED with the named wait, and a rate-limited tarball no longer falls back to one read per blob. Every retryable failure now names retryAfterSeconds. The first queue retry waits 5 seconds instead of 60, inside the CLI's 60 second window.
The hourly registry sync spends GITHUB_TOKEN to zero before each GitHub reset. On 2026-10-06, 13 runs failed RATE_LIMITED in those minutes. GitHub counts a personal token's quota per account, so builds now read with ARTIFACT_GITHUB_TOKEN when it is set, and with GITHUB_TOKEN until then.
GitHub counts a personal token's quota per account. GITHUB_TOKEN is a personal token, so the registry sync, page views and the account owner's other tools spend the same bucket that builds need, and runs failed RATE_LIMITED in the minutes before each hourly reset. An App installation has its own bucket. Builds now mint an installation token for the read App and fall back to ARTIFACT_GITHUB_TOKEN, then GITHUB_TOKEN, with a reported reason when the App gives none.
…uota When every shared GitHub bucket is spent, a signed-in run still has its own: the account's GitHub sign-in token reads public Repositories at that account's quota. The build retries only the refused read with it, and only for the account that asked. The requester row lives while the build runs. The build deletes it when it settles, account deletion removes it, and the daily purge removes one a dead build left behind.
…oken # Conflicts: # layers/artifact-delivery/server/utils/build.ts # layers/artifact-delivery/server/utils/github-source.ts # layers/artifact-delivery/server/utils/queue.ts # test/unit/skill-run-sweep.test.ts
Contributor
🤖 MERGED
GitHub merged this pull request.
698742d6-872f-43ca-9abd-8f522f744558 Selected findings run after merge and open separate pull requests. |
Contributor
There was a problem hiding this comment.
Harlan Agent Kit posted this automated review. AI open source policy.
Automated Review: READY.
This was referenced Oct 6, 2026
1 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Related to #491
❓ Type of change
📚 Description
Every public build reads GitHub with a shared credential: the read App installation from #491, then
ARTIFACT_GITHUB_TOKEN, thenGITHUB_TOKEN. When those buckets are spent, every run failsRATE_LIMITED, signed in or not. A signed-in account already stores its GitHub sign-in token, and GitHub gives each account its own 5,000 requests an hour.A public build now repeats a read the shared quota refused, with the token of the account that asked for that Resolution.
POST /api/v1/resolutionsrecords the signed-in account, from the session or a CLI token, inartifact_resolution_requesters. An anonymous request records nothing and still failsRATE_LIMITED.RATE_LIMITEDstays the shared one.read:useranduser:email, which read no private Repository. The public client also refuses a Repository that GitHub reports as private. So an Artifact built with a requester's token holds public content, and later runs of that commit can reuse it.deny_unknown_fields. The CLI can suggestskilld auth loginfor aRATE_LIMITEDrun that was not signed in./ghpage views keep the shared token. Their GitHub reads run insidedefineCachedEventHandler, which passes the handler only itsvariesheaders, so the handler never sees the viewer's cookie.