fix: strip <internal> tags before verdict detection, add Approved/LGTM as done markers
This commit is contained in:
@@ -43,14 +43,18 @@ function classifyReviewerVerdict(
|
|||||||
summary: string | null | undefined,
|
summary: string | null | undefined,
|
||||||
): ReviewerVerdict {
|
): ReviewerVerdict {
|
||||||
if (!summary) return 'continue';
|
if (!summary) return 'continue';
|
||||||
const firstLine = summary.trimStart().split('\n')[0].trim();
|
// Strip <internal>...</internal> tags — these are internal reasoning, not the verdict
|
||||||
// Match only at the START of the first line to avoid false positives
|
const cleaned = summary.replace(/<internal>[\s\S]*?<\/internal>/g, '').trim();
|
||||||
// from quoted/referenced status markers in the body text.
|
if (!cleaned) return 'continue';
|
||||||
if (/^\*{0,2}BLOCKED\*{0,2}\b/.test(firstLine)) return 'blocked';
|
const firstLine = cleaned.split('\n')[0].trim();
|
||||||
if (/^\*{0,2}NEEDS_CONTEXT\*{0,2}\b/.test(firstLine)) return 'needs_context';
|
// Match verdict markers at the start of the first visible line
|
||||||
if (/^\*{0,2}DONE_WITH_CONCERNS\*{0,2}\b/.test(firstLine))
|
if (/^\*{0,2}BLOCKED\*{0,2}\b/i.test(firstLine)) return 'blocked';
|
||||||
|
if (/^\*{0,2}NEEDS_CONTEXT\*{0,2}\b/i.test(firstLine)) return 'needs_context';
|
||||||
|
if (/^\*{0,2}DONE_WITH_CONCERNS\*{0,2}\b/i.test(firstLine))
|
||||||
return 'done_with_concerns';
|
return 'done_with_concerns';
|
||||||
if (/^\*{0,2}DONE\*{0,2}\b/.test(firstLine)) return 'done';
|
if (/^\*{0,2}DONE\*{0,2}\b/i.test(firstLine)) return 'done';
|
||||||
|
if (/^\*{0,2}Approved\.?\*{0,2}/i.test(firstLine)) return 'done';
|
||||||
|
if (/^\*{0,2}LGTM\*{0,2}/i.test(firstLine)) return 'done';
|
||||||
return 'continue';
|
return 'continue';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user