fix(server): use a Cursor todo's title when its content is blank (#5073)

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
Arham AminandClaude Opus 4.8 authored and GitHub committed 2026-08-04 09:19:12 -04:00
1 parent 8a16cadbaf
commit 82b76e2138
2 files changed
+23 -1

No files matched your search

@@ -107,6 +107,25 @@ describe("CursorAcpExtension", () => {
});
});
it("falls back to the title when content is present but blank", () => {
expect(
extractTodosAsPlan({
toolCallId: "todos-2",
todos: [
{ id: "1", content: "", title: "Titled step", status: "pending" },
{ id: "2", content: " ", title: "Whitespace content", status: "in_progress" },
{ id: "3", content: "", title: "", status: "pending" },
],
merge: true,
}),
).toEqual({
plan: [
{ step: "Titled step", status: "pending" },
{ step: "Whitespace content", status: "inProgress" },
],
});
});
it("decodes Cursor list_available_models responses with per-model config options", () => {
const decoded = CursorListAvailableModelsResponse.make({
models: [
@@ -94,7 +94,10 @@ export function extractTodosAsPlan(params: typeof CursorUpdateTodosRequest.Type)
}>;
} {
const plan = params.todos.flatMap((todo) => {
const step = todo.content?.trim() ?? todo.title?.trim() ?? "";
// Fall back to the title when content is missing OR blank. `??` only
// covers a missing content, so a present-but-empty content ("" or
// whitespace) would shadow a real title and drop the step below.
const step = todo.content?.trim() || todo.title?.trim() || "";
if (step === "") {
return [];
}