MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / logAutoRunFinalSummary

Function logAutoRunFinalSummary

background/auto-run-controller.js:95–136  ·  view source on GitHub ↗
(totalRuns, roundSummaries = [])

Source from the content-addressed store, hash-verified

93 }
94
95 async function logAutoRunFinalSummary(totalRuns, roundSummaries = []) {
96 const summaries = buildAutoRunRoundSummaries(totalRuns, roundSummaries);
97 const successRounds = summaries.filter((item) => item.status === 'success');
98 const failedRounds = summaries.filter((item) => item.status === 'failed');
99 const pendingRounds = summaries.filter((item) => item.status === 'pending');
100
101 await addLog('=== 自动运行汇总 ===', failedRounds.length ? 'warn' : 'ok');
102 await addLog(
103 `总轮数:${totalRuns};成功:${successRounds.length};失败:${failedRounds.length};未完成:${pendingRounds.length}`,
104 failedRounds.length ? 'warn' : 'ok'
105 );
106
107 if (successRounds.length) {
108 await addLog(
109 `成功轮次:${successRounds
110 .map((item) => `第 ${item.round} 轮(重试 ${getAutoRunRoundRetryCount(item)} 次)`)
111 .join(';')}`,
112 'ok'
113 );
114 }
115
116 if (failedRounds.length) {
117 await addLog(
118 `失败轮次:${failedRounds
119 .map((item) => {
120 const retryCount = getAutoRunRoundRetryCount(item);
121 const finalReason = item.finalFailureReason || item.failureReasons[item.failureReasons.length - 1] || '未知错误';
122 const reasonSummary = formatAutoRunFailureReasons(item.failureReasons);
123 return `第 ${item.round} 轮(重试 ${retryCount} 次,最终原因:${finalReason};失败记录:${reasonSummary})`;
124 })
125 .join(';')}`,
126 'error'
127 );
128 }
129
130 if (pendingRounds.length) {
131 await addLog(
132 `未完成轮次:${pendingRounds.map((item) => `第 ${item.round} 轮`).join(';')}`,
133 'warn'
134 );
135 }
136 }
137
138 async function skipAutoRunCountdown() {
139 const state = await getState();

Callers 1

autoRunLoopFunction · 0.70

Calls 4

addLogFunction · 0.70

Tested by

no test coverage detected