Files
multica/server/internal/daemon
92403438ff MUL-7460 fix(daemon): stop sending an English sentence for a cancelled task (#8506)
* fix(daemon): stop sending an English sentence for a cancelled task

A server-cancelled task carried the comment "task cancelled by server".
reportTaskResult forwards that comment as the task's `error`, which the
web UI renders verbatim in the "Technical details" fold and in the chat
"Show details" block — so a French, Japanese, Korean or Chinese reader
got an English sentence under a translated heading.

Nothing is lost by dropping it. The "cancelled" status already yields
failure_reason "cancelled" a few lines later, independently of the
comment, and that code is localized in all five shipped locales
(FAILURE_REASON_I18N_KEYS; "Annulée par le système" in fr). The sentence
said the same thing, only worse, and only in English.

The comment also stops quoting the removed string so a future grep for
it does not lead back to a line that no longer produces it.

No test: this removes a literal on a defensive branch that handleTask's
cancelledByPoll path normally discards, and the surviving behaviour —
failure_reason "cancelled" rendering through failureReasonLabel — is
already covered on the frontend. Verified by build, vet, gofmt and
./internal/daemon, whose two failures reproduce unchanged on main.

* fix(autopilot): use the shared failure reason helper when a task fails or is cancelled

taskFailureReasonForAutopilotRun trims the raw error and falls back to
the localized failure_reason, so an empty task.Error no longer writes
blank failure_reason onto the autopilot run.

* fix(daemon): correct the misleading comment on the cancelled branch

What reaches the server here is the daemon's own context cancellation
(server cancel or daemon shutdown); a user cancel or reassignment is
discarded earlier by handleTask's cancelledByPoll branch.

---------

Co-authored-by: Atelier Nuvio <[email protected]>
Co-authored-by: Hermes Agent <[email protected]>
2026-10-19 02:02:31 -04:00
..