[SCAL-327336] Fix org tools disappearing after token expiry: reconcile token before getSessionInfo - #199
Open
rohitthughtspot wants to merge 1 commit into
Open
[SCAL-327336] Fix org tools disappearing after token expiry: reconcile token before getSessionInfo#199rohitthughtspot wants to merge 1 commit into
rohitthughtspot wants to merge 1 commit into
Conversation
…e token before getSessionInfo sessionInfo is fetched once at init via getSessionInfo(). Previously that ran before the keep-warm global token was reconciled from the token-store DO, so on a cold-start reconnect after the frozen props access token expired (~24h), getSessionInfo authenticated with the dead token, failed, and left sessionInfo null for the DO's lifetime — silently hiding list_orgs/switch_org and mis-gating feature flags, even though the DO still held a valid kept-warm token. - Reorder: a preInit() hook reconciles the global token from the token-store DO before initializeService()/getSessionInfo, so the init fetch authenticates with the kept-warm token and sessionInfo is populated correctly at connect. - ensureSessionInfo(): fallback in listTools that refetches session info if it's still null (e.g. a transient init failure), guarded by an in-flight promise so concurrent list calls share one fetch (no duplicate getSessionInfo / tracker). - isOrgsEnabled() defaults to true when sessionInfo is absent so org tools stay visible in the brief window before the refetch completes. - callTool reconciles the global token per call keyed on the absence of an active org token, so a data call always gets a fresh global token when no org token drives it. - Extract postInit's active-org bootstrap into ensureActiveOrg(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rohitthughtspot
force-pushed
the
fix/sessioninfo-reorder-repair
branch
from
August 5, 2026 18:10
df60ccb to
ee90ad1
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.
SCAL-327336
Problem
After a cold-start reconnect (~24h, once the frozen props access token has expired),
list_orgs/switch_orgdisappear and feature-flag gating misbehaves — even though the keep-warm token is still valid.Cause
sessionInfois fetched once at init viagetSessionInfo(), which previously ran beforepostInitreconciled the keep-warm global token from the token-store DO. On a post-expiry reconnect the init fetch authenticated with the dead frozen props token, failed, and leftsessionInfonull for the DO's lifetime. Org-tool visibility and flag gating readsessionInfo, so they silently degraded — while the DO still held a valid token (data calls, which reconcile the DO token at call time, kept working).Fix
preInit()hook reconciles the global token from the token-store DO beforeinitializeService()/getSessionInfo, so the init fetch uses the kept-warm token andsessionInfopopulates correctly.ensureSessionInfo()— fallback inlistToolsthat refetches session info if it's still null (e.g. a transient init failure), guarded by an in-flight promise so concurrent list calls share one fetch (no duplicategetSessionInfo/ MixpanelTracker).isOrgsEnabled()defaults to true whensessionInfois absent, so org tools stay visible in the brief window before the refetch completes.callToolreconciles the global token per call keyed on the absence of an active org token.postInit's active-org bootstrap intoensureActiveOrg().Test
Regression test reproduces the failure (init
getSessionInfofails on an expired props token; DO holds a valid token) and asserts the repair restoressessionInfoand the org tools. Full suite passes (695 tests).Supersedes #184 (rebased onto latest main as a single clean commit).
🤖 Generated with Claude Code