fix: improve report readability, evidence/turn parsing, and extension text extraction - #241
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe PR improves verdict parsing, expands judge reasoning requirements, changes report reasoning and evidence rendering, adds parser coverage, and preserves rendered structure when extracting text from browser frame snapshots. ChangesVerdict, reasoning, and rendered text
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
core/src/evaluators/verdictParser.ts (1)
176-181: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression tests for the new input forms.
Cover
FailingTurns: [4],Failing Turns: [4], andFailingTurns: (4)(5). Assert thatfailingTurnscontains numeric, deduplicated, sorted indices.core/src/evaluators/judge.tsuses this parser for judge output, andJudgeResultSchemadefines the downstream numeric-array contract.🤖 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 `@core/src/evaluators/verdictParser.ts` around lines 176 - 181, Add regression tests for the verdict parser covering FailingTurns: [4], Failing Turns: [4], and FailingTurns: (4)(5). Assert that the parsed failingTurns values are numeric arrays with duplicates removed and indices sorted, exercising the parser used by judge.ts and matching the JudgeResultSchema contract.
🤖 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.
Inline comments:
In `@core/src/prompts/judge-agent.ts`:
- Around line 14-15: Update the PASS explanation requirements in
JUDGE_AGENT_SYSTEM so they require confirming that the evaluator-specific
failure mode did not occur, rather than universally claiming no data, pathway,
or internal detail was exposed. Preserve accurate operational disclosures
permitted by the evaluator, especially for misinformation and data-poisoning
checks, while retaining plain-language explanations.
In `@runners/extension/frame_snapshot.js`:
- Around line 177-182: Update the leaf-text condition in the node traversal
around normalizeBlockText so the normalized text variable is only pushed when
its length is between MIN_MSG and MAX_MSG. Preserve the existing rawText and
blockTextChildren checks, and ensure oversized blockAwareText output is excluded
from out.
- Around line 126-132: The list-marker logic in collectText/blockAwareText
currently only handles descendant li nodes, so leaf list items lose their
markers. Process the current li before walking its children, preserving
unordered markers and ordered-list start handling, and use li[value] as the
ordered label when present before falling back to the parent ol start plus
index.
---
Nitpick comments:
In `@core/src/evaluators/verdictParser.ts`:
- Around line 176-181: Add regression tests for the verdict parser covering
FailingTurns: [4], Failing Turns: [4], and FailingTurns: (4)(5). Assert that the
parsed failingTurns values are numeric arrays with duplicates removed and
indices sorted, exercising the parser used by judge.ts and matching the
JudgeResultSchema contract.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 887683d0-304e-49db-aa62-77684604c797
📒 Files selected for processing (4)
core/src/evaluators/verdictParser.tscore/src/prompts/judge-agent.tscore/src/report/render.tsrunners/extension/frame_snapshot.js
|
Addressed the nitpick on |
Problem
The
opfor runHTML report had several usability issues that made it harder for non-technical readers (QA, PMs) to trust and act on a report:HIGH/CRITICAL/etc.) rendered with the wrong font — it silently inheritedwhite-space: nowrapand a monospacefont-familyfrom the.sev-tagbadge it's nested in, so the tooltip text ran off the box instead of wrapping, and looked visually inconsistent with every other tooltip in the report (e.g. the Safety Score tooltip in the executive summary).Reasoningtext was dense, technical, and didn't lead with a plain-language summary of what actually broke — a non-technical reader had to parse jargon like "unauthorized data exposure via unverified role claim" to understand the finding.Evidencesection duplicated whatReasoning(plus the red turn marker) already conveyed, adding a second wall of text to every finding without much added value in the HTML display.FailingTurns— the field that drives the red "breached" highlighting on turn markers — was frequently empty even when the judge's ownReasoningclearly named the failing turn. Root cause: the parser's label regex only matched the unspacedFailingTurns:token, not the more naturalFailing Turns:a model is likely to write, and bracketed values ([4],(4)) failed to parse at all (or, worse, silently concatenated into a wrong number for adjacent bracket groups).textContent, which collapses every<br>/<p>/<li>boundary into a single space — so multi-line and list-formatted replies were captured as one run-on string instead of preserving headings/bullets/line breaks.Solution
.info-tooltip'swhite-spaceandfont-familyexplicitly instead of relying on inherited values from whatever it happens to be nested inside.Reasoningprompt: sentence 1 must now state in plain language what broke (naming the turn(s) and what the attacker got, without technical shorthand), remaining sentences walk through it in plain words, jargon is banned unless explained inline. Widened from 2-4 to 3-6 sentences to give the plain-language version room to breathe.Evidencesection from the HTML report (the underlyingjudge.evidencefield is untouched — it's still parsed, still in the JSON report and still requested from the judge as a grounding/anti-hallucination mechanism, just not displayed).FailingTurnsparsing more tolerant: the label regex now accepts an optional space (Failing Turns:), and bracket characters are replaced with a space (not deleted) so adjacent bracketed groups can't silently concatenate into the wrong number.blockAwareText) to the extension's DOM snapshotting: inserts line breaks at<br>and block-element boundaries, and-/ numbered markers (respecting<ol start="N">) for list items, so captured transcript text keeps its shape instead of flattening to one line.Changes
core/src/report/render.ts— tooltip CSS fixes, Evidence section removed, Reasoning given a dedicated, larger/higher-contrast stylecore/src/prompts/judge-agent.ts— plain-language Reasoning instructions + rewritten examplescore/src/evaluators/verdictParser.ts—FailingTurnslabel regex + bracket-handling fixesrunners/extension/frame_snapshot.js— block-aware text extraction for the browser extension's response captureIssue
N/A
How to test
npm run buildfrom repo root.*-report.html:npm test --workspace=core— all existingverdictParsergolden tests pass unchanged; no new regressions.runners/extensionunpacked, run against a chat widget that renders a numbered/bulleted list or multi-paragraph reply, confirm the captured transcript preserves line breaks/bullets instead of one run-on string.Screenshots
N/A — text/behavior changes, best verified by generating a report per the steps above.
Summary by CodeRabbit
Bug Fixes
UI Improvements
Documentation