From 6c3afce3297a8d09f09848102122d595af3945ff Mon Sep 17 00:00:00 2001 From: mika kuns Date: Mon, 1 Jun 2026 15:20:20 +0200 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFchore(claude-do):=20Return=20confirmat?= =?UTF-8?q?ion=20payload=20from=20delete=5Ftask=20and=20cancel=5Ftask?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit delete_task (and likely cancel_task) return no output on success. Silent success is indistinguishable from a no-op, so callers can't verify the action took effect. Fix: return a small confirmation object, e.g. { deleted: true, id } / { cancelled: true, id }. Indicate not-found vs deleted distinctly. ClaudeDo-Task: 97a87ebb-0d87-4ee0-800c-aa1a0b3a06c5 --- src/ClaudeDo.Worker/External/ExternalMcpService.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ClaudeDo.Worker/External/ExternalMcpService.cs b/src/ClaudeDo.Worker/External/ExternalMcpService.cs index 4550988..c8aede6 100644 --- a/src/ClaudeDo.Worker/External/ExternalMcpService.cs +++ b/src/ClaudeDo.Worker/External/ExternalMcpService.cs @@ -10,6 +10,8 @@ using TaskStatus = ClaudeDo.Data.Models.TaskStatus; namespace ClaudeDo.Worker.External; public sealed record TaskListDto(string Id, string Name, string? WorkingDir); +public sealed record DeleteTaskResult(bool Deleted, string Id); +public sealed record CancelTaskResult(bool Cancelled, string Id); public sealed record TaskDto( string Id, @@ -206,16 +208,16 @@ public sealed class ExternalMcpService await _broadcaster.TaskUpdated(taskId); } - [McpServerTool, Description("Cancel a running task. Returns true if the task was running and cancellation was requested.")] - public async Task CancelTask(string taskId, CancellationToken cancellationToken) + [McpServerTool, Description("Cancel a running task. Returns { cancelled: true, id } if the task was running and cancellation was requested; cancelled is false if the task was not running.")] + public async Task CancelTask(string taskId, CancellationToken cancellationToken) { var cancelled = _queue.CancelTask(taskId); if (cancelled) await _broadcaster.TaskUpdated(taskId); - return cancelled; + return new CancelTaskResult(cancelled, taskId); } - [McpServerTool, Description("Delete a task. Refuses if the task is currently Running — cancel it first.")] - public async Task DeleteTask(string taskId, CancellationToken cancellationToken) + [McpServerTool, Description("Delete a task. Returns { deleted: true, id } on success. Throws if the task is not found or is currently Running — cancel it first.")] + public async Task DeleteTask(string taskId, CancellationToken cancellationToken) { var task = await _tasks.GetByIdAsync(taskId, cancellationToken) ?? throw new InvalidOperationException($"Task {taskId} not found."); @@ -224,6 +226,7 @@ public sealed class ExternalMcpService await _tasks.DeleteAsync(taskId, cancellationToken); await _broadcaster.TaskUpdated(taskId); + return new DeleteTaskResult(true, taskId); } private static TaskDto ToDto(TaskEntity t) => new(