fix(agent): auto-recover outcome is failed when a recovery action itself fails

When download.recheck / task.retry was executed but errored (e.g. the
downloader was unreachable), applyRecoveryOutcome only looked at
succeeded actions and recorded outcome=not_attempted with the summary
"没有执行恢复动作", which is false. Record outcome=failed and name the
failed action instead. Needs image rebuild to take effect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 01:21:37 +08:00
1 parent 57fe4c11d3
commit 4b6da1343a
1 file changed
+6 -2
+6 -2
View File
@@ -375,14 +375,18 @@ export async function applyRecoveryOutcome(
else if (check?.state === "recovered") outcome = "recovered";
else if (check?.state === "failed") outcome = "failed";
else if (done.length > 0) outcome = "unverified";
// 恢复动作执行了但本身失败(如下载器不可达):算 failed,不能写成"没有执行恢复动作"
else if (acts.actions.length > 0) outcome = "failed";
else if (res.reason === "budget") outcome = "budget_exceeded";
else outcome = "not_attempted";
const what = done.map((a) => a.capabilityId).join(" + ");
const what = (done.length > 0 ? done : acts.actions).map((a) => a.capabilityId).join(" + ");
const summary =
outcome === "recovered"
? `已恢复(系统核实):执行 ${what} 后业务状态已恢复。`
: outcome === "failed"
? `未恢复:执行 ${what} 后业务状态仍为失败,已退回待处理。`
? done.length > 0
? `未恢复:执行 ${what} 后业务状态仍为失败,已退回待处理。`
: `未恢复:${what} 执行失败,已退回待处理。`
: outcome === "unverified"
? `未恢复:执行 ${what} 后在核实时限内业务状态未恢复,已退回待处理。`
: outcome === "budget_exceeded"