Skip to content

Mint a fresh GitHub App token for each Satis build - #599

Merged
simonhamp merged 2 commits into
mainfrom
satis-fresh-token
Nov 3, 2026
Merged

simonhamp merged 2 commits into
mainfrom
satis-fresh-token

Conversation

@simonhamp

@simonhamp simonhamp commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Satis builds now get a newly minted GitHub App installation token instead of the cached one.

Installation tokens last an hour and GitHubAppService::getInstallationToken caches them for 55 minutes, so a build could be sent a token with about five minutes left. Satis stores the token in its queue payload and only uses it when a worker clones the repo. A short backlog is enough for the clone to fail with "Invalid username or token". That's the most likely cause of a paid plugin build that failed this week, though I haven't matched it against the production logs yet.

buildForPlugin now mints a token, which covers push builds and satis:build. SyncPluginReleases does the same when it's going to trigger a build for a paid plugin, since it hands its token to the build. Other GitHub calls keep using the cache. Minting also updates the cache, so later lookups get the newer token.

Things to watch:

  • If minting fails, resolution moves on to the owner's token and then the platform token, the same as when there's no installation token today. It doesn't fall back to the cached token.
  • Each build makes one extra call to GitHub's access tokens endpoint. Push builds are debounced, so that should be small.
  • A build that waits more than an hour in the Satis queue can still have its token expire. satis:build for every plugin mints all the tokens up front, so a long run is the case to keep an eye on.

After deploying, rerun the build for any plugin that failed with "Invalid username or token".

New tests are in SatisBuildTokenTest, and the full suite passes locally.

There's also a one-line whitespace fix in Plugin.php. A blank line there picked up two spaces in #480, which has failed Pint on main and on every PR since.

🤖 Generated with Claude Code

Installation tokens last an hour and we cache them for 55 minutes, so a
build could be sent a token with only a few minutes left. Satis keeps the
token in its queue until a worker clones with it, so a short backlog is
enough for the clone to fail with "Invalid username or token".

Builds, and release syncs that are going to trigger one, now mint a new
installation token. Everything else keeps using the cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp marked this pull request as ready for review November 3, 2026 21:25
A blank line in Plugin.php picked up two spaces in #480, which has failed
the lint check on main and every PR since.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp merged commit 7728825 into main Nov 3, 2026
3 checks passed
@simonhamp
simonhamp deleted the satis-fresh-token branch November 3, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant