Skip to content

Commit 6f4f2c0

Browse files
committed
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
1 parent 6fd261d commit 6f4f2c0

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/core/environment/__tests__/getEnvironmentDetails.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,21 @@ describe("getEnvironmentDetails", () => {
313313
expect(mockInactiveTerminal.getCurrentWorkingDirectory).toHaveBeenCalled()
314314
})
315315

316-
it("should include experiment-specific details when Power Steering is enabled", async () => {
316+
it("should always include mode role and custom instructions regardless of Power Steering", async () => {
317+
// Test with Power Steering disabled
318+
mockState.experiments = { [EXPERIMENT_IDS.POWER_STEERING]: false }
319+
;(experiments.isEnabled as Mock).mockReturnValue(false)
320+
321+
let result = await getEnvironmentDetails(mockCline as Task)
322+
323+
expect(result).toContain("<role>You are a code assistant</role>")
324+
expect(result).toContain("<custom_instructions>Custom instructions</custom_instructions>")
325+
326+
// Test with Power Steering enabled
317327
mockState.experiments = { [EXPERIMENT_IDS.POWER_STEERING]: true }
318328
;(experiments.isEnabled as Mock).mockReturnValue(true)
319329

320-
const result = await getEnvironmentDetails(mockCline as Task)
330+
result = await getEnvironmentDetails(mockCline as Task)
321331

322332
expect(result).toContain("<role>You are a code assistant</role>")
323333
expect(result).toContain("<custom_instructions>Custom instructions</custom_instructions>")

src/core/environment/getEnvironmentDetails.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,10 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
228228
details += `<slug>${currentMode}</slug>\n`
229229
details += `<name>${modeDetails.name}</name>\n`
230230
details += `<model>${modelId}</model>\n`
231+
details += `<role>${modeDetails.roleDefinition}</role>\n`
231232

232-
if (Experiments.isEnabled(experiments ?? {}, EXPERIMENT_IDS.POWER_STEERING)) {
233-
details += `<role>${modeDetails.roleDefinition}</role>\n`
234-
235-
if (modeDetails.customInstructions) {
236-
details += `<custom_instructions>${modeDetails.customInstructions}</custom_instructions>\n`
237-
}
233+
if (modeDetails.customInstructions) {
234+
details += `<custom_instructions>${modeDetails.customInstructions}</custom_instructions>\n`
238235
}
239236

240237
if (includeFileDetails) {

0 commit comments

Comments
 (0)