MCPcopy Create free account
hub / github.com/EvoMap/evolver / classifyFailure

Function classifyFailure

src/gep/issueReporter.js:123–156  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

121// Triage a failure into a root-cause bucket. Pure function over the same inputs
122// buildIssueBody already receives. Returns { bucket, reason }.
123function classifyFailure(opts) {
124 const signals = Array.isArray(opts && opts.signals) ? opts.signals : [];
125 const events = Array.isArray(opts && opts.recentEvents) ? opts.recentEvents : [];
126 const log = typeof (opts && opts.sessionLog) === 'string' ? opts.sessionLog : '';
127
128 // (a) No transcript -> the host gave evolver nothing to evolve from.
129 if (!log.trim() || HOST_NO_TRANSCRIPT_RE.test(log)) {
130 return { bucket: 'host_no_transcript', reason: 'no session transcript to evolve from' };
131 }
132
133 // (b) Host LLM-provider error surfaced in the transcript.
134 const prov = log.match(HOST_PROVIDER_ERR_RE);
135 if (prov) {
136 return { bucket: 'host_provider_error', reason: 'host LLM-provider error: ' + String(prov[0]).slice(0, 60) };
137 }
138
139 // (c) The banned gene is locally generated AND every recent failing cycle
140 // changed nothing -- a no-op "strategy" gene, not an evolver bug.
141 const banned = signals.find(function (s) { return s.startsWith('ban_gene:'); });
142 if (banned) {
143 const geneId = banned.replace('ban_gene:', '');
144 const localGene = /^sha256:/.test(geneId) || /^gene_auto_/.test(geneId);
145 const failed = events.filter(function (e) { return e && e.outcome && e.outcome.status === 'failed'; });
146 const allZeroBlast = failed.length > 0 && failed.every(function (e) {
147 const br = e.blast_radius;
148 return (e.meta && e.meta.empty_cycle) || (br && br.files === 0 && br.lines === 0);
149 });
150 if (localGene && allZeroBlast) {
151 return { bucket: 'local_gene_no_blast', reason: 'locally-generated gene ' + geneId.slice(0, 20) + '… produces no blast radius' };
152 }
153 }
154
155 return { bucket: 'unclassified', reason: '' };
156}
157
158// Remember a suppressed report locally so it is observable and dedup-tracked,
159// without opening a public issue.

Callers 2

maybeReportIssueFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected