Skip to content

Commit a88238f

Browse files
authored
feat: conditionally include reminder section based on todo list config (#6411)
* feat: conditionally include reminder section based on todo list configuration * feat: add tests for REMINDERS section based on todoListEnabled configuration
1 parent 82a007a commit a88238f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,33 @@ describe("getEnvironmentDetails", () => {
361361

362362
await expect(getEnvironmentDetails(mockCline as Task)).resolves.not.toThrow()
363363
})
364+
it("should include REMINDERS section when todoListEnabled is true", async () => {
365+
mockProvider.getState.mockResolvedValue({
366+
...mockState,
367+
apiConfiguration: { todoListEnabled: true },
368+
})
369+
const cline = { ...mockCline, todoList: [{ content: "test", status: "pending" }] }
370+
const result = await getEnvironmentDetails(cline as Task)
371+
expect(result).toContain("REMINDERS")
372+
})
373+
374+
it("should NOT include REMINDERS section when todoListEnabled is false", async () => {
375+
mockProvider.getState.mockResolvedValue({
376+
...mockState,
377+
apiConfiguration: { todoListEnabled: false },
378+
})
379+
const cline = { ...mockCline, todoList: [{ content: "test", status: "pending" }] }
380+
const result = await getEnvironmentDetails(cline as Task)
381+
expect(result).not.toContain("REMINDERS")
382+
})
383+
384+
it("should include REMINDERS section when todoListEnabled is undefined", async () => {
385+
mockProvider.getState.mockResolvedValue({
386+
...mockState,
387+
apiConfiguration: {},
388+
})
389+
const cline = { ...mockCline, todoList: [{ content: "test", status: "pending" }] }
390+
const result = await getEnvironmentDetails(cline as Task)
391+
expect(result).toContain("REMINDERS")
392+
})
364393
})

src/core/environment/getEnvironmentDetails.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
268268
}
269269
}
270270

271-
const reminderSection = formatReminderSection(cline.todoList)
271+
const todoListEnabled =
272+
state && typeof state.apiConfiguration?.todoListEnabled === "boolean"
273+
? state.apiConfiguration.todoListEnabled
274+
: true
275+
const reminderSection = todoListEnabled ? formatReminderSection(cline.todoList) : ""
272276
return `<environment_details>\n${details.trim()}\n${reminderSection}\n</environment_details>`
273277
}

0 commit comments

Comments
 (0)