Uh oh!
There was an error while loading. Please reload this page.
remote/oidc: silent refresh + one-shot 401 retry on the attach path (T7) - #201
Merged
Conversation
This was referenced Jun 29, 2026
The query attach path becomes session-aware (LLP 0046 D5): - remote_verb.js resolves the bearer via resolveAccessJwt (not resolveToken), passing the origin-derived identity base. A stale cached JWT is refreshed and persisted before the call. - client.js tags a 401/403 rejection (authError + status) so the attach path can recognize it. On a live auth error for an oidc/file session, the attach path forces a single refresh and retries once; an env override or static token is surfaced as-is (nothing to refresh). - A refresh that fails invalid_grant surfaces "remote session expired - re-run 'hyp remote login <target>'". - resolveAccessJwt gains forceRefresh for the retry; deriveIdentityBase moves to credentials.js as the shared home for the login command and the attach path (single D6 definition). Tests: a stale stored JWT refreshes + persists pre-call; a mid-flight 401 triggers exactly one refresh + retry; invalid_grant maps to re-login guidance; a static 401 is not retried. Full suite green (1527).
platypii
commented
Jun 29, 2026
ContributorAuthor
Review (independent agent review)Verdict: request-changes → addressed. The silent-refresh and one-shot 401 retry are well-structured: retry is exactly once (no loop), Finding (major)
Addressed in this PR
(This fix was originally delivered in the T8 follow-up; it has been relocated here so #201 is correct standalone.) 11 tests green, typecheck clean. |
…01 retry) Review follow-up (PR #201): the initial resolveAccessJwt can itself refresh (and throw invalid_grant) when the stored JWT is already stale, which escaped as an unhandled rejection. Wrap it and map via a shared mapRefreshError helper, exactly like the mid-flight 401 retry path. Added a stale-JWT pre-call-refresh-fails unit test.
platypiiforce-pushed
the
chunk5-attach-refresh
branch
from
June 29, 2026 18:45
e6211c1 to
f6f80d9CompareUh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Chunk 5 of the OIDC client login (LLP 0046-0048), milestone 3. Stacked on #200 (base
chunk4-login-command); review/merge after #197-#200.What (LLP 0046 D5)
remote_verb.jsresolves the bearer viaresolveAccessJwt(notresolveToken), passing the origin-derived identity base; a stale cached JWT is refreshed + persisted before the call.client.jstags 401/403 rejections (authError,status). On a live auth error for an oidc/file session, the attach path forces one refresh and retries once; an env override / static token is surfaced as-is.invalid_grantsurfacesremote session expired - re-run 'hyp remote login <target>'.resolveAccessJwtgainsforceRefresh;deriveIdentityBaserelocated tocredentials.jsas the single shared D6 definition (login command + attach path both import it).Tests
remote-verb-oidc.test.js(4): stale-refresh-before-call, exactly-one mid-flight refresh+retry, invalid_grant -> re-login, static-not-retried. Fullnpm testgreen (1527 pass); typecheck clean.🤖 Generated with Claude Code