Repository navigation
Conversation
This was referenced Oct 20, 2026
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 20, 2026 14:32
ef9fbfd to
d456640
Compare
Base automatically changed from
feat/auth-refresh-callback
to
feat/dev-750-platform-api-keys
October 20, 2026 14:32
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 20, 2026 16:16
d456640 to
65cf711
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 20, 2026 16:35
65cf711 to
6ee0888
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
2 times, most recently
from
October 21, 2026 08:17
a397b25 to
d0a23a9
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 21, 2026 08:52
d0a23a9 to
07d3c80
Compare
kartojal
marked this pull request as ready for review
October 21, 2026 08:56
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 21, 2026 09:12
07d3c80 to
ec3d5ed
Compare
Merged
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 22, 2026 11:21
ec3d5ed to
fa3daee
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fa3daee. Configure here.
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 22, 2026 14:39
b0ed443 to
9f02b98
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 22, 2026 15:28
9f02b98 to
9e438da
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 22, 2026 17:03
9e438da to
eff16ac
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 23, 2026 12:08
eff16ac to
77fa5cc
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 23, 2026 13:19
77fa5cc to
5bbed26
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
2 times, most recently
from
October 26, 2026 08:28
51f2bcf to
5bbed26
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
October 27, 2026 17:54
4af58a4 to
0711aa6
Compare
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
2 times, most recently
from
November 2, 2026 16:55
79e3725 to
79af214
Compare
Only network and 5xx refresh failures block a logout-only refresh; a rate limit or 4xx rejection leaves the refresh token unused, so logout refreshes once and revokes. Restore the refreshing guard, make the closed-session test meaningful, describe the outcome in the migration doc, and drop the internal changeset.
kartojal
force-pushed
the
feat/auth-refresh-coalescing
branch
from
November 3, 2026 17:52
79af214 to
791cf76
Compare
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.

Coalesces refresh consumers and keeps logout safe during token rotation, including retry backoff after an uncertain refresh outcome.
Fresh-token requests and late 401 recovery await the accepted shared rotation. Logout closes local consumers, retains the latest started rotation outcome for revocation, and does not adopt or persist logout-only credentials. A possibly consumed refresh token is not resubmitted. Valid-bearer revocation, cancellation isolation and deterministic timer cleanup are preserved.
Rebased onto #438, retaining automatic L2 migration, plain bearer credentials and signer-only restoration from #437. Resolved the logout documentation conflict without reintroducing obsolete L2-client behavior.
Inherits #437's setup-failure session revocation and deferred new-session credential notifications. The stack was rebased with regression coverage for routed wallet deployment failures and #441's rotation-aware logout.
Stack: #442 → #481 → #437 → #463 → #438 → #441.
Restacked on 2026-11-02 with the current retry/transport ancestry and #463 Gateway routing corrections. Existing plain bearer credentials, automatic migration and signer-only restoration are retained.
Combined stack validation on 2026-11-02: build, lint, workspace typecheck, browser bundle check, 415 bindings tests and 1,159 client tests passed (1,574 total, no type errors). Failure-path coverage uses controlled responses. Live production checks additionally passed for an existing Deposit Wallet: signed login, automatic saved-L2 migration without signing, authenticated order/trade/notification/trading-status/balance-allowance reads, bearer restoration/refresh, and logout with rejected refresh reuse. No trading, transfers, approvals or wallet deployment were performed.
Gateway heartbeat compatibility remains blocked as documented in #463. Human approval and outstanding review threads have not been resolved automatically.
Note
High Risk
Changes core session token rotation and logout semantics, including refresh-token reuse rules and race handling that affect every authenticated client lifecycle.
Overview
Auth session refresh and logout are tightened so concurrent callers share one rotation and logout stays safe when a refresh is in flight or in retry backoff.
ready()andrecover()now join an active refresh (including while the access token is still fresh), andrefresh()installs the shared promise before the refresh callback runs so synchronous re-entry cannot start a second rotation. Each network attempt is tracked via#refreshRequestso logout can await the in-flight result for revocation only—without adopting tokens, firingonCredentialsChanged, or re-submitting a refresh that may already have consumed the refresh token.Logout closes local consumers immediately (
#stop(false)) instead of aborting rotation up front, then chooses revoke vs one explicit refresh forexpired_access_tokenbased on whether further refresh is still allowed after uncertain or definite failures.close()still aborts in-flight renewal; closing before#renewruns skips the callback entirely.The authentication migration doc logout section is updated to describe drain-on-logout, uncertain-outcome behavior, and immediate local shutdown.
session.test.tsadds regression coverage for coalescing, logout drain, no replay during backoff/uncertainty, and revocation after a failed refresh attempt.Reviewed by Cursor Bugbot for commit 791cf76. Bugbot is set up for automated code reviews on this repo. Configure here.