Task — engineering-spec@1

"MCP Tasks primitive — handles, status poll, cancel lifecycle"

doneTASK-MCP-007
module mcp · class product · priority p0 · created 2026-05-17 · shipped null
depends on TASK-MCP-001, TASK-MCP-004 · blocks none

TASK-MCP-007: MCP Tasks primitive (lifecycle adopt)

Summary

Provide an opaque task handle with a closed status enum, start → running → terminal lifecycle, result fetch, and cancellation. As-built: in-memory tasks.rs (dev-real contract) plus tasks_pg.rs + migration 0017_mcp_tasks.sql as the Postgres store-of-record. Unit tests cover start/complete/cancel/unknown-id and enum cardinalities.

Problem

The engineering-spec claimed a ten-file services/mcp/src/tasks/ tree, three migrations (0009–0011), worker pools, NATS progress, checkpoints, long_running tools/call routing, idempotency, rate limits, TTL sweeper, prune, and fifteen task_* integration tests. HEAD has consolidated tasks.rs / tasks_pg.rs and migration 0017; the request-path async router and worker infrastructure remain deferred (already named in source comments).

Proposed Solution

Adopt the shipped lifecycle:

Ledger everything else under Out of scope so HITL can accept an honest adopt.

Alternatives Considered

Success Metrics

Scope

In scope:

Out of scope / Non-Goals

Dependencies

depends_on: [TASK-MCP-001, TASK-MCP-004]. Soft: TASK-MCP-006/008 for future destructive-at-start confirm on long-running tools (not required for this lifecycle adopt).

1. Description (normative)

Acceptance criteria

Verification

cd services && cargo test -p cyberos-mcp-gateway tasks::
PathCovers
src/tasks.rs unit testsLifecycle contract
src/tasks_pg.rs + migrations/0017_mcp_tasks.sqlStore-of-record presence
src/db_slice_test.rs (Postgres-gated / ignored without pool)DB path when available

AI Authorship Disclosure


batch/9a-mcp adopt — TASK-MCP-007 re-spec against as-built tasks.rs / tasks_pg.