π The fast, Pythonic way to build MCP servers and clients.
Require pydocket 0.26.0 so a cancelled task cannot stop the worker (#5444)
Jeremiah Lowin4900dd5c5a45
diff --git a/.github/workflows/run-downstream-smoke.yml b/.github/workflows/run-downstream-smoke.ymlindex 44f74b61e..9bbefd5e1 100644--- a/.github/workflows/run-downstream-smoke.yml+++ b/.github/workflows/run-downstream-smoke.yml@@ -154,6 +154,7 @@ jobs:working-directory: pydantic-airun: |echo "UV_RUN=uv run --all-extras --no-extra mcp-tasks --all-packages \+ --exclude-newer-package pydocket=2026-10-03T00:00:00Z \--with fastmcp@file://$(ls $GITHUB_WORKSPACE/dist/fastmcp-4*.whl) \--with fastmcp-slim@file://$(ls $GITHUB_WORKSPACE/dist/fastmcp_slim-*.whl) \--with fastmcp-tasks@file://$(ls $GITHUB_WORKSPACE/dist/fastmcp_tasks-*.whl)" >> "$GITHUB_ENV"diff --git a/fastmcp_tasks/pyproject.toml b/fastmcp_tasks/pyproject.tomlindex 3f1c22914..f08f50e56 100644--- a/fastmcp_tasks/pyproject.toml+++ b/fastmcp_tasks/pyproject.toml@@ -65,5 +65,10 @@ dependencies = [# was misread as a burner-redis 0.1.7 interpreter crash, which is why a# burner-redis pin and a platform-split floor used to live here# (prefectlabs/burner-redis#7 has the exoneration).- "pydocket>=0.24.1",+ #+ # pydocket 0.26.0 keeps the worker running when a task is cancelled before+ # it starts. Earlier versions treated that cancellation as a shutdown+ # request, so the worker stopped reading tasks and every later task stayed+ # in `working` forever.+ "pydocket>=0.26.0",]diff --git a/tests/tasks/server/test_task_methods.py b/tests/tasks/server/test_task_methods.pyindex 5a463cc28..b8d78b653 100644--- a/tests/tasks/server/test_task_methods.py+++ b/tests/tasks/server/test_task_methods.py@@ -10,6 +10,7 @@ from __future__ import annotationsimport asyncioimport pytest+from docket.execution import Executionfrom fastmcp_tasks.models import UpdateTaskResultfrom mcp.shared.exceptions import MCPError@@ -112,6 +113,45 @@ async def test_tasks_cancel_transitions_to_cancelled():assert final.status in {"cancelled", "completed"}+async def test_worker_keeps_running_after_cancel_before_task_starts(+ monkeypatch: pytest.MonkeyPatch,+):+ """A cancel that lands before the worker starts a task must not stop the worker."""+ mcp = FastMCP("cancel-early-test")+ mcp.add_extension(TasksExtension())++ @mcp.tool(task=True)+ async def slow_tool() -> str:+ await asyncio.sleep(60)+ return "done"++ @mcp.tool(task=True)+ async def quick_tool(value: int) -> int:+ return value * 2++ claim = Execution.claim+ claiming = asyncio.Event()++ async def slow_claim(self: Execution, worker: str) -> bool:+ claiming.set()+ await asyncio.sleep(0.3)+ return await claim(self, worker)++ monkeypatch.setattr(Execution, "claim", slow_claim)++ async with running_task_server(mcp):+ created = await submit_task(mcp, "slow_tool", {})+ await claiming.wait()+ await cancel_task(mcp, created.task_id)+ await wait_for_task(+ mcp, created.task_id, target_states=frozenset({"cancelled"})+ )+ await asyncio.sleep(0.5)++ final = await run_task(mcp, "quick_tool", {"value": 21})+ assert final.status == "completed"++async def test_tasks_update_acks_empty():"""`tasks/update` returns an empty ack."""mcp = FastMCP("update-test")diff --git a/uv.lock b/uv.lockindex 8d89eaa8e..ad6e61e4d 100644--- a/uv.lock+++ b/uv.lock@@ -1116,7 +1116,7 @@ dependencies = [requires-dist = [{ name = "cryptography", specifier = ">=43.0.0" },{ name = "fastmcp-slim", extras = ["server"], editable = "fastmcp_slim" },- { name = "pydocket", specifier = ">=0.24.1" },+ { name = "pydocket", specifier = ">=0.26.0" },][[package]]@@ -2536,7 +2536,7 @@ wheels = [[[package]]name = "pydocket"-version = "0.24.1"+version = "0.26.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "burner-redis" },@@ -2555,9 +2555,9 @@ dependencies = [{ name = "tzdata", marker = "sys_platform == 'win32'" },{ name = "uncalled-for" },]-sdist = { url = "https://files.pythonhosted.org/packages/b7/6b/a87c6e3fd197807f630af4270aa2ce8f4c1fca4e43bba783f273d298d646/pydocket-0.24.1.tar.gz", hash = "sha256:477d77be1fcfd10ee0c2d0b8aa8c6e97851b9c7f39bb6f2b4e6d42e9b4d6e95a", size = 430759, upload-time = "2026-08-10T19:50:03.368Z" }+sdist = { url = "https://files.pythonhosted.org/packages/35/aa/a1b9b324ed010db7f9a2bc3a2f2aa03e43e8d8f404fd5305c13cb8418314/pydocket-0.26.0.tar.gz", hash = "sha256:a168adbc5ed280ed5c557bb97e7162b8ac883baca395b205dfb14494cbf85231", size = 482629, upload-time = "2026-10-02T14:26:51.811Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/a7/05/4e3b902bc0ca407188aa5fe38af49be634487aec242a77287103242e11b2/pydocket-0.24.1-py3-none-any.whl", hash = "sha256:1faa6c3d566f1f0431e35dfa12db4ccee515d945b913b516ee3e6279afb9e789", size = 130249, upload-time = "2026-08-10T19:50:01.627Z" },+ { url = "https://files.pythonhosted.org/packages/90/81/8b90fcb6ab7d8abb86ed81c26efb9d70494b9be3a9dcf7b78ee77fa1db46/pydocket-0.26.0-py3-none-any.whl", hash = "sha256:63051711f56912dde81f794ddac6430cfe187e9b7f241f967fdfb78d00737734", size = 142764, upload-time = "2026-10-02T14:26:50.101Z" },][[package]]