Skip to content

[Bounty $35] Coordinate concurrent token refreshes across tabs - #22

Open
ahdaolma wants to merge 1 commit into
shaiananvari8:mainfrom
ahdaolma:codex/single-flight-auth-refresh-20260914
Open

ahdaolma wants to merge 1 commit into
shaiananvari8:mainfrom
ahdaolma:codex/single-flight-auth-refresh-20260914

Conversation

@ahdaolma

@ahdaolma ahdaolma commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Closes #1. Add single-flight token refresh coordination and cross-tab lifecycle propagation without logging or persisting raw tokens in notification payloads.

Changes

  • Share one in-flight refresh promise per tab and clear the marker after both success and failure.
  • Propagate success/failure through BroadcastChannel, with a storage-event metadata fallback.
  • Reload successful tokens from the existing token store in other tabs and avoid cross-tab overwrites during a local refresh.
  • Add npm run validate:auth-refresh, a deterministic invariant check for the race and cleanup paths.

Testing

  • npm run validate:auth-refresh ✅ (8 invariants)
  • npm run build
  • python3 build.py ⚠️ the repository's launcher is unavailable on this Windows host. The bundled Python runtime was also tried with UTF-8 output; its prerequisite scan reached the encryptly diagnostic preflight but did not finish within the available run window, so no new diagnostic artifact was generated.

No raw access or refresh tokens are written to the cross-tab event record or logs.

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.

[$35 BOUNTY] [TypeScript] Add single-flight token refresh handling

1 participant