MCPcopy Create free account
hub / github.com/github/gh-aw / BuildPrioritizedErrorReportFromMessages

Function BuildPrioritizedErrorReportFromMessages

pkg/workflow/error_recovery.go:125–147  ·  view source on GitHub ↗

BuildPrioritizedErrorReportFromMessages classifies, suppresses, and limits messages.

(messages []string, showAll bool)

Source from the content-addressed store, hash-verified

123
124// BuildPrioritizedErrorReportFromMessages classifies, suppresses, and limits messages.
125func BuildPrioritizedErrorReportFromMessages(messages []string, showAll bool) PrioritizedErrorReport {
126 errorRecoveryLog.Printf("Building prioritized error report: message_count=%d, show_all=%v", len(messages), showAll)
127 prioritized, suppressedCount := prioritizeErrorMessages(messages)
128 displayed := prioritized
129 if !showAll && len(displayed) > 5 {
130 errorRecoveryLog.Printf("Truncating displayed errors from %d to top 5 (set show_all=true to see all)", len(displayed))
131 displayed = displayed[:5]
132 }
133
134 report := PrioritizedErrorReport{
135 TotalCount: len(prioritized),
136 DisplayedErrors: displayed,
137 HiddenCount: len(prioritized) - len(displayed),
138 SuppressedCount: suppressedCount,
139 }
140 if len(prioritized) > 1 {
141 report.RecoveryPlan = buildRecoveryPlan(prioritized, suppressedCount)
142 }
143
144 errorRecoveryLog.Printf("Prioritized report ready: total=%d, displayed=%d, hidden=%d, suppressed=%d, has_plan=%v",
145 report.TotalCount, len(report.DisplayedErrors), report.HiddenCount, report.SuppressedCount, report.RecoveryPlan != nil)
146 return report
147}
148
149func prioritizeErrorMessages(messages []string) ([]PrioritizedError, int) {
150 candidates := make([]PrioritizedError, 0, len(messages))

Calls 3

prioritizeErrorMessagesFunction · 0.85
buildRecoveryPlanFunction · 0.85
PrintfMethod · 0.45