Repository navigation
Fix(tasks): list_tasks and zn task list leave cancelled tasks out of open - #929
Conversation
…open A [-] cancelled task is abandoned, and isTaskOpen already keeps it off the calendar and Kanban surfaces (ZenNotes#450, ZenNotes#476). The MCP list_tasks "open" filter and the zn task list default/--unchecked filters still returned it next to actionable tasks. Exclude t.cancelled in both; status "all" and --all still list it.
|
Thanks @vishalhabib99, and welcome. A clean fix with exactly the right tests: your repro note, the default and Merged into the CI didn't run on the PR (GitHub holds workflows for a first-time contributor until they're approved), so I ran it all locally: typecheck, the full desktop suite with your five new tests, and the built app's bundled MCP server against your repro note. The Go |
|
Thanks @adibhanna, and for running the suite locally since CI was held. Mirroring it in the Go |
The bundled CLI is the floor a desktop build guarantees, and 0.7.1 is the newest release. It carries this release's two zn changes into a desktop-managed install from the first launch instead of the first daily update check: `zn task list` and `zn mcp`'s `list_tasks` leave cancelled tasks out of the open ones, matching the bundled MCP server since ZenNotes#929, and when a server needs a token, zn's message points to the new Settings → MCP → Server token as well as `zn connect`. The pin is the release's terminal-release.json copied byte for byte after it verified against packaging/release-signing/zn-release-1.pub in ZenNotes/tui (source commit 91bb33b, integration protocol 1, all four archives matching checksums.txt). Staged through `npm run terminal:stage`; the native darwin-arm64 binary reports zn v0.7.1. The in-app manual's CLI card says 0.7.1 and what it changes.
What's wrong
The MCP
list_taskstool (defaultstatus: "open") andzn task listreturn[-]cancelled tasks next to actionable ones. The app's sharedisTaskOpenalready treats a cancelled task as not open (#450, #476), and the calendar/Kanban views leave them out, so an agent asking "what's open / due this week?" reports abandoned tasks as to-dos.Repro, a note
inbox/todo.md:list_tasks {}returnsBuy milkandCancelled plan("cancelled": true).list_tasks {"dueBefore":"2026-10-31"}returns the same two.zn task list(and--unchecked) lists both too.Cause
apps/desktop/src/mcp/server.ts:724: the open filter checkschecked || waiting || forwarded, notcancelled.apps/desktop/src/cli/commands/tasks.ts:24-25: same gap in the CLI filters.Fix
Add
cancelledto both filters (MCPopen, CLI default and--unchecked).status: "all"andzn task list --allstill return cancelled tasks. Updated thestatusdescription to "open = not done, cancelled or waiting".Tests
src/mcp/server.test.ts: newlist_tasksblock (default anddueBeforeexclude cancelled;status: "all"keeps it).src/cli/commands/tasks.test.tson a temp local vault (default and--uncheckedexclude cancelled;--allkeeps it).npm run typecheck: 8/8 tasks pass.electron-vite buildpasses.npm run test:run: shared-domain, app-core and quicklook all pass. In@zennotes/desktop, 19 files and 1 test (packaging.test.ts) fail the same way onmainin my environment, because I installed with--ignore-scripts(no Electron binary, no patch-package). The failing set is identical with and without this change; the only difference is the 5 new passing tests.