Skip to content

feat(mcp): adopt MCP Tasks for aether.task.send, with caller cancel - #22

Merged
TudorAndrei merged 3 commits into
mainfrom
feat/mcp-tasks
Nov 30, 2026
Merged

TudorAndrei merged 3 commits into
mainfrom
feat/mcp-tasks

Conversation

@TudorAndrei

@TudorAndrei TudorAndrei commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

A caller whose task takes longer than 20 s gets status: waiting and must poll our own inbox tools. MCP has a standard for long tool calls: the Tasks extension (io.modelcontextprotocol/tasks). Tasks also needs tasks/cancel, and Aether had no way for a caller to cancel a task that it sent. aether.task.cancel cancels only tasks that this node runs as host. Stacked on #20.

What changes

stateDiagram-v2
    [*] --> waiting: tools/call aether.task.send (client declares Tasks: task handle at once)
    waiting --> working: host takes the task
    waiting --> not_delivered: deadline
    working --> answered: host answers
    working --> failed: host fails, rejects, or its owner cancels
    waiting --> cancelled: tasks/cancel (no wire traffic, unless the task is in delivery)
    working --> cancelled: tasks/cancel (one best-effort A2A Cancel frame)
Loading
Aether sent task tasks/get status
waiting, working working, with a statusMessage
answered completed, result = the same result as aether.task.send
failed, not_delivered completed with isError (the spec reserves failed for JSON-RPC errors)
cancelled (new) cancelled
unknown ID JSON-RPC invalid params
  • tasks/get and tasks/cancel read the durable sent-task store, not rmcp's in-memory TaskManager. The stdio server stops with its client, and a client that restarts must be able to continue with the same task ID.
  • Clients that do not declare Tasks keep the 20 s wait, aether.inbox.read and aether.inbox.list.
  • aether.task.cancel keeps its meaning (a task that this node runs for someone else). Its description now says so.

Look at: cancel_sent in crates/aether/src/outbox.rs and migration 020_sent_task_cancelled.sql.

Evidence

  • mise run fmt: pass.
  • mise run lint: pass.
  • cargo test --workspace: pass (486 + 82 + 8 + 3 tests, 98 feature scenarios).
  • mise run hermes-plugin-test: OK, 3 skipped (Hermes is not on PYTHONPATH).
  • The first commit builds and passes clippy and the tests on its own.
  • sh scripts/tla.sh Outbox: the spec now has a CallerCancel action. Result: pending at the time of writing. I will add it in a comment.
  • New tests: the migration keeps rows; waiting and working change to cancelled, and answered stays answered; a late delivery round does not overwrite cancelled; a waiting task that is in delivery gets the Cancel frame; the Tasks handle, tasks/get for each state, tasks/cancel, and tasks/get from a new server instance (restart).
  • Not checked: a live client with Tasks support, and a Cancel frame through a real relay to a released host.

Merge danger

Door: one-way
Blast radius: one node

Migration 020 rebuilds sent_tasks to add cancelled to its state check. An older binary that opens this database can read a cancelled row that it does not know. The A2A Cancel frame is not new on the wire: released hosts already handle it (cancel_from). Race that stays: when a Cancel frame reaches the host before the task request does, the host ignores it and runs the task.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@TudorAndrei

Copy link
Copy Markdown
Contributor Author

TLC result for sh scripts/tla.sh Outbox on this branch: "Model checking completed. No error has been found." 14,822,353 states generated, 1,915,700 distinct states, 0 left on queue.

Migration 020 adds "cancelled" to the sent_tasks state check.
cancel_sent_task moves a waiting or working row to cancelled in one
conditional update, so a delivery round that ends later cannot
overwrite it. A task that the host may have, because it is working,
has an attempt, or is in delivery, also gets one best-effort A2A Cancel
frame over the direct or relay path. Released hosts already accept
this frame. The Outbox spec models the caller cancel as a terminal
state.
The server advertises io.modelcontextprotocol/tasks. A client that
declares it gets a task handle at once, with the Aether task ID.
tasks/get and tasks/cancel read the durable sent-task store, so a
client that restarts can continue. tasks/cancel uses the caller cancel.
A failed or undelivered task is completed with isError, as the spec
requires for tool errors. Other clients keep the 20 s wait and the
inbox tools.
@TudorAndrei
TudorAndrei changed the base branch from feat/mcp-tool-metadata to main November 30, 2026 12:18
@TudorAndrei
TudorAndrei merged commit 44f8777 into main Nov 30, 2026
13 checks passed
@TudorAndrei
TudorAndrei deleted the feat/mcp-tasks branch November 30, 2026 12:30
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.

1 participant