fix: match verdict markers only at start of first line to prevent false positives
This commit is contained in:
@@ -44,10 +44,12 @@ function classifyReviewerVerdict(
|
|||||||
): ReviewerVerdict {
|
): ReviewerVerdict {
|
||||||
if (!summary) return 'continue';
|
if (!summary) return 'continue';
|
||||||
const firstLine = summary.trimStart().split('\n')[0].trim();
|
const firstLine = summary.trimStart().split('\n')[0].trim();
|
||||||
if (/\bBLOCKED\b/.test(firstLine)) return 'blocked';
|
// Match only at the START of the first line to avoid false positives
|
||||||
if (/\bNEEDS_CONTEXT\b/.test(firstLine)) return 'needs_context';
|
// from quoted/referenced status markers in the body text.
|
||||||
if (/\bDONE_WITH_CONCERNS\b/.test(firstLine)) return 'done_with_concerns';
|
if (/^\*{0,2}BLOCKED\*{0,2}\b/.test(firstLine)) return 'blocked';
|
||||||
if (/\bDONE\b/.test(firstLine)) return 'done';
|
if (/^\*{0,2}NEEDS_CONTEXT\*{0,2}\b/.test(firstLine)) return 'needs_context';
|
||||||
|
if (/^\*{0,2}DONE_WITH_CONCERNS\*{0,2}\b/.test(firstLine)) return 'done_with_concerns';
|
||||||
|
if (/^\*{0,2}DONE\*{0,2}\b/.test(firstLine)) return 'done';
|
||||||
return 'continue';
|
return 'continue';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,9 +265,16 @@ export function completePairedExecutionContext(args: {
|
|||||||
if (status !== 'succeeded') {
|
if (status !== 'succeeded') {
|
||||||
if (role === 'reviewer' && args.summary) {
|
if (role === 'reviewer' && args.summary) {
|
||||||
const verdict = classifyReviewerVerdict(args.summary);
|
const verdict = classifyReviewerVerdict(args.summary);
|
||||||
if (verdict === 'done' || verdict === 'blocked' || verdict === 'needs_context') {
|
if (
|
||||||
|
verdict === 'done' ||
|
||||||
|
verdict === 'blocked' ||
|
||||||
|
verdict === 'needs_context'
|
||||||
|
) {
|
||||||
const now = new Date().toISOString();
|
const now = new Date().toISOString();
|
||||||
updatePairedTask(taskId, { status: verdict === 'done' ? 'merge_ready' : 'completed', updated_at: now });
|
updatePairedTask(taskId, {
|
||||||
|
status: verdict === 'done' ? 'merge_ready' : 'completed',
|
||||||
|
updated_at: now,
|
||||||
|
});
|
||||||
logger.info(
|
logger.info(
|
||||||
{ taskId, verdict, summary: args.summary?.slice(0, 100) },
|
{ taskId, verdict, summary: args.summary?.slice(0, 100) },
|
||||||
'Reviewer verdict detected from failed execution — stopping ping-pong',
|
'Reviewer verdict detected from failed execution — stopping ping-pong',
|
||||||
|
|||||||
Reference in New Issue
Block a user