Persist OAuth project scope - #216
Open
masnwilliams wants to merge 5 commits into
Open
Conversation
hiroTamada
approved these changes
Aug 6, 2026
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.
summary
kernel authtests
go test ./...go vet ./...go build ./...dependency
Pairs with kernel/kernel-mcp-server#138. The fields are optional, so this remains compatible with the currently deployed OAuth server.
Note
Medium Risk
Changes authentication token handling and stored credential shape; behavior is backward-compatible for legacy tokens but affects how API requests are scoped after login/refresh.
Overview
OAuth login now stores
access_scopeandproject_idfrom the authorization server (including values carried in OAuth state and token/refresh responses), saves them in keychain-backedTokenStorage, and keeps scope across token refresh. Tokens without scope metadata are treated as organization-wide; org-wide scope clears any stored project id.kernel authprints whether the session is organization-wide or locked to a project. README documents org vs project login atkernel loginand documents the global--projectflag for org-wide credentials (project-scoped tokens cannot switch projects).Tests cover code exchange preferring server scope over state, refresh preserving project scope, and legacy refresh defaulting to organization-wide.
Reviewed by Cursor Bugbot for commit d766967. Bugbot is set up for automated code reviews on this repo. Configure here.