Skip to content

[auth] Cache federated token exchanges - #616

Open
cathleeny wants to merge 2 commits into
mainfrom
cathleeny/federation-token-cache
Open

cathleeny wants to merge 2 commits into
mainfrom
cathleeny/federation-token-cache

Conversation

@cathleeny

Copy link
Copy Markdown
Collaborator

Summary

Avoid an RFC 8693 exchange on every Thrift request by caching tokens in the federation provider, mirroring databricks/databricks-sql-nodejs#660. The same cache also applies to kernel requests once #610 routes them through this provider.

Changes

Reuse exchanged tokens until their subject changes or they near expiry, coalesce concurrent exchanges, and temporarily cache fallback tokens before retrying.

Tests

Build, vet, lint, default unit tests, and token-provider race tests passed. Kernel-tagged token-provider tests passed; no live or end-to-end tests were run.

This pull request and its description were written by Isaac.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@cathleeny
cathleeny marked this pull request as ready for review December 3, 2026 20:26

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Medium · 2 Low

Looks good, with 1 medium and 1 low concern. The cache, subject tracking and superseded-flight handling hold up under the tests. The weak spots are how cancellation propagates through the shared exchange and the expiry assumed for tokens the server doesn't date.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.

Comment thread auth/tokenprovider/exchange.go Resolved
Comment thread auth/tokenprovider/exchange.go Resolved
Comment thread auth/tokenprovider/exchange.go Resolved
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

This branch has not been deployed

No deployments
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.

1 participant