Repository navigation
Add answer-quality scoring to compare suite summaries - #239
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📝 WalkthroughWalkthroughThis PR adds deterministic answer-quality scoring to native_agent compare reports. The feature loads optional ChangesAnswer-quality gating for native_agent compare
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/infrastructure/compare.ts (1)
2556-2559:⚠️ Potential issue | 🟠 Major | ⚡ Quick winPreserve
answer_qualityoutput foranswer_onlynative-agent runs.This early return skips the new deterministic gate details whenever either side is
answer_only. That path is already treated as a supported native-agent result elsewhere, so suite summaries will silently omitanswer_qualityeven thoughexecuteNativeAgentCompare()computed and persisted it.💡 Suggested fix
- if (report.baseline.kind === 'answer_only' || report.graphify.kind === 'answer_only') { - lines.push(`- "${report.question}" → answer-only run saved; no Anthropic usage block was available, so provider-proof reductions were not computed (see ${portablePath(report.paths.report)})`) - continue - } + const isAnswerOnlyRun = report.baseline.kind === 'answer_only' || report.graphify.kind === 'answer_only' + if (isAnswerOnlyRun) { + lines.push( + `- "${report.question}" → answer-only run saved; no Anthropic usage block was available, so provider-proof reductions were not computed (see ${portablePath(report.paths.report)})`, + ) + if (report.answer_quality) { + const baselineFindings = [ + ...report.answer_quality.baseline.missing_required_terms.map((term) => `missing ${term}`), + ...report.answer_quality.baseline.forbidden_terms_present.map((term) => `forbidden ${term}`), + ] + const graphifyFindings = [ + ...report.answer_quality.graphify.missing_required_terms.map((term) => `missing ${term}`), + ...report.answer_quality.graphify.forbidden_terms_present.map((term) => `forbidden ${term}`), + ] + lines.push( + ` answer quality: baseline ${report.answer_quality.baseline.passed ? 'PASS' : `FAIL (${baselineFindings.join(', ')})`} · graphify ${report.answer_quality.graphify.passed ? 'PASS' : `FAIL (${graphifyFindings.join(', ')})`}${report.answer_quality.manual_review_notes.length > 0 ? ` · manual review: ${formatCount(report.answer_quality.manual_review_notes.length, 'note', 'notes')}` : ''}`, + ) + } + continue + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/infrastructure/compare.ts` around lines 2556 - 2559, The current early-continue that checks report.baseline.kind === 'answer_only' || report.graphify.kind === 'answer_only' both suppresses provider-proof reduction text and also prevents emitting the previously-computed answer_quality for native-agent runs; change the handling so we still preserve and emit answer_quality from executeNativeAgentCompare() while only skipping the provider-proof reduction block. Concretely, in the block that references report.baseline.kind/report.graphify.kind and portablePath(report.paths.report), remove the unconditional continue and instead push the “answer-only run saved; no Anthropic usage block…” message but allow the subsequent code that writes deterministic gate / answer_quality details (the code that reads report.answer_quality or calls executeNativeAgentCompare results) to run; if necessary, guard only the provider-proof reduction logic with the answer_only condition rather than the entire early-return.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/infrastructure/compare.ts`:
- Around line 2556-2559: The current early-continue that checks
report.baseline.kind === 'answer_only' || report.graphify.kind === 'answer_only'
both suppresses provider-proof reduction text and also prevents emitting the
previously-computed answer_quality for native-agent runs; change the handling so
we still preserve and emit answer_quality from executeNativeAgentCompare() while
only skipping the provider-proof reduction block. Concretely, in the block that
references report.baseline.kind/report.graphify.kind and
portablePath(report.paths.report), remove the unconditional continue and instead
push the “answer-only run saved; no Anthropic usage block…” message but allow
the subsequent code that writes deterministic gate / answer_quality details (the
code that reads report.answer_quality or calls executeNativeAgentCompare
results) to run; if necessary, guard only the provider-proof reduction logic
with the answer_only condition rather than the entire early-return.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c5b2e478-1a44-4571-8f46-437c6836925d
📒 Files selected for processing (3)
docs/proof-workflows.mdsrc/infrastructure/compare.tstests/unit/compare.test.ts
Summary
Test Plan
Fixes #233
Summary by CodeRabbit
New Features
Documentation
Tests