Repository navigation
fix(advisor): focus PR review comments - #4083
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughRemoves gate/E2E fields and waiting behavior; extends analyzer to compute monolith deltas, drift evidence, and prior-advisor comparisons; updates schema, prompt, normalization, rendering (summary + detailed), condensed PR comments, tests, README, and workflow bootstrap outputs. ChangesPR Review Advisor Schema and Analysis Refactor
Sequence Diagram(s)sequenceDiagram
participant Workflow as GitHub Actions Workflow
participant Analyzer as pr-review-advisor/analyze.mts
participant GitHubAPI as GitHub API (PRs, Comments, Files)
participant Model as LLM
participant Artifact as Artifacts (summary.md, detailed-review.md)
Workflow->>Analyzer: run analyzer from trusted checkout
Analyzer->>GitHubAPI: fetch PR, comments, open PR list, file contents
Analyzer->>Analyzer: computeMonolithDeltas(), collectDriftEvidence(), collectOpenPrOverlaps()
Analyzer->>Model: send system prompt + deterministic context
Model->>Analyzer: return structured review result
Analyzer->>Artifact: write pr-review-advisor-summary.md and pr-review-advisor-detailed-review.md
Analyzer->>Workflow: buildComment() → post/update sticky comment
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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 `@test/pr-review-advisor.test.ts`:
- Around line 228-239: The test passes a precomputed summary string along with a
different result object to buildComment, causing parameter inconsistency;
regenerate the summary from the result that includes sinceLastReview (i.e., call
whatever produces summary from normalizeReviewResult(validResult(...)) and use
that new summary variable) or, if buildComment intentionally prefers result when
sinceLastReview exists, update the test to either remove the old summary
parameter or add an explanatory comment; locate the followUp test code around
buildComment, the summary variable creation, and the
normalizeReviewResult/validResult calls to make this change.
In `@tools/pr-review-advisor/analyze.mts`:
- Around line 754-756: The generated markdown headings include emoji; update the
three appendFindings calls to use plain-text headings without emoji (replace
"🛠️ Needs attention" with "Needs attention", "🔎 Worth checking" with "Worth
checking", and "🌱 Nice ideas" with "Nice ideas") so that appendFindings(lines,
...) in analyze.mts emits emoji-free section titles; also scan for other usages
of those exact emoji-prefixed strings to ensure the summary and
pr-review-advisor-summary.md output follow the "No emoji in technical prose"
guideline.
- Around line 444-451: The renameHints parsing uses a regex against the whole
line which misses tab-separated --name-status formats like "M\tpath" and can
false-match suffixes; instead, after obtaining gitOutput in renameHints, split
each non-empty line on "\t" and parse the status field and path fields (for
"R\d+" expect two paths: old and new; for "A","D","M" expect one path),
normalize each path using the same logic as normalizedFile (replace leading "./"
and backslashes) and compare the normalized path(s) for exact equality to
normalizedFile; keep the existing filtering rules, limit and slice behavior, and
still cap results to 20 as before.
In `@tools/pr-review-advisor/comment.mts`:
- Line 25: The type for items in ReviewAdvisorResult.findings is missing a title
field used by topFindingTitle(); update the local findings item type from
Array<{ severity?: string }> to include title?: string (e.g., Array<{ severity?:
string; title?: string }>), so accesses to finding.title in topFindingTitle()
are type-safe; adjust any related references to the findings item type (e.g.,
where ReviewAdvisorResult or its findings are declared) to use the updated
shape.
- Around line 81-83: The message uses runUrl to claim a "Full AC/security review
artifact" which is incorrect; update the details assignment (variable details)
to either use the actual artifact URL (if you have an artifactUrl
variable/return value available) or relabel the link text to indicate it's the
workflow run (e.g., "Workflow run details") when using runUrl, ensuring the text
no longer promises an artifact that may not exist.
🪄 Autofix (Beta)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: dbe2c614-7a0f-4649-b349-0893ce73a251
📒 Files selected for processing (6)
.github/workflows/pr-review-advisor.yamltest/pr-review-advisor.test.tstools/pr-review-advisor/README.mdtools/pr-review-advisor/analyze.mtstools/pr-review-advisor/comment.mtstools/pr-review-advisor/schema.json
| const followUp = buildComment({ | ||
| summary, | ||
| result: normalizeReviewResult(validResult({ | ||
| summary: { | ||
| recommendation: "merge_after_fixes", | ||
| confidence: "high", | ||
| oneLine: "Follow-up review completed.", | ||
| sinceLastReview: { resolved: 1, stillApplies: 1, newItems: 1 }, | ||
| }, | ||
| }), metadata()), | ||
| }); | ||
| expect(followUp).toContain("**Since last review:** 1 prior item resolved, 1 still applies, 1 new item found"); |
There was a problem hiding this comment.
Verify the summary/result parameter consistency in the follow-up test.
The test passes the summary markdown generated from the original result (line 195) alongside a new result object that contains different data (including sinceLastReview). This creates a mismatch between the two parameters.
If buildComment uses both parameters, the summary markdown should be regenerated from the new result to ensure consistency.
🔍 Suggested verification
const followUp = buildComment({
- summary,
+ summary: renderSummary(normalizeReviewResult(validResult({
+ summary: {
+ recommendation: "merge_after_fixes",
+ confidence: "high",
+ oneLine: "Follow-up review completed.",
+ sinceLastReview: { resolved: 1, stillApplies: 1, newItems: 1 },
+ },
+ }), metadata())),
result: normalizeReviewResult(validResult({
summary: {
recommendation: "merge_after_fixes",
confidence: "high",
oneLine: "Follow-up review completed.",
sinceLastReview: { resolved: 1, stillApplies: 1, newItems: 1 },
},
}), metadata()),
});Alternatively, if buildComment only uses result when sinceLastReview is present and ignores the summary parameter in that case, add a comment explaining this behavior to clarify the test intent.
🤖 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 `@test/pr-review-advisor.test.ts` around lines 228 - 239, The test passes a
precomputed summary string along with a different result object to buildComment,
causing parameter inconsistency; regenerate the summary from the result that
includes sinceLastReview (i.e., call whatever produces summary from
normalizeReviewResult(validResult(...)) and use that new summary variable) or,
if buildComment intentionally prefers result when sinceLastReview exists, update
the test to either remove the old summary parameter or add an explanatory
comment; locate the followUp test code around buildComment, the summary variable
creation, and the normalizeReviewResult/validResult calls to make this change.
| const normalizedFile = file.replace(/^\.\//, "").replace(/\\/g, "/"); | ||
| const escapedFile = normalizedFile.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
| const filePathPattern = new RegExp(`(^|/)${escapedFile}(\\s|$)`); | ||
| const renameHints = (gitOutput([["log", "--oneline", "--name-status", "--find-renames", "-40", baseRef, "--"]], 120000) || "") | ||
| .split("\n") | ||
| .map((line) => line.trim()) | ||
| .filter((line) => /^(R\d+|A|D|M)\s/.test(line) && filePathPattern.test(line.replace(/\\/g, "/"))) | ||
| .slice(0, 20); |
There was a problem hiding this comment.
Parse --name-status entries by field instead of regex-matching the whole line.
M\tpath/to/file.ts and A\tpath/to/file.ts do not satisfy (^|/)${escapedFile}(\s|$), so exact-file drift hints are usually missed, while suffix matches from other paths can slip through. Split on tabs and compare the old/new paths directly.
Suggested fix
const normalizedFile = file.replace(/^\.\//, "").replace(/\\/g, "/");
- const escapedFile = normalizedFile.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
- const filePathPattern = new RegExp(`(^|/)${escapedFile}(\\s|$)`);
const renameHints = (gitOutput([["log", "--oneline", "--name-status", "--find-renames", "-40", baseRef, "--"]], 120000) || "")
.split("\n")
.map((line) => line.trim())
- .filter((line) => /^(R\d+|A|D|M)\s/.test(line) && filePathPattern.test(line.replace(/\\/g, "/")))
+ .filter((line) => {
+ const normalized = line.replace(/\\/g, "/");
+ const [status, ...paths] = normalized.split("\t");
+ if (!/^(R\d+|A|D|M)$/.test(status || "")) return false;
+ return paths.some((path) => path === normalizedFile);
+ })
.slice(0, 20);🤖 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 `@tools/pr-review-advisor/analyze.mts` around lines 444 - 451, The renameHints
parsing uses a regex against the whole line which misses tab-separated
--name-status formats like "M\tpath" and can false-match suffixes; instead,
after obtaining gitOutput in renameHints, split each non-empty line on "\t" and
parse the status field and path fields (for "R\d+" expect two paths: old and
new; for "A","D","M" expect one path), normalize each path using the same logic
as normalizedFile (replace leading "./" and backslashes) and compare the
normalized path(s) for exact equality to normalizedFile; keep the existing
filtering rules, limit and slice behavior, and still cap results to 20 as
before.
| appendFindings(lines, "🛠️ Needs attention", blockers); | ||
| appendFindings(lines, "🔎 Worth checking", warnings); | ||
| appendFindings(lines, "🌱 Nice ideas", suggestions); |
There was a problem hiding this comment.
Remove emoji from the generated markdown section headings.
These labels are emitted into pr-review-advisor-summary.md, so the summary currently violates the markdown prose rule.
As per coding guidelines "No emoji in technical prose."
🤖 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 `@tools/pr-review-advisor/analyze.mts` around lines 754 - 756, The generated
markdown headings include emoji; update the three appendFindings calls to use
plain-text headings without emoji (replace "🛠️ Needs attention" with "Needs
attention", "🔎 Worth checking" with "Worth checking", and "🌱 Nice ideas" with
"Nice ideas") so that appendFindings(lines, ...) in analyze.mts emits emoji-free
section titles; also scan for other usages of those exact emoji-prefixed strings
to ensure the summary and pr-review-advisor-summary.md output follow the "No
emoji in technical prose" guideline.
| newItems?: number; | ||
| }; | ||
| }; | ||
| findings?: Array<{ severity?: string }>; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C2 'findings\?: Array<\{ severity\?: string \}>' tools/pr-review-advisor/comment.mts
rg -n -C2 'topFindingTitle|\.title' tools/pr-review-advisor/comment.mtsRepository: NVIDIA/NemoClaw
Length of output: 930
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n "type\s+ReviewAdvisorResult|interface\s+ReviewAdvisorResult|ReviewAdvisorResult" tools/pr-review-advisor/comment.mts
sed -n '1,140p' tools/pr-review-advisor/comment.mtsRepository: NVIDIA/NemoClaw
Length of output: 4864
Add title to the local ReviewAdvisorResult.findings item type.
topFindingTitle() reads finding.title, but ReviewAdvisorResult.findings currently types each finding as { severity?: string }, so TypeScript will error on the .title access.
Suggested fix
- findings?: Array<{ severity?: string }>;
+ findings?: Array<{ severity?: string; title?: string }>;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| findings?: Array<{ severity?: string }>; | |
| findings?: Array<{ severity?: string; title?: string }>; |
🤖 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 `@tools/pr-review-advisor/comment.mts` at line 25, The type for items in
ReviewAdvisorResult.findings is missing a title field used by topFindingTitle();
update the local findings item type from Array<{ severity?: string }> to include
title?: string (e.g., Array<{ severity?: string; title?: string }>), so accesses
to finding.title in topFindingTitle() are type-safe; adjust any related
references to the findings item type (e.g., where ReviewAdvisorResult or its
findings are declared) to use the updated shape.
| const details = runUrl | ||
| ? `\n[Full AC/security review artifact](${runUrl})` | ||
| : "\nFull AC/security review is available in the workflow artifacts."; |
There was a problem hiding this comment.
Don't label the workflow run URL as the artifact link.
runUrl points to the Actions run, not the uploaded detailed-review artifact, so readers still have to hunt for the file and skipped/failed paths can promise an artifact that was never written. Either pass the real artifact URL here or relabel this as the workflow run.
Suggested fix
export function buildComment({
summary: _summary,
result,
+ artifactUrl,
runUrl,
marker,
}: {
summary: string;
result?: ReviewAdvisorResult;
+ artifactUrl?: string;
runUrl?: string;
marker?: string;
}): string {
const blockerCount = result?.findings?.filter((finding) => finding.severity === "blocker").length ?? 0;
const warningCount = result?.findings?.filter((finding) => finding.severity === "warning").length ?? 0;
const suggestionCount = result?.findings?.filter((finding) => finding.severity === "suggestion").length ?? 0;
const secondary = buildSecondarySummary(result);
- const details = runUrl
- ? `\n[Full AC/security review artifact](${runUrl})`
- : "\nFull AC/security review is available in the workflow artifacts.";
+ const details = artifactUrl
+ ? `\n[Full AC/security review artifact](${artifactUrl})`
+ : runUrl
+ ? `\n[Workflow run](${runUrl})`
+ : "";🤖 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 `@tools/pr-review-advisor/comment.mts` around lines 81 - 83, The message uses
runUrl to claim a "Full AC/security review artifact" which is incorrect; update
the details assignment (variable details) to either use the actual artifact URL
(if you have an artifactUrl variable/return value available) or relabel the link
text to indicate it's the workflow run (e.g., "Workflow run details") when using
runUrl, ensuring the text no longer promises an artifact that may not exist.
E2E Advisor RecommendationRequired E2E: None Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
E2E Scenario Advisor RecommendationRequired scenario E2E: None Full scenario advisor summaryE2E Scenario AdvisorBase: Required scenario E2E
Optional scenario E2E
Relevant changed files
|
PR Review AdvisorRecommendation: blocked This is an automated advisory review. A human maintainer must make the final merge decision. Limitations: Review used the supplied deterministic context and visible diff; no scripts, tests, package-manager commands, or PR-provided code were executed.; The PR is already closed and merged according to trusted GitHub metadata, so this is a post-merge advisory assessment rather than a merge decision.; The supplied diff may be truncated if large; conclusions are limited to visible changes and trusted context.; No linked issues were present, so acceptance coverage is based on PR body summary/test clauses rather than issue acceptance criteria.; Trusted context reports 5 unresolved review threads; maintainers should inspect GitHub thread state directly because some visible final diff changes appear to address earlier comments. Full advisor summaryPR Review AdvisorBase: Advisory review: CI is green for the supplied head SHA, but mergeability is unknown and trusted context reports 5 unresolved review threads on a workflow/enforcement PR that removes advisor gate/E2E reporting; this needs maintainer adjudication even though the PR is already merged. Gate status
🔴 Blockers
🟡 Warnings
🔵 Suggestions
Acceptance coverage
Security review
Test / E2E status
✅ What looks good
Review completeness
|
Summary
Test
Summary by CodeRabbit
New Features
Improvements
Changes
Documentation