Skip to content

Fix(tasks): list_tasks and zn task list leave cancelled tasks out of open - #929

Merged
adibhanna merged 1 commit into
ZenNotes:mainfrom
vishalhabib99:fix/list-tasks-exclude-cancelled
Oct 13, 2026
Merged

adibhanna merged 1 commit into
ZenNotes:mainfrom
vishalhabib99:fix/list-tasks-exclude-cancelled

Conversation

@vishalhabib99

Copy link
Copy Markdown
Contributor

What's wrong

The MCP list_tasks tool (default status: "open") and zn task list return [-] cancelled tasks next to actionable ones. The app's shared isTaskOpen already 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:

- [ ] Buy milk due:2026-10-20
- [-] Cancelled plan due:2026-10-15
- [x] Done thing
  • list_tasks {} returns Buy milk and Cancelled 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 checks checked || waiting || forwarded, not cancelled.
  • apps/desktop/src/cli/commands/tasks.ts:24-25: same gap in the CLI filters.

Fix

Add cancelled to both filters (MCP open, CLI default and --unchecked). status: "all" and zn task list --all still return cancelled tasks. Updated the status description to "open = not done, cancelled or waiting".

Tests

  • src/mcp/server.test.ts: new list_tasks block (default and dueBefore exclude cancelled; status: "all" keeps it).
  • New src/cli/commands/tasks.test.ts on a temp local vault (default and --unchecked exclude cancelled; --all keeps it).
  • Before the fix: 3 of the 5 new tests fail. After: all 5 pass.
  • npm run typecheck: 8/8 tasks pass. electron-vite build passes.
  • 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 on main in 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.

…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.
@adibhanna adibhanna self-assigned this Oct 13, 2026
@adibhanna

Copy link
Copy Markdown
Contributor

Thanks @vishalhabib99, and welcome. A clean fix with exactly the right tests: your repro note, the default and dueBefore paths, and status: "all" and --all still keeping cancelled tasks.

Merged into the v2.69.0 release branch as dfaca0b7, shipping in 2.69.0, with no follow-up needed. GitHub will mark this PR merged once that branch reaches main at release.

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. list_tasks returns only Buy milk for open and for dueBefore: "2026-10-31", and status: "all" still lists Cancelled plan.

The Go zn (ZenNotes/tui), which is what desktop-managed and Homebrew installs run for zn task list and zn mcp, had the same gap in both filters. I mirrored your fix there in 91bb33b, with the same status description word for word; it ships in the next zn release.

@vishalhabib99

Copy link
Copy Markdown
Contributor Author

Thanks @adibhanna, and for running the suite locally since CI was held. Mirroring it in the Go zn too means the CLI and MCP paths agree everywhere, which is the part I couldn't have done from here.

MichaelC001 pushed a commit to MichaelC001/zennotes that referenced this pull request Oct 14, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants