Files
multica/server/pkg/agent
adaianddamon.zhou 4383497898 fix(agent): fail a Pi task when Pi ends the turn on an error without retrying (#7059)
Pi reports a provider call it could not complete by ending the turn with
stopReason=error and the provider text in errorMessage. When it also
decides the error is not worth retrying — 401, 429 for an exhausted
quota — it emits neither a standalone error event nor auto_retry_end,
and exits 0. Those two events were the only failure signals the adapter
recognized, and piMessage discarded stopReason at decode time, so the
run was reported completed with empty output and no error. The task was
never retried and nothing alerted; a production task closed in 6s while
the gateway was returning 429.

Decode the two fields and remember the error of the turn that just
ended. Pi emits the same stopReason before an automatic retry, so this
is cleared on turn_start and only a trailing failed turn survives to
fail the run — a retry that recovers still reports completed.

Co-authored-by: damon.zhou <[email protected]>
2026-08-17 16:25:22 +08:00
..