diff --git a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts index a1b8691e703..780feed2f62 100644 --- a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts +++ b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts @@ -361,4 +361,33 @@ describe("getEnvironmentDetails", () => { await expect(getEnvironmentDetails(mockCline as Task)).resolves.not.toThrow() }) + it("should include REMINDERS section when todoListEnabled is true", async () => { + mockProvider.getState.mockResolvedValue({ + ...mockState, + apiConfiguration: { todoListEnabled: true }, + }) + const cline = { ...mockCline, todoList: [{ content: "test", status: "pending" }] } + const result = await getEnvironmentDetails(cline as Task) + expect(result).toContain("REMINDERS") + }) + + it("should NOT include REMINDERS section when todoListEnabled is false", async () => { + mockProvider.getState.mockResolvedValue({ + ...mockState, + apiConfiguration: { todoListEnabled: false }, + }) + const cline = { ...mockCline, todoList: [{ content: "test", status: "pending" }] } + const result = await getEnvironmentDetails(cline as Task) + expect(result).not.toContain("REMINDERS") + }) + + it("should include REMINDERS section when todoListEnabled is undefined", async () => { + mockProvider.getState.mockResolvedValue({ + ...mockState, + apiConfiguration: {}, + }) + const cline = { ...mockCline, todoList: [{ content: "test", status: "pending" }] } + const result = await getEnvironmentDetails(cline as Task) + expect(result).toContain("REMINDERS") + }) }) diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index 5a0a15962cd..fbc1f2dc577 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -268,6 +268,10 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo } } - const reminderSection = formatReminderSection(cline.todoList) + const todoListEnabled = + state && typeof state.apiConfiguration?.todoListEnabled === "boolean" + ? state.apiConfiguration.todoListEnabled + : true + const reminderSection = todoListEnabled ? formatReminderSection(cline.todoList) : "" return `\n${details.trim()}\n${reminderSection}\n` }