Skip to content

Commit ad8763d

Browse files
authored
assistant: update provider setting tags and default enabled providers (#12955) (#12973)
_Cherry-picked from https://github.com/posit-dev/positron/pull/12955_ - Addresses #12954 - Diff is long, due to reordering of the settings to match the order on the docs site posit-dev/positron-website#327 (msfoundry after snowflake) ### Release Notes #### Bug Fixes - Assistant: update provider settings tags and default enabled providers (#12954) ### QA Notes Foundry-related settings are now visible by default, with the enablement setting tagged as Preview (matches other preview providers). <img width="992" height="715" alt="image" src="https://github.com/user-attachments/assets/5297e99f-592c-4277-9e60-194f1851b3c1" /> Additional changes - Removed preview tags from Bedrock, Snowflake, OpenAI - Kept Copilot, Foundry at preview - Changed Posit AI from experimental to preview - Removed advanced tags from Posit AI preference/override settings - Enabled Bedrock, Snowflake, OpenAI by default - Conditionally enabled Posit AI by default - enabled by default on desktop - disabled by default on PWB (uses globalState to apply PWB-specific default on first run; users can still toggle the setting on either platform)
1 parent c549456 commit ad8763d

2 files changed

Lines changed: 96 additions & 65 deletions

File tree

extensions/positron-assistant/package.json

Lines changed: 41 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,11 @@
473473
"default": "",
474474
"markdownDescription": "%configuration.models.preference.snowflakeCortex.description%"
475475
},
476+
"positron.assistant.models.preference.msFoundry": {
477+
"type": "string",
478+
"default": "",
479+
"markdownDescription": "%configuration.models.preference.msFoundry.description%"
480+
},
476481
"positron.assistant.models.preference.openAI": {
477482
"type": "string",
478483
"default": "",
@@ -486,18 +491,7 @@
486491
"positron.assistant.models.preference.positAI": {
487492
"type": "string",
488493
"default": "",
489-
"markdownDescription": "%configuration.models.preference.positAI.description%",
490-
"tags": [
491-
"advanced"
492-
]
493-
},
494-
"positron.assistant.models.preference.msFoundry": {
495-
"type": "string",
496-
"default": "",
497-
"markdownDescription": "%configuration.models.preference.msFoundry.description%",
498-
"tags": [
499-
"advanced"
500-
]
494+
"markdownDescription": "%configuration.models.preference.positAI.description%"
501495
},
502496
"positron.assistant.models.preference.google": {
503497
"type": "string",
@@ -633,10 +627,10 @@
633627
]
634628
]
635629
},
636-
"positron.assistant.models.overrides.openAI": {
630+
"positron.assistant.models.overrides.msFoundry": {
637631
"type": "array",
638632
"default": [],
639-
"markdownDescription": "%configuration.models.overrides.openAI.description%",
633+
"markdownDescription": "%configuration.models.overrides.msFoundry.description%",
640634
"items": {
641635
"type": "object",
642636
"properties": {
@@ -663,20 +657,12 @@
663657
"name",
664658
"identifier"
665659
]
666-
},
667-
"examples": [
668-
[
669-
{
670-
"name": "GPT-4o",
671-
"identifier": "gpt-4o"
672-
}
673-
]
674-
]
660+
}
675661
},
676-
"positron.assistant.models.overrides.customProvider": {
662+
"positron.assistant.models.overrides.openAI": {
677663
"type": "array",
678664
"default": [],
679-
"markdownDescription": "%configuration.models.overrides.customProvider.description%",
665+
"markdownDescription": "%configuration.models.overrides.openAI.description%",
680666
"items": {
681667
"type": "object",
682668
"properties": {
@@ -707,21 +693,16 @@
707693
"examples": [
708694
[
709695
{
710-
"name": "Claude Sonnet 4.5 via OpenRouter",
711-
"identifier": "anthropic/claude-sonnet-4.5",
712-
"maxInputTokens": 200000,
713-
"maxOutputTokens": 8192
696+
"name": "GPT-4o",
697+
"identifier": "gpt-4o"
714698
}
715699
]
716700
]
717701
},
718-
"positron.assistant.models.overrides.positAI": {
702+
"positron.assistant.models.overrides.customProvider": {
719703
"type": "array",
720704
"default": [],
721-
"markdownDescription": "%configuration.models.overrides.positAI.description%",
722-
"tags": [
723-
"advanced"
724-
],
705+
"markdownDescription": "%configuration.models.overrides.customProvider.description%",
725706
"items": {
726707
"type": "object",
727708
"properties": {
@@ -748,15 +729,22 @@
748729
"name",
749730
"identifier"
750731
]
751-
}
732+
},
733+
"examples": [
734+
[
735+
{
736+
"name": "Claude Sonnet 4.5 via OpenRouter",
737+
"identifier": "anthropic/claude-sonnet-4.5",
738+
"maxInputTokens": 200000,
739+
"maxOutputTokens": 8192
740+
}
741+
]
742+
]
752743
},
753-
"positron.assistant.models.overrides.msFoundry": {
744+
"positron.assistant.models.overrides.positAI": {
754745
"type": "array",
755746
"default": [],
756-
"markdownDescription": "%configuration.models.overrides.msFoundry.description%",
757-
"tags": [
758-
"advanced"
759-
],
747+
"markdownDescription": "%configuration.models.overrides.positAI.description%",
760748
"items": {
761749
"type": "object",
762750
"properties": {
@@ -843,57 +831,46 @@
843831
},
844832
"positron.assistant.provider.amazonBedrock.enable": {
845833
"type": "boolean",
846-
"default": false,
834+
"default": true,
847835
"markdownDescription": "%configuration.provider.amazonBedrock.enable.description%",
848-
"tags": [
849-
"preview"
850-
],
851836
"order": 3
852837
},
853838
"positron.assistant.provider.snowflakeCortex.enable": {
854839
"type": "boolean",
855-
"default": false,
840+
"default": true,
856841
"markdownDescription": "%configuration.provider.snowflakeCortex.enable.description%",
857-
"tags": [
858-
"preview"
859-
],
860842
"order": 4
861843
},
862-
"positron.assistant.provider.openAI.enable": {
844+
"positron.assistant.provider.msFoundry.enable": {
863845
"type": "boolean",
864846
"default": false,
865-
"markdownDescription": "%configuration.provider.openAI.enable.description%",
847+
"markdownDescription": "%configuration.provider.msFoundry.enable.description%",
866848
"tags": [
867849
"preview"
868850
],
869851
"order": 5
870852
},
853+
"positron.assistant.provider.openAI.enable": {
854+
"type": "boolean",
855+
"default": true,
856+
"markdownDescription": "%configuration.provider.openAI.enable.description%",
857+
"order": 6
858+
},
871859
"positron.assistant.provider.customProvider.enable": {
872860
"type": "boolean",
873861
"default": false,
874862
"markdownDescription": "%configuration.provider.customProvider.enable.description%",
875863
"tags": [
876864
"experimental"
877865
],
878-
"order": 6
866+
"order": 7
879867
},
880868
"positron.assistant.provider.positAI.enable": {
881869
"type": "boolean",
882-
"default": false,
870+
"default": true,
883871
"markdownDescription": "%configuration.provider.positAI.enable.description%",
884872
"tags": [
885-
"experimental",
886-
"advanced"
887-
],
888-
"order": 7
889-
},
890-
"positron.assistant.provider.msFoundry.enable": {
891-
"type": "boolean",
892-
"default": false,
893-
"markdownDescription": "%configuration.provider.msFoundry.enable.description%",
894-
"tags": [
895-
"experimental",
896-
"advanced"
873+
"preview"
897874
],
898875
"order": 8
899876
},

extensions/positron-assistant/src/extension.ts

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,64 @@ async function initializeProviderConfiguration(context: vscode.ExtensionContext)
249249
// 2. Perform settings migrations (provider enablement, model preferences, custom models)
250250
await performSettingsMigrations();
251251

252-
// 3. Validate that at least one provider is enabled
252+
// 3. Apply PWB-specific provider defaults
253+
await applyPwbProviderDefaults(context);
254+
255+
// 4. Validate that at least one provider is enabled
253256
await validateProvidersEnabled();
254257
}
255258

259+
/**
260+
* Apply PWB-specific provider defaults.
261+
*
262+
* On Posit Workbench, Posit AI should default to disabled, but users and admins
263+
* can still configure it. Since package.json doesn't support conditional defaults,
264+
* we use globalState to track whether we've applied the PWB default. This ensures:
265+
* - First run on PWB: Posit AI is disabled (unless already configured)
266+
* - Admin configures via policy: their choice is respected because we can't overwrite admin policies
267+
* - User changes the setting: their choice is preserved
268+
* - Subsequent runs: we don't overwrite existing choices
269+
*
270+
* See: https://github.com/posit-dev/positron/issues/12954
271+
*/
272+
async function applyPwbProviderDefaults(context: vscode.ExtensionContext): Promise<void> {
273+
if (!IS_RUNNING_ON_PWB) {
274+
return;
275+
}
276+
277+
const pwbDefaultAppliedKey = 'positAI.pwbDefaultApplied';
278+
const pwbDefaultApplied = context.globalState.get<boolean>(pwbDefaultAppliedKey);
279+
280+
if (!pwbDefaultApplied) {
281+
const config = vscode.workspace.getConfiguration('positron.assistant.provider.positAI');
282+
const currentValue = config.get<boolean>('enable');
283+
284+
// If already disabled (by admin policy, user, or any other means), nothing to do
285+
if (currentValue !== false) {
286+
const enableInspect = config.inspect<boolean>('enable');
287+
288+
// Only apply default if no one has explicitly configured this setting.
289+
// Admin policy values aren't exposed via inspect(), but if an admin
290+
// enforced a policy, the update will fail and we catch it below.
291+
const hasExplicitValue = enableInspect?.globalValue !== undefined ||
292+
enableInspect?.workspaceValue !== undefined ||
293+
enableInspect?.workspaceFolderValue !== undefined;
294+
295+
if (!hasExplicitValue) {
296+
try {
297+
await config.update('enable', false, vscode.ConfigurationTarget.Global);
298+
} catch (e) {
299+
// Setting may be enforced by admin policy; log and continue
300+
log.warn(`Posit AI enablement enforced by admin policy and cannot be updated: ${e instanceof Error ? e.message : String(e)}`);
301+
}
302+
}
303+
}
304+
305+
// Always mark as applied so we don't retry
306+
await context.globalState.update(pwbDefaultAppliedKey, true);
307+
}
308+
}
309+
256310
async function reconcileAuthProviderModels(
257311
context: vscode.ExtensionContext,
258312
providerId: string,

0 commit comments

Comments
 (0)