refactor: Remove persistBuilderSessions feature flag (#27481)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eugene 2026-03-30 14:16:07 +02:00 committed by GitHub
parent 1963d9775d
commit f54453a419
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 3 additions and 16 deletions

View file

@ -43,8 +43,6 @@ N8N_AI_ENABLED=
# Base URL of the AI assistant service. # Base URL of the AI assistant service.
# When set, requests are sent to this URL instead of the default provider endpoint. # When set, requests are sent to this URL instead of the default provider endpoint.
N8N_AI_ASSISTANT_BASE_URL= N8N_AI_ASSISTANT_BASE_URL=
# Whether to persist AI workflow builder sessions to the database.
N8N_AI_PERSIST_BUILDER_SESSIONS=
# API key for the Anthropic (Claude) provider used by the AI workflow builder. # API key for the Anthropic (Claude) provider used by the AI workflow builder.
# When set, enables AI-powered workflow and node building. # When set, enables AI-powered workflow and node building.
N8N_AI_ANTHROPIC_KEY= N8N_AI_ANTHROPIC_KEY=

View file

@ -21,10 +21,6 @@ export class AiConfig {
@Env('N8N_AI_ALLOW_SENDING_PARAMETER_VALUES') @Env('N8N_AI_ALLOW_SENDING_PARAMETER_VALUES')
allowSendingParameterValues: boolean = true; allowSendingParameterValues: boolean = true;
/** Whether to persist AI workflow builder sessions to the database. */
@Env('N8N_AI_PERSIST_BUILDER_SESSIONS')
persistBuilderSessions: boolean = false;
get openAiDefaultHeaders(): Record<string, string> { get openAiDefaultHeaders(): Record<string, string> {
// eslint-disable-next-line @typescript-eslint/naming-convention // eslint-disable-next-line @typescript-eslint/naming-convention
return { 'openai-platform': 'org-qkmJQuJ2WnvoIKMr2UJwIJkZ' }; return { 'openai-platform': 'org-qkmJQuJ2WnvoIKMr2UJwIJkZ' };

View file

@ -449,7 +449,6 @@ describe('GlobalConfig', () => {
// @ts-expect-error structuredClone ignores properties defined as a getter // @ts-expect-error structuredClone ignores properties defined as a getter
ai: { ai: {
enabled: false, enabled: false,
persistBuilderSessions: false,
timeout: 3600000, timeout: 3600000,
allowSendingParameterValues: true, allowSendingParameterValues: true,
}, },

View file

@ -91,7 +91,6 @@ describe('WorkflowBuilderService', () => {
(mockLicense.getConsumerId as jest.Mock).mockReturnValue('test-consumer-id'); (mockLicense.getConsumerId as jest.Mock).mockReturnValue('test-consumer-id');
(mockInstanceSettings.instanceId as unknown) = 'test-instance-id'; (mockInstanceSettings.instanceId as unknown) = 'test-instance-id';
mockConfig.aiAssistant = { baseUrl: '' }; mockConfig.aiAssistant = { baseUrl: '' };
(mockConfig.ai as { persistBuilderSessions: boolean }) = { persistBuilderSessions: false };
// Reset the mocked AiWorkflowBuilderService // Reset the mocked AiWorkflowBuilderService
MockedAiWorkflowBuilderService.mockClear(); MockedAiWorkflowBuilderService.mockClear();
@ -138,7 +137,7 @@ describe('WorkflowBuilderService', () => {
expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith( expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith(
mockNodeTypeDescriptions, mockNodeTypeDescriptions,
undefined, // No session storage when persistBuilderSessions is false mockSessionRepository,
undefined, // No client when baseUrl is not set undefined, // No client when baseUrl is not set
mockLogger, mockLogger,
'test-instance-id', // instanceId 'test-instance-id', // instanceId
@ -183,7 +182,7 @@ describe('WorkflowBuilderService', () => {
expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith( expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith(
mockNodeTypeDescriptions, mockNodeTypeDescriptions,
undefined, // No session storage when persistBuilderSessions is false mockSessionRepository,
expect.any(AiAssistantClient), expect.any(AiAssistantClient),
mockLogger, mockLogger,
'test-instance-id', // instanceId 'test-instance-id', // instanceId

View file

@ -148,14 +148,9 @@ export class WorkflowBuilderService {
await this.loadNodesAndCredentials.postProcessLoaders(); await this.loadNodesAndCredentials.postProcessLoaders();
const { nodes: nodeTypeDescriptions } = await this.loadNodesAndCredentials.collectTypes(); const { nodes: nodeTypeDescriptions } = await this.loadNodesAndCredentials.collectTypes();
// Use persistent session storage if feature flag is enabled
const sessionStorage = this.config.ai.persistBuilderSessions
? this.sessionRepository
: undefined;
this.service = new AiWorkflowBuilderService( this.service = new AiWorkflowBuilderService(
nodeTypeDescriptions, nodeTypeDescriptions,
sessionStorage, this.sessionRepository,
this.client, this.client,
this.logger, this.logger,
this.instanceSettings.instanceId, this.instanceSettings.instanceId,