From 6f4f2c0f6f4a0f6da2fe41624ba80aa538a9fe86 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Thu, 21 Aug 2025 13:21:45 +0000 Subject: [PATCH] fix: always include mode instructions regardless of Power Steering setting - Mode roleDefinition and customInstructions are now always included in environment details - Previously these were only included when Power Steering was enabled - Updated tests to verify mode instructions are included in both cases Fixes #7277 --- .../__tests__/getEnvironmentDetails.spec.ts | 14 ++++++++++++-- src/core/environment/getEnvironmentDetails.ts | 9 +++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts index 780feed2f6..89c93a4d0c 100644 --- a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts +++ b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts @@ -313,11 +313,21 @@ describe("getEnvironmentDetails", () => { expect(mockInactiveTerminal.getCurrentWorkingDirectory).toHaveBeenCalled() }) - it("should include experiment-specific details when Power Steering is enabled", async () => { + it("should always include mode role and custom instructions regardless of Power Steering", async () => { + // Test with Power Steering disabled + mockState.experiments = { [EXPERIMENT_IDS.POWER_STEERING]: false } + ;(experiments.isEnabled as Mock).mockReturnValue(false) + + let result = await getEnvironmentDetails(mockCline as Task) + + expect(result).toContain("You are a code assistant") + expect(result).toContain("Custom instructions") + + // Test with Power Steering enabled mockState.experiments = { [EXPERIMENT_IDS.POWER_STEERING]: true } ;(experiments.isEnabled as Mock).mockReturnValue(true) - const result = await getEnvironmentDetails(mockCline as Task) + result = await getEnvironmentDetails(mockCline as Task) expect(result).toContain("You are a code assistant") expect(result).toContain("Custom instructions") diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index fbc1f2dc57..2de28841c8 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -228,13 +228,10 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo details += `${currentMode}\n` details += `${modeDetails.name}\n` details += `${modelId}\n` + details += `${modeDetails.roleDefinition}\n` - if (Experiments.isEnabled(experiments ?? {}, EXPERIMENT_IDS.POWER_STEERING)) { - details += `${modeDetails.roleDefinition}\n` - - if (modeDetails.customInstructions) { - details += `${modeDetails.customInstructions}\n` - } + if (modeDetails.customInstructions) { + details += `${modeDetails.customInstructions}\n` } if (includeFileDetails) {