[glean-vnext] Reuse the DCR client instead of re-registering on setup and abandoned sign-ins - #5
Open
pragati-agrawal-glean wants to merge 1 commit into
Conversation
pragati-agrawal-glean
requested review from
eshwar-sundar-glean,
mohit-gupta-glean and
swarup-padhi-glean
July 30, 2026 07:20
pragati-agrawal-glean
force-pushed
the
pragati/fix-plugin-token-rotation-reauth
branch
from
July 30, 2026 10:49
c640b64 to
10b5eaa
Compare
… and abandoned sign-ins Port of gleanwork/glean-plugins-vnext#45 (stacked on the rotation fix). One user accumulated 34 registered clients: the server's DCR endpoint never dedupes and a 7-day sweeper reaps never-used clients (turning them into later invalid_client failures), while the plugin discarded its registration far too eagerly. Fixes: - setup({email}/{server_url}) only clears credentials when the resolved URL actually changed — re-running setup with the same instance was the dominant trigger (one new client per call). - Abandoned sign-ins keep the registration and retry it (abandonPendingSignIn budget); full re-registration only after two consecutive failures with the same client. - clientInformation() syncs from the shared store so concurrently starting sessions don't both register. - Registrations are logged ([auth] Registered OAuth client). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pragati-agrawal-glean
force-pushed
the
pragati/fix-plugin-dcr-client-reuse
branch
from
July 30, 2026 10:50
1cdaba8 to
59ece6f
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.
Port of gleanwork/glean-plugins-vnext#45, stacked on #4 (the rotation fix — uses its
syncTokensFromDiskrails). Full history and evidence on the vnext PR.Problem
One user accumulated 34 registered "Glean Claude Code Plugin" clients. Server-side, the DCR endpoint never dedupes (no user identity in scope at registration) and a 7-day sweeper deletes never-used clients — turning abandoned registrations into later
invalid_clientfailures. Client-side, the plugin discarded its registration far too eagerly; log correlation showed a fresh client_id 6–9s after everysetup.configured/setup.reset.Fixes
setup({email}/{server_url})only clears credentials when the resolved URL actually changed — re-running setup against the same instance (the dominant trigger, fed by the[SETUP_REQUIRED]→ agent-calls-setup loop) no longer burns the registration.abandonPendingSignInbudget); a fresh DCR happens only after two consecutive failures with the same client — the signature of a client actually rejected server-side.clientInformation()syncs from the shared store so concurrently-starting sessions don't both register.[auth] Registered OAuth client: <id>) — previously invisible.Verification
test:bundle211/211 ✓ (7 new tests),typecheck:bundle✓,build:bundle✓ (same node_modules caveat as [glean-vnext] Fix intermittent re-auth from cross-process refresh-token rotation #4 — CI authoritative).🤖 Generated with Claude Code