Skip to content

Migrate Posit AI auth from Assistant to Authentication#12681

Open
melissa-barca wants to merge 6 commits intomainfrom
feature/posit-ai
Open

Migrate Posit AI auth from Assistant to Authentication#12681
melissa-barca wants to merge 6 commits intomainfrom
feature/posit-ai

Conversation

@melissa-barca
Copy link
Copy Markdown
Contributor

@melissa-barca melissa-barca commented Mar 24, 2026

Next piece of #12374

Migrates Posit AI oauth from Positron Assistant to the Authentication extension. The settings changed from positron.assistant.positai to authentication.positai, but since they have not been formally declared they cannot be migrated.

QA Notes

Sign in/Sign out for Posit AI should continue to work without interruption, but model resolution will now happen after the Configure Language Model Provider modal is closed and auth information will be logged to Authentication.

@:assistant

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:assistant

readme  valid tags

@melissa-barca melissa-barca changed the title Feature/posit ai Migrate Posit AI auth from Assistant to Authentication Mar 24, 2026
Move the OAuth 2.0 Device Authorization Grant flow for Posit AI from
positron-assistant into the centralized authentication extension.

- Add PositOAuthProvider implementing vscode.AuthenticationProvider
  with device code flow, token refresh, and cancellation support
- Route oauth-signin/oauth-signout through createSession/removeSession
- Widen authProviders map to vscode.AuthenticationProvider to support
  both AuthProvider (API key) and PositOAuthProvider (OAuth)
- Update positron-assistant to consume tokens via vscode.authentication
- Register posit-ai in trustedExtensionAuthAccess
The oauth-signin and oauth-signout cases for copilot-auth were
accidentally removed when migrating Posit AI OAuth to the auth
extension.
PositOAuthProvider now extends the generic AuthProvider class instead of
implementing vscode.AuthenticationProvider directly. This lets the config
dialog treat it uniformly alongside API-key and credential-chain
providers using hasAuthProvider boolean checks instead of instanceof.

- Make AuthProvider.context protected and add fireSessionsChanged()
- Revert configDialog.ts map type to Map<string, AuthProvider>
- Revert handleSave/handleDelete to look up providers internally
handleSave already calls createSession when no API key is present, and
handleDelete already removes all sessions. No need to duplicate that
logic in the oauth cases.
Keep only getAccessToken tests which cover the meaningful token refresh
logic. The removed tests just verified delegation to the base class.
@melissa-barca melissa-barca marked this pull request as ready for review March 27, 2026 18:18
Copy link
Copy Markdown
Contributor

@georgestagg georgestagg left a comment

Choose a reason for hiding this comment

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

LGTM!

),
provider
);
registerAuthProvider(POSIT_AUTH_PROVIDER_ID, provider);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: Here the provider ID is a constant, but above (e.g. 'anthropic-api') IDs are just used inline.

I know this has just come from the older code, and it does not matter for behaviour, but we should probably try to be consistent either way.

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.

2 participants