(opts)
| 190 | } |
| 191 | |
| 192 | function buildIssueBody(opts) { |
| 193 | const fp = opts.envFingerprint || captureEnvFingerprint(); |
| 194 | const signals = opts.signals || []; |
| 195 | const recentEvents = opts.recentEvents || []; |
| 196 | const sessionLog = opts.sessionLog || ''; |
| 197 | const streakCount = extractStreakCount(signals); |
| 198 | const errorSig = extractErrorSignature(signals); |
| 199 | const nodeId = truncateNodeId(getNodeId()); |
| 200 | |
| 201 | const failureSignals = signals.filter(function (s) { |
| 202 | return s.startsWith('recurring_') || |
| 203 | s.startsWith('consecutive_failure') || |
| 204 | s.startsWith('failure_loop') || |
| 205 | s.startsWith('high_failure') || |
| 206 | s.startsWith('ban_gene:') || |
| 207 | s === 'force_innovation_after_repair_loop'; |
| 208 | }).join(', '); |
| 209 | |
| 210 | const sanitizedLog = redactString( |
| 211 | typeof sessionLog === 'string' ? sessionLog.slice(-MAX_LOG_CHARS) : '' |
| 212 | ); |
| 213 | |
| 214 | const eventsTable = formatRecentEvents(recentEvents); |
| 215 | |
| 216 | const reportId = crypto.createHash('sha256') |
| 217 | .update(nodeId + '|' + Date.now() + '|' + errorSig) |
| 218 | .digest('hex').slice(0, 12); |
| 219 | |
| 220 | const body = [ |
| 221 | '## Environment', |
| 222 | '- **Evolver Version:** ' + (fp.evolver_version || 'unknown'), |
| 223 | '- **Node.js:** ' + (fp.node_version || process.version), |
| 224 | '- **Platform:** ' + (fp.platform || process.platform) + ' ' + (fp.arch || process.arch), |
| 225 | '- **Container:** ' + (fp.container ? 'yes' : 'no'), |
| 226 | '', |
| 227 | '## Failure Summary', |
| 228 | '- **Consecutive failures:** ' + (streakCount || 'N/A'), |
| 229 | '- **Failure signals:** ' + (failureSignals || 'none'), |
| 230 | '', |
| 231 | '## Error Signature', |
| 232 | '```', |
| 233 | redactString(errorSig), |
| 234 | '```', |
| 235 | '', |
| 236 | '## Recent Evolution Events (sanitized)', |
| 237 | eventsTable, |
| 238 | '', |
| 239 | '## Session Log Excerpt (sanitized)', |
| 240 | '```', |
| 241 | sanitizedLog || '_No session log available._', |
| 242 | '```', |
| 243 | '', |
| 244 | '---', |
| 245 | '_This issue was automatically created by evolver v' + (fp.evolver_version || 'unknown') + '._', |
| 246 | '_Device: ' + nodeId + ' | Report ID: ' + reportId + '_', |
| 247 | ]; |
| 248 | |
| 249 | return body.join('\n'); |
no test coverage detected