Repository navigation
fix(github): keep each App mint inside the request that started it - #540
Merged
Merged
Conversation
A mint ignored the 4 second page read limit, so a hung GitHub held /gh pages for the mint's own 15 seconds on each read. A failed mint was not remembered, so every read tried a new one and reported it, and the sync paced on the fallback token the whole time. A read now passes its deadline to the mint it waits for. A failed mint stands for about 60 seconds per isolate with one event. A deadline that ends a mint is no failure, and a 401 on a minted token still re-mints once inside a window.
The isolate token cache shared one mint promise across requests. workerd ties a fetch to the request that made it. When that request answered before its mint finished, workerd dropped the mint, and the shared promise never settled. Every later request in the isolate that found no token waited on it: in local workerd, the next two requests got no answer in 40 and 10 seconds. The isolate cache now holds finished values only: a token with its expiry, and the failure window. A mint in flight stays with the credential of the request that started it. Reads in one request still share one mint. Two requests that find no token each mint their own, and a failure that one request records while the other mints keeps the window to one event.
Either request can sign its JWT first, so either can mint the first token. The test now checks that each request read with the token its own request minted.
Collaborator
Author
|
Agent note: a check by hand in local workerd (
|
This was referenced Oct 7, 2026
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 #525
❓ Type of change
📚 Description
The installation token cache from #525 kept the mint in flight in the isolate. A request that found no token awaited the mint another request had started. workerd ties a fetch to the request that made it. If that request answers before its mint finishes, workerd drops the mint, and the shared promise never settles. Its cache entry never cleared either. Every later request in the isolate that found no token then waited on it: until its deadline, or forever without one. opennextjs-aws#1218 and workers-sdk#12731 hit the same category.
What changes:
InstallationTokenCacheholds finished values only: a token with its expiry, and the failure window. Its type has no field for a promise.GithubCredential. Callers already create one per request, task, or queue batch throughresolveGithubBindingsandcreateArtifactBuildDependencies. Reads in one request still share one mint.One test changes on purpose: three requests that meet a failing App now make three mints, and still emit one report.