Repository navigation
fix: log WARN on transient Railway token-refresh failures and continue with stored token #SUPERLOG - #531
Open
superlog-app[bot] wants to merge 1 commit into
Conversation
…e with stored token #SUPERLOG Delivery-Id: 991474e0af8c48e457b92283fcd6ae37a5c8556eec5e2be359902ebfbcb38ebe Delivery-Base: main
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.
Summary
When Railway's OAuth token endpoint returns a transient non-JSON response (
invalid_response) or aserver_error, the worker was logging ERROR and skipping the entire installation for that pass — even though the stored access token is still valid for up to 5 more minutes (refresh fires whenexpiresAt - now() < 5 min).This is a third recurrence of the same defect (incidents yeasty-skunk, wandering-porcupine, and now quiet-walrus). Two previous fix PRs (#440, #471) prescribed the same change but were both closed without merging.
Root cause
In
apps/worker/src/railway/puller.ts, the token-refresh failure path calleddeps.log.error(...)andreturn'd unconditionally, discarding the remaining valid-token window:Remediation
expiresAt <= now()(token is truly expired); otherwise continue the pass with the stored access token.accessToken = refreshed.accessTokenandsaveTokens(...)into theelsebranch so they only run on success.All 8 tests pass:
pnpm tsx --test apps/worker/src/railway/puller.test.tsFixes incident quiet-walrus (22394ecc-55dd-4554-af1b-d51d7689b80b).
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Fixes the Railway puller skipping installations when a token refresh fails transiently. Previously any refresh failure logged ERROR and aborted the pass, even though the stored access token is valid for up to 5 more minutes. The puller now logs WARN and continues with the stored token when it hasn't expired. This is the third occurrence of this defect, after two earlier fix PRs were closed without merging.
expiresAthas passed; token assignment andsaveTokensnow run only on successful refresh.Written for commit 63ad3af. Summary will update on new commits.