Skip to content

Commit 3994d81

Browse files
authored
Merge pull request #1137 from RooVetGit/revert-1135-add_task_to_power_steering
Revert "Include the original task in the power steering content"
2 parents 5186b27 + 5a6ca2b commit 3994d81

File tree

5 files changed

+7
-110
lines changed

5 files changed

+7
-110
lines changed

.changeset/weak-swans-study.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/core/Cline.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,9 +3243,6 @@ export class Cline {
32433243
customInstructions: globalCustomInstructions,
32443244
preferredLanguage,
32453245
} = (await this.providerRef.deref()?.getState()) ?? {}
3246-
3247-
const powerSteering = Experiments.isEnabled(experiments ?? {}, EXPERIMENT_IDS.POWER_STEERING)
3248-
32493246
const currentMode = mode ?? defaultModeSlug
32503247
const modeDetails = await getFullModeDetails(currentMode, customModes, customModePrompts, {
32513248
cwd,
@@ -3255,8 +3252,11 @@ export class Cline {
32553252
details += `\n\n# Current Mode\n`
32563253
details += `<slug>${currentMode}</slug>\n`
32573254
details += `<name>${modeDetails.name}</name>\n`
3258-
if (powerSteering) {
3255+
if (Experiments.isEnabled(experiments ?? {}, EXPERIMENT_IDS.POWER_STEERING)) {
32593256
details += `<role>${modeDetails.roleDefinition}</role>\n`
3257+
if (modeDetails.customInstructions) {
3258+
details += `<custom_instructions>${modeDetails.customInstructions}</custom_instructions>\n`
3259+
}
32603260
}
32613261

32623262
// Add warning if not in code mode
@@ -3268,21 +3268,7 @@ export class Cline {
32683268
) {
32693269
const currentModeName = getModeBySlug(currentMode, customModes)?.name ?? currentMode
32703270
const defaultModeName = getModeBySlug(defaultModeSlug, customModes)?.name ?? defaultModeSlug
3271-
details += `\n\nNOTE: You are currently in '${currentModeName}' mode which only allows read-only operations. To write files or execute commands, the user will need to switch to '${defaultModeName}' mode or another mode with these capabilities. Note that only the user can switch modes.`
3272-
}
3273-
3274-
if (powerSteering) {
3275-
if (modeDetails.customInstructions) {
3276-
details += `\n\n# Custom Instructions\n`
3277-
details += `<custom_instructions>${modeDetails.customInstructions}</custom_instructions>\n`
3278-
}
3279-
3280-
const taskMessage = this.clineMessages[0]?.text ?? ""
3281-
3282-
if (taskMessage) {
3283-
details += `\n\n# Current Task\n\n`
3284-
details += `<task>${taskMessage}</task>\n`
3285-
}
3271+
details += `\n\nNOTE: You are currently in '${currentModeName}' mode which only allows read-only operations. To write files or execute commands, the user will need to switch to '${defaultModeName}' mode. Note that only the user can switch modes.`
32863272
}
32873273

32883274
if (includeFileDetails) {

src/core/__tests__/Cline.test.ts

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -466,90 +466,6 @@ describe("Cline", () => {
466466
expect(details).toMatch(/1\/1\/2024.*5:00:00 AM.*\(America\/Los_Angeles, UTC-7:00\)/) // Full time string format
467467
})
468468

469-
it("should maintain correct section order with context size before file listing", async () => {
470-
const cline = new Cline(mockProvider, mockApiConfig, undefined, false, false, undefined, "test task")
471-
472-
const details = await cline["getEnvironmentDetails"](true)
473-
474-
const contextSizeIndex = details.indexOf("# Current Context Size")
475-
const fileListingIndex = details.indexOf("# Current Working Directory")
476-
477-
expect(contextSizeIndex).toBeGreaterThan(-1)
478-
expect(fileListingIndex).toBeGreaterThan(-1)
479-
expect(contextSizeIndex).toBeLessThan(fileListingIndex)
480-
})
481-
482-
it("should include power steering content when experiment is enabled", async () => {
483-
// Mock provider state
484-
mockProvider.getState = jest.fn().mockResolvedValue({
485-
customInstructions: "test instructions",
486-
mode: "code",
487-
customModes: [],
488-
customModePrompts: {},
489-
preferredLanguage: "en",
490-
})
491-
492-
const cline = new Cline(
493-
mockProvider,
494-
mockApiConfig,
495-
"test instructions",
496-
false,
497-
false,
498-
undefined,
499-
"test task",
500-
)
501-
502-
// Mock experiments module
503-
const { experiments, EXPERIMENT_IDS } = require("../../shared/experiments")
504-
jest.spyOn(experiments, "isEnabled").mockImplementation((config, id) => {
505-
return id === EXPERIMENT_IDS.POWER_STEERING ? true : false
506-
})
507-
508-
const details = await cline["getEnvironmentDetails"](false)
509-
510-
// Verify sections are present
511-
expect(details).toContain("# Custom Instructions")
512-
expect(details).toContain("# Current Task")
513-
514-
// Verify task content
515-
expect(details).toContain("<task>test task</task>")
516-
})
517-
518-
it("should exclude power steering content when experiment is disabled", async () => {
519-
// Mock provider state
520-
mockProvider.getState = jest.fn().mockResolvedValue({
521-
customInstructions: "test instructions",
522-
mode: "code",
523-
customModes: [],
524-
customModePrompts: {},
525-
preferredLanguage: "en",
526-
})
527-
528-
const cline = new Cline(
529-
mockProvider,
530-
mockApiConfig,
531-
"test instructions",
532-
false,
533-
false,
534-
undefined,
535-
"test task",
536-
)
537-
538-
// Mock experiments module
539-
const { experiments, EXPERIMENT_IDS } = require("../../shared/experiments")
540-
jest.spyOn(experiments, "isEnabled").mockImplementation((config, id) => {
541-
return id === EXPERIMENT_IDS.POWER_STEERING ? false : true
542-
})
543-
544-
const details = await cline["getEnvironmentDetails"](false)
545-
546-
// Verify sections are not present
547-
expect(details).not.toContain("# Custom Instructions")
548-
expect(details).not.toContain("<custom_instructions>")
549-
expect(details).not.toContain("# Current Task")
550-
expect(details).not.toContain("<task>")
551-
})
552-
553469
describe("API conversation handling", () => {
554470
it("should clean conversation history before sending to API", async () => {
555471
const cline = new Cline(mockProvider, mockApiConfig, undefined, false, false, undefined, "test task")

src/shared/__tests__/experiments.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("experiments", () => {
77
expect(experimentConfigsMap.POWER_STEERING).toMatchObject({
88
name: 'Use experimental "power steering" mode',
99
description:
10-
"When enabled, Roo will remind the model about the details of the original task and its current mode definition more frequently. This will lead to stronger adherence to its instructions, but will use more tokens per message.",
10+
"When enabled, Roo will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message.",
1111
enabled: false,
1212
})
1313
})

src/shared/experiments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
3939
POWER_STEERING: {
4040
name: 'Use experimental "power steering" mode',
4141
description:
42-
"When enabled, Roo will remind the model about the details of the original task and its current mode definition more frequently. This will lead to stronger adherence to its instructions, but will use more tokens per message.",
42+
"When enabled, Roo will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message.",
4343
enabled: false,
4444
},
4545
}

0 commit comments

Comments
 (0)