mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-05 13:29:44 +02:00
When the server cancels a task (e.g. assignee changes during execution, explicit user cancel, or workspace_isolation check fail), the daemon's cancellation poll fires runCancel() on the run context. The drainCtx derived from runCtx then signals Done(), but executeAndDrain() was returning Status: "timeout" regardless of *why* the context ended. The "agent finished status=timeout" log line is then misleading — it suggests an actual deadline timeout when really the task was cancelled by upstream. We spent hours misdiagnosing a healthy handoff as a broken timeout because of this. Distinguish context.Canceled from context.DeadlineExceeded in executeAndDrain, and add a "cancelled" case to runTask so the status propagates through the existing log path. No behaviour change for genuine timeouts; no behaviour change for the cancelled-by-poll discard path in handleTask. Only the daemon log line and TaskResult.Status get the more accurate label.