Elffuss BraidHub

kikocis/continue public

Merge pull request #7409 from Jazzcort/fix-ideSettings-updating

Fix: Updated ideSettings didn't get passed properly
Changeset58c9397d0f2dcd3dfdb0feb6979eec41ba44499e9057c4007852fe6b3492baa8
AuthorDallin Romney <dallinromney@gmail.com> · 2025-09-08 21:13 -07:00
CommitterGitHub <noreply@github.com> · 2025-09-08 21:13 -07:00
Parentsd84bb2249dcd, 424fb7319bf7

Browse the files at this changeset

8 files changed

modified core/config/ConfigHandler.ts +13 −19
@@ -59,27 +59,17 @@
5959
6060 constructor(
6161 private readonly ide: IDE,
62- private ideSettingsPromise: Promise<IdeSettings>,
6362 private llmLogger: ILLMLogger,
64- sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
63+ initialSessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
6564 ) {
66- this.ide = ide;
67- this.ideSettingsPromise = ideSettingsPromise;
68-
6965 this.controlPlaneClient = new ControlPlaneClient(
70- sessionInfoPromise,
71- ideSettingsPromise,
72- this.ide.getIdeInfo(),
66+ initialSessionInfoPromise,
67+ this.ide,
7368 );
7469
7570 // This profile manager will always be available
7671 this.globalLocalProfileManager = new ProfileLifecycleManager(
77- new LocalProfileLoader(
78- ide,
79- ideSettingsPromise,
80- this.controlPlaneClient,
81- this.llmLogger,
82- ),
72+ new LocalProfileLoader(ide, this.controlPlaneClient, this.llmLogger),
8373 this.ide,
8474 );
8575
@@ -97,6 +87,7 @@
9787 }
9888
9989 private workspaceDirs: string[] | null = null;
90+
10091 async getWorkspaceId() {
10192 if (!this.workspaceDirs) {
10293 this.workspaceDirs = await this.ide.getWorkspaceDirs();
@@ -113,6 +104,13 @@
113104 const signal = this.cascadeAbortController.signal;
114105 this.workspaceDirs = null; // forces workspace dirs reload
115106
107+ // Always update globalLocalProfileManager before recreating all the loaders
108+ // during every cascadeInit so it holds the most recent controlPlaneClient.
109+ this.globalLocalProfileManager = new ProfileLifecycleManager(
110+ new LocalProfileLoader(this.ide, this.controlPlaneClient, this.llmLogger),
111+ this.ide,
112+ );
113+
116114 try {
117115 const { orgs, errors } = await this.getOrgs();
118116
@@ -248,7 +246,6 @@
248246 versionSlug: assistant.configResult.config?.version ?? "latest",
249247 controlPlaneClient: this.controlPlaneClient,
250248 ide: this.ide,
251- ideSettingsPromise: this.ideSettingsPromise,
252249 llmLogger: this.llmLogger,
253250 rawYaml: assistant.rawYaml,
254251 orgScopeId: orgScopeId,
@@ -369,7 +366,6 @@
369366 const profiles = [...assistantFiles, ...agentFiles].map((assistant) => {
370367 return new LocalProfileLoader(
371368 this.ide,
372- this.ideSettingsPromise,
373369 this.controlPlaneClient,
374370 this.llmLogger,
375371 assistant,
@@ -394,7 +390,6 @@
394390
395391 // Ide settings change: refresh session and cascade refresh from the top
396392 async updateIdeSettings(ideSettings: IdeSettings) {
397- this.ideSettingsPromise = Promise.resolve(ideSettings);
398393 this.abortCascade();
399394 await this.cascadeInit("IDE settings update");
400395 }
@@ -432,8 +427,7 @@
432427 if (reload) {
433428 this.controlPlaneClient = new ControlPlaneClient(
434429 Promise.resolve(sessionInfo),
435- this.ideSettingsPromise,
436- this.ide.getIdeInfo(),
430+ this.ide,
437431 );
438432 this.abortCascade();
439433 await this.cascadeInit("Control plane session info update");
modified core/config/profile/LocalProfileLoader.ts +1 −3
@@ -1,7 +1,7 @@
11 import { ConfigResult, parseConfigYaml } from "@continuedev/config-yaml";
22
33 import { ControlPlaneClient } from "../../control-plane/client.js";
4-import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
4+import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
55 import { ProfileDescription } from "../ProfileLifecycleManager.js";
66
77 import { getPrimaryConfigFilePath } from "../../util/paths.js";
@@ -15,7 +15,6 @@
1515
1616 constructor(
1717 private ide: IDE,
18- private ideSettingsPromise: Promise<IdeSettings>,
1918 private controlPlaneClient: ControlPlaneClient,
2019 private llmLogger: ILLMLogger,
2120 private overrideAssistantFile?:
@@ -57,7 +56,6 @@
5756 async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
5857 const result = await doLoadConfig({
5958 ide: this.ide,
60- ideSettingsPromise: this.ideSettingsPromise,
6159 controlPlaneClient: this.controlPlaneClient,
6260 llmLogger: this.llmLogger,
6361 profileId: this.description.id,
modified core/config/profile/PlatformProfileLoader.ts +2 −10
@@ -2,7 +2,7 @@
22
33 import { ControlPlaneClient } from "../../control-plane/client.js";
44 import { getControlPlaneEnv } from "../../control-plane/env.js";
5-import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
5+import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
66 import { ProfileDescription } from "../ProfileLifecycleManager.js";
77
88 import doLoadConfig from "./doLoadConfig.js";
@@ -28,7 +28,6 @@
2828 private readonly versionSlug: string;
2929 private readonly controlPlaneClient: ControlPlaneClient;
3030 private readonly ide: IDE;
31- private ideSettingsPromise: Promise<IdeSettings>;
3231 private llmLogger: ILLMLogger;
3332 readonly description: ProfileDescription;
3433 private readonly orgScopeId: string | null;
@@ -41,7 +40,6 @@
4140 versionSlug,
4241 controlPlaneClient,
4342 ide,
44- ideSettingsPromise,
4543 llmLogger,
4644 description,
4745 orgScopeId,
@@ -53,7 +51,6 @@
5351 versionSlug: string;
5452 controlPlaneClient: ControlPlaneClient;
5553 ide: IDE;
56- ideSettingsPromise: Promise<IdeSettings>;
5754 llmLogger: ILLMLogger;
5855 description: ProfileDescription;
5956 orgScopeId: string | null;
@@ -65,7 +62,6 @@
6562 this.versionSlug = versionSlug;
6663 this.controlPlaneClient = controlPlaneClient;
6764 this.ide = ide;
68- this.ideSettingsPromise = ideSettingsPromise;
6965 this.llmLogger = llmLogger;
7066 this.description = description;
7167 this.orgScopeId = orgScopeId;
@@ -79,7 +75,6 @@
7975 versionSlug,
8076 controlPlaneClient,
8177 ide,
82- ideSettingsPromise,
8378 llmLogger,
8479 rawYaml,
8580 orgScopeId,
@@ -91,12 +86,11 @@
9186 versionSlug: string;
9287 controlPlaneClient: ControlPlaneClient;
9388 ide: IDE;
94- ideSettingsPromise: Promise<IdeSettings>;
9589 llmLogger: ILLMLogger;
9690 rawYaml: string;
9791 orgScopeId: string | null;
9892 }): Promise<PlatformProfileLoader> {
99- const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise);
93+ const controlPlaneEnv = await getControlPlaneEnv(ide.getIdeSettings());
10094
10195 const description: ProfileDescription = {
10296 id: `${ownerSlug}/${packageSlug}`,
@@ -121,7 +115,6 @@
121115 versionSlug,
122116 controlPlaneClient,
123117 ide,
124- ideSettingsPromise,
125118 llmLogger,
126119 description,
127120 orgScopeId,
@@ -139,7 +132,6 @@
139132
140133 const results = await doLoadConfig({
141134 ide: this.ide,
142- ideSettingsPromise: this.ideSettingsPromise,
143135 controlPlaneClient: this.controlPlaneClient,
144136 llmLogger: this.llmLogger,
145137 overrideConfigYaml: this.configResult.config,
modified core/config/profile/doLoadConfig.ts +2 −5
@@ -11,7 +11,6 @@
1111 import {
1212 ContinueConfig,
1313 IDE,
14- IdeSettings,
1514 ILLMLogger,
1615 RuleWithSource,
1716 SerializedContinueConfig,
@@ -70,7 +69,6 @@
7069 }
7170 export default async function doLoadConfig(options: {
7271 ide: IDE;
73- ideSettingsPromise: Promise<IdeSettings>;
7472 controlPlaneClient: ControlPlaneClient;
7573 llmLogger: ILLMLogger;
7674 overrideConfigJson?: SerializedContinueConfig;
@@ -82,7 +80,6 @@
8280 }): Promise<ConfigResult<ContinueConfig>> {
8381 const {
8482 ide,
85- ideSettingsPromise,
8683 controlPlaneClient,
8784 llmLogger,
8885 overrideConfigJson,
@@ -95,7 +92,7 @@
9592
9693 const ideInfo = await ide.getIdeInfo();
9794 const uniqueId = await ide.getUniqueId();
98- const ideSettings = await ideSettingsPromise;
95+ const ideSettings = await ide.getIdeSettings();
9996 const workOsAccessToken = await controlPlaneClient.getAccessToken();
10097 const isSignedIn = await controlPlaneClient.isSignedIn();
10198
@@ -374,7 +371,7 @@
374371 const useOnPremProxy =
375372 controlPlane?.useContinueForTeamsProxy === false && controlPlane?.proxyUrl;
376373
377- const env = await getControlPlaneEnv(ideSettingsPromise);
374+ const env = await getControlPlaneEnv(Promise.resolve(ideSettings));
378375 let controlPlaneProxyUrl: string = useOnPremProxy
379376 ? controlPlane?.proxyUrl
380377 : env.DEFAULT_CONTROL_PLANE_PROXY_URL;
modified core/context/providers/_context-providers.vitest.ts +0 −2
@@ -28,11 +28,9 @@
2828 ): Promise<ContextProviderExtras> {
2929 setUpTestDir();
3030 const ide = new FileSystemIde(TEST_DIR);
31- const ideSettingsPromise = ide.getIdeSettings();
3231 const llmLogger = new LLMLogger();
3332 const configHandler = new ConfigHandler(
3433 ide,
35- ideSettingsPromise,
3634 llmLogger,
3735 Promise.resolve(undefined),
3836 );
modified core/control-plane/client.ts +4 −5
@@ -11,7 +11,7 @@
1111 import fetch, { RequestInit, Response } from "node-fetch";
1212
1313 import { OrganizationDescription } from "../config/ProfileLifecycleManager.js";
14-import { IdeInfo, IdeSettings, ModelDescription } from "../index.js";
14+import { IDE, ModelDescription } from "../index.js";
1515 import { Logger } from "../util/Logger.js";
1616
1717 import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js";
@@ -44,8 +44,7 @@
4444 export class ControlPlaneClient {
4545 constructor(
4646 readonly sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
47- private readonly ideSettingsPromise: Promise<IdeSettings>,
48- private readonly ideInfoPromise: Promise<IdeInfo>,
47+ private readonly ide: IDE,
4948 ) {}
5049
5150 async resolveFQSNs(
@@ -90,9 +89,9 @@
9089 throw new Error("No access token");
9190 }
9291
93- const env = await getControlPlaneEnv(this.ideSettingsPromise);
92+ const env = await getControlPlaneEnv(this.ide.getIdeSettings());
9493 const url = new URL(path, env.CONTROL_PLANE_URL).toString();
95- const ideInfo = await this.ideInfoPromise;
94+ const ideInfo = await this.ide.getIdeInfo();
9695
9796 const resp = await fetch(url, {
9897 ...init,
modified core/core.ts +2 −3
@@ -138,7 +138,7 @@
138138
139139 const ideInfoPromise = messenger.request("getIdeInfo", undefined);
140140 const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
141- const sessionInfoPromise = messenger.request(
141+ const initialSessionInfoPromise = messenger.request(
142142 "getControlPlaneSessionInfo",
143143 {
144144 silent: true,
@@ -148,9 +148,8 @@
148148
149149 this.configHandler = new ConfigHandler(
150150 this.ide,
151- ideSettingsPromise,
152151 this.llmLogger,
153- sessionInfoPromise,
152+ initialSessionInfoPromise,
154153 );
155154
156155 this.docsService = DocsService.createSingleton(
modified core/test/fixtures.ts +1 −3
@@ -12,13 +12,11 @@
1212
1313 export const testControlPlaneClient = new ControlPlaneClient(
1414 Promise.resolve(undefined),
15- ideSettingsPromise,
16- testIde.getIdeInfo(),
15+ testIde,
1716 );
1817
1918 export const testConfigHandler = new ConfigHandler(
2019 testIde,
21- ideSettingsPromise,
2220 new LLMLogger(),
2321 Promise.resolve(undefined),
2422 );