Recognize first-person reviewer rejections

Do not accept a contradictory completion receipt when the reviewer explicitly says they cannot approve. Verified task graph and focused V4 tests plus git diff --check.
This commit is contained in:
Ryder Sun committed 2026-11-08 00:07:49 +08:00
1 parent 69553895f7
commit 9d0d89dd12
3 files changed
+10 -2

No files matched your search

@@ -6,8 +6,8 @@ function explicitReviewRejection(text) {
const line = rawLine.trim()
if (/^(?:```|~~~)/.test(line)) { inCodeBlock = !inCodeBlock; return false }
if (inCodeBlock || line.startsWith('>')) return false
return /(?:^|[.!?;;。!?])\s*(?:do not|don't)\s+approve\b/i.test(line)
|| /(?:^|[.!?;;。!?])\s*(?:不要|不能|不应|不予)批准/u.test(line)
return /(?:^|[.!?;;。!?])\s*(?:(?:i|we)\s+)?(?:do not|don't|cannot|can't)\s+approve\b/i.test(line)
|| /(?:^|[.!?;;。!?])\s*(?:我|我们)?(?:不|不要|不能|不应|不予|无法)批准/u.test(line)
})
}
@@ -24,6 +24,10 @@ test('task graph rejects an explicit reviewer objection despite a completed run'
const result = { message: { content: 'The required tests fail; do not approve.', trace: { status: 'completed' } } }
const refs = { artifactIds: [], evidenceIds: [] }
assert.equal(taskGraphMethods.taskGraphResultAccepted(node, result, {}, refs), false)
result.message.content = 'I cannot approve this result.'
assert.equal(taskGraphMethods.taskGraphResultAccepted(node, result, {}, refs), false)
result.message.content = '我们不批准这份结果。'
assert.equal(taskGraphMethods.taskGraphResultAccepted(node, result, {}, refs), false)
result.message.content = '> Do not approve.\nThat old instruction is superseded; the result is acceptable.'
assert.equal(taskGraphMethods.taskGraphResultAccepted(node, result, {}, refs), true)
})
@@ -269,6 +269,10 @@ test('an explicit reviewer rejection cannot approve the candidate through a cont
assert.equal(runner.v4NaturalConsensus(group, { runId: 'run' }, 'task'), null)
messages[1].content = '测试未通过;不予批准。'
assert.equal(runner.v4NaturalConsensus(group, { runId: 'run' }, 'task'), null)
messages[1].content = 'I cannot approve this candidate.'
assert.equal(runner.v4NaturalConsensus(group, { runId: 'run' }, 'task'), null)
messages[1].content = '我们不批准这份结果。'
assert.equal(runner.v4NaturalConsensus(group, { runId: 'run' }, 'task'), null)
messages[1].content = '> Do not approve.\nThe quoted instruction is outdated; I approve the candidate.'
assert.equal(runner.v4NaturalConsensus(group, { runId: 'run' }, 'task').approvedKinds.size, 2)
messages[1].content = '```\nDo not approve.\n```\nThe example is outdated; I approve the candidate.'