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

Fix: Updated ideSettings didn't get passed properly
This commit is contained in:
Dallin Romney 2025-09-08 21:13:11 -07:00 • committed by GitHub
commit e1d349cad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 25 additions and 50 deletions

View file

@ -59,27 +59,17 @@ export class ConfigHandler {
constructor(
private readonly ide: IDE,
private ideSettingsPromise: Promise<IdeSettings>,
private llmLogger: ILLMLogger,
sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
initialSessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
) {
this.ide = ide;
this.ideSettingsPromise = ideSettingsPromise;
this.controlPlaneClient = new ControlPlaneClient(
sessionInfoPromise,
ideSettingsPromise,
this.ide.getIdeInfo(),
initialSessionInfoPromise,
this.ide,
);
// This profile manager will always be available
this.globalLocalProfileManager = new ProfileLifecycleManager(
new LocalProfileLoader(
ide,
ideSettingsPromise,
this.controlPlaneClient,
this.llmLogger,
),
new LocalProfileLoader(ide, this.controlPlaneClient, this.llmLogger),
this.ide,
);
@ -97,6 +87,7 @@ export class ConfigHandler {
}
private workspaceDirs: string[] | null = null;
async getWorkspaceId() {
if (!this.workspaceDirs) {
this.workspaceDirs = await this.ide.getWorkspaceDirs();
@ -113,6 +104,13 @@ export class ConfigHandler {
const signal = this.cascadeAbortController.signal;
this.workspaceDirs = null; // forces workspace dirs reload
// Always update globalLocalProfileManager before recreating all the loaders
// during every cascadeInit so it holds the most recent controlPlaneClient.
this.globalLocalProfileManager = new ProfileLifecycleManager(
new LocalProfileLoader(this.ide, this.controlPlaneClient, this.llmLogger),
this.ide,
);
try {
const { orgs, errors } = await this.getOrgs();
@ -248,7 +246,6 @@ export class ConfigHandler {
versionSlug: assistant.configResult.config?.version ?? "latest",
controlPlaneClient: this.controlPlaneClient,
ide: this.ide,
ideSettingsPromise: this.ideSettingsPromise,
llmLogger: this.llmLogger,
rawYaml: assistant.rawYaml,
orgScopeId: orgScopeId,
@ -369,7 +366,6 @@ export class ConfigHandler {
const profiles = [...assistantFiles, ...agentFiles].map((assistant) => {
return new LocalProfileLoader(
this.ide,
this.ideSettingsPromise,
this.controlPlaneClient,
this.llmLogger,
assistant,
@ -394,7 +390,6 @@ export class ConfigHandler {
// Ide settings change: refresh session and cascade refresh from the top
async updateIdeSettings(ideSettings: IdeSettings) {
this.ideSettingsPromise = Promise.resolve(ideSettings);
this.abortCascade();
await this.cascadeInit("IDE settings update");
}
@ -432,8 +427,7 @@ export class ConfigHandler {
if (reload) {
this.controlPlaneClient = new ControlPlaneClient(
Promise.resolve(sessionInfo),
this.ideSettingsPromise,
this.ide.getIdeInfo(),
this.ide,
);
this.abortCascade();
await this.cascadeInit("Control plane session info update");

View file

@ -1,7 +1,7 @@
import { ConfigResult, parseConfigYaml } from "@continuedev/config-yaml";
import { ControlPlaneClient } from "../../control-plane/client.js";
import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
import { ProfileDescription } from "../ProfileLifecycleManager.js";
import { getPrimaryConfigFilePath } from "../../util/paths.js";
@ -15,7 +15,6 @@ export default class LocalProfileLoader implements IProfileLoader {
constructor(
private ide: IDE,
private ideSettingsPromise: Promise<IdeSettings>,
private controlPlaneClient: ControlPlaneClient,
private llmLogger: ILLMLogger,
private overrideAssistantFile?:
@ -57,7 +56,6 @@ export default class LocalProfileLoader implements IProfileLoader {
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
const result = await doLoadConfig({
ide: this.ide,
ideSettingsPromise: this.ideSettingsPromise,
controlPlaneClient: this.controlPlaneClient,
llmLogger: this.llmLogger,
profileId: this.description.id,

View file

@ -2,7 +2,7 @@ import { AssistantUnrolled, ConfigResult } from "@continuedev/config-yaml";
import { ControlPlaneClient } from "../../control-plane/client.js";
import { getControlPlaneEnv } from "../../control-plane/env.js";
import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
import { ProfileDescription } from "../ProfileLifecycleManager.js";
import doLoadConfig from "./doLoadConfig.js";
@ -28,7 +28,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
private readonly versionSlug: string;
private readonly controlPlaneClient: ControlPlaneClient;
private readonly ide: IDE;
private ideSettingsPromise: Promise<IdeSettings>;
private llmLogger: ILLMLogger;
readonly description: ProfileDescription;
private readonly orgScopeId: string | null;
@ -41,7 +40,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
versionSlug,
controlPlaneClient,
ide,
ideSettingsPromise,
llmLogger,
description,
orgScopeId,
@ -53,7 +51,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
versionSlug: string;
controlPlaneClient: ControlPlaneClient;
ide: IDE;
ideSettingsPromise: Promise<IdeSettings>;
llmLogger: ILLMLogger;
description: ProfileDescription;
orgScopeId: string | null;
@ -65,7 +62,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
this.versionSlug = versionSlug;
this.controlPlaneClient = controlPlaneClient;
this.ide = ide;
this.ideSettingsPromise = ideSettingsPromise;
this.llmLogger = llmLogger;
this.description = description;
this.orgScopeId = orgScopeId;
@ -79,7 +75,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
versionSlug,
controlPlaneClient,
ide,
ideSettingsPromise,
llmLogger,
rawYaml,
orgScopeId,
@ -91,12 +86,11 @@ export default class PlatformProfileLoader implements IProfileLoader {
versionSlug: string;
controlPlaneClient: ControlPlaneClient;
ide: IDE;
ideSettingsPromise: Promise<IdeSettings>;
llmLogger: ILLMLogger;
rawYaml: string;
orgScopeId: string | null;
}): Promise<PlatformProfileLoader> {
const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise);
const controlPlaneEnv = await getControlPlaneEnv(ide.getIdeSettings());
const description: ProfileDescription = {
id: `${ownerSlug}/${packageSlug}`,
@ -121,7 +115,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
versionSlug,
controlPlaneClient,
ide,
ideSettingsPromise,
llmLogger,
description,
orgScopeId,
@ -139,7 +132,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
const results = await doLoadConfig({
ide: this.ide,
ideSettingsPromise: this.ideSettingsPromise,
controlPlaneClient: this.controlPlaneClient,
llmLogger: this.llmLogger,
overrideConfigYaml: this.configResult.config,

View file

@ -11,7 +11,6 @@ import {
import {
ContinueConfig,
IDE,
IdeSettings,
ILLMLogger,
RuleWithSource,
SerializedContinueConfig,
@ -70,7 +69,6 @@ async function loadRules(ide: IDE) {
}
export default async function doLoadConfig(options: {
ide: IDE;
ideSettingsPromise: Promise<IdeSettings>;
controlPlaneClient: ControlPlaneClient;
llmLogger: ILLMLogger;
overrideConfigJson?: SerializedContinueConfig;
@ -82,7 +80,6 @@ export default async function doLoadConfig(options: {
}): Promise<ConfigResult<ContinueConfig>> {
const {
ide,
ideSettingsPromise,
controlPlaneClient,
llmLogger,
overrideConfigJson,
@ -95,7 +92,7 @@ export default async function doLoadConfig(options: {
const ideInfo = await ide.getIdeInfo();
const uniqueId = await ide.getUniqueId();
const ideSettings = await ideSettingsPromise;
const ideSettings = await ide.getIdeSettings();
const workOsAccessToken = await controlPlaneClient.getAccessToken();
const isSignedIn = await controlPlaneClient.isSignedIn();
@ -374,7 +371,7 @@ export default async function doLoadConfig(options: {
const useOnPremProxy =
controlPlane?.useContinueForTeamsProxy === false && controlPlane?.proxyUrl;
const env = await getControlPlaneEnv(ideSettingsPromise);
const env = await getControlPlaneEnv(Promise.resolve(ideSettings));
let controlPlaneProxyUrl: string = useOnPremProxy
? controlPlane?.proxyUrl
: env.DEFAULT_CONTROL_PLANE_PROXY_URL;

View file

@ -28,11 +28,9 @@ async function getContextProviderExtras(
): Promise<ContextProviderExtras> {
setUpTestDir();
const ide = new FileSystemIde(TEST_DIR);
const ideSettingsPromise = ide.getIdeSettings();
const llmLogger = new LLMLogger();
const configHandler = new ConfigHandler(
ide,
ideSettingsPromise,
llmLogger,
Promise.resolve(undefined),
);

View file

@ -11,7 +11,7 @@ import {
import fetch, { RequestInit, Response } from "node-fetch";
import { OrganizationDescription } from "../config/ProfileLifecycleManager.js";
import { IdeInfo, IdeSettings, ModelDescription } from "../index.js";
import { IDE, ModelDescription } from "../index.js";
import { Logger } from "../util/Logger.js";
import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js";
@ -44,8 +44,7 @@ export const TRIAL_PROXY_URL =
export class ControlPlaneClient {
constructor(
readonly sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
private readonly ideSettingsPromise: Promise<IdeSettings>,
private readonly ideInfoPromise: Promise<IdeInfo>,
private readonly ide: IDE,
) {}
async resolveFQSNs(
@ -90,9 +89,9 @@ export class ControlPlaneClient {
throw new Error("No access token");
}
const env = await getControlPlaneEnv(this.ideSettingsPromise);
const env = await getControlPlaneEnv(this.ide.getIdeSettings());
const url = new URL(path, env.CONTROL_PLANE_URL).toString();
const ideInfo = await this.ideInfoPromise;
const ideInfo = await this.ide.getIdeInfo();
const resp = await fetch(url, {
...init,

View file

@ -138,7 +138,7 @@ export class Core {
const ideInfoPromise = messenger.request("getIdeInfo", undefined);
const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
const sessionInfoPromise = messenger.request(
const initialSessionInfoPromise = messenger.request(
"getControlPlaneSessionInfo",
{
silent: true,
@ -148,9 +148,8 @@ export class Core {
this.configHandler = new ConfigHandler(
this.ide,
ideSettingsPromise,
this.llmLogger,
sessionInfoPromise,
initialSessionInfoPromise,
);
this.docsService = DocsService.createSingleton(

View file

@ -12,13 +12,11 @@ export const ideSettingsPromise = testIde.getIdeSettings();
export const testControlPlaneClient = new ControlPlaneClient(
Promise.resolve(undefined),
ideSettingsPromise,
testIde.getIdeInfo(),
testIde,
);
export const testConfigHandler = new ConfigHandler(
testIde,
ideSettingsPromise,
new LLMLogger(),
Promise.resolve(undefined),
);