diff --git a/agent/reviewer_groups.py b/agent/reviewer_groups.py index 36e4c3dc..d5923eb0 100644 --- a/agent/reviewer_groups.py +++ b/agent/reviewer_groups.py @@ -52,10 +52,9 @@ class _DiffGroupModel(BaseModel): ) summary: str = Field( description=( - "GitHub-flavored markdown walkthrough of this group: a few short " - "sentences or bullets, code identifiers in `backticks`, optionally one " - "short fenced code block of the key snippet, and concrete locations " - "linked as [path:start-end](#loc=path:start-end)." + "A short, plain explanation of what this group changes and why, in a " + "few sentences a reviewer can skim. Wrap code identifiers, symbols, " + "types, flags, and paths in `backticks`. No code blocks or links." ) ) files: list[str] = Field( @@ -82,24 +81,18 @@ Rules: - Use at most {max_groups} groups. Prefer fewer, larger groups over many tiny ones. - title: a short headline naming the change, roughly 4-10 words, no trailing \ punctuation. Wrap code identifiers (symbols, flags, file names) in `backticks`. -- summary: GitHub-flavored markdown explaining what the group changes and why, \ -written as a short walkthrough a reviewer can skim: - - Keep it focused — a few short sentences or bullets. Do not restate the diff line by line. +- summary: a short, plain explanation of what the group changes and why, that a \ +reviewer can skim: + - Keep it focused — a few short sentences. Do not restate the diff line by line. - Wrap every code identifier, symbol, type, flag, and path in `backticks`. - - When one change is central, include at most ONE short fenced code block \ -(```lang, <= ~8 lines) of the key snippet — not the whole hunk. - - Reference concrete locations as markdown links of the EXACT form \ -[path:start-end](#loc=path:start-end), where path is the verbatim changed-file \ -path and start/end are line numbers from the "lines X-Y" annotations below \ -(use [path:line](#loc=path:line) when start == end). Prefer these links over \ -describing locations in prose — they let the reader jump straight to the hunk. + - Plain prose only — no code blocks and no links. - files: the exact file paths (copied verbatim from the list below) in this \ group, in the order a reviewer should read them. Changed files: {file_list} -Diffs (each hunk is annotated with its line range in the new file): +Diffs: {diffs} """ @@ -122,9 +115,7 @@ def _build_prompt(diff_text: str, files: list[str]) -> str: body = hunk.body if len(body) > MAX_FILE_HUNK_CHARS: body = body[:MAX_FILE_HUNK_CHARS] + "\n... (truncated)" - # Surface the new-file line range so the model can cite accurate - # locations in its summary links. - segments.append(f"lines {hunk.new_start}-{hunk.new_end}:\n```diff\n{body}\n```") + segments.append(f"```diff\n{body}\n```") block = f"### {file_diff.file}\n" + "\n".join(segments) + "\n" if budget - len(block) < 0: parts.append(f"### {file_diff.file}\n(diff omitted — prompt budget reached)\n") diff --git a/tests/test_reviewer_groups.py b/tests/test_reviewer_groups.py index 9051b645..222cfa22 100644 --- a/tests/test_reviewer_groups.py +++ b/tests/test_reviewer_groups.py @@ -97,14 +97,13 @@ async def test_generate_diff_groups_llm_failure_returns_none() -> None: assert groups is None -def test_build_prompt_annotates_hunk_line_ranges() -> None: +def test_build_prompt_includes_files_and_diffs() -> None: prompt = _build_prompt(_DIFF, ["foo.py", "bar.py"]) assert "### foo.py" in prompt assert "### bar.py" in prompt - # New-file line ranges from the @@ headers are surfaced so the model can - # cite accurate locations: foo.py @@ -1,2 +1,3 @@ and bar.py @@ -1 +1,2 @@. - assert "lines 1-3:" in prompt - assert "lines 1-2:" in prompt + # Hunks are rendered as plain diff fences (no line-range annotations). + assert "lines 1-3:" not in prompt + assert "```diff" in prompt # The verbatim file list is included so every file can be assigned. assert "- foo.py" in prompt assert "- bar.py" in prompt diff --git a/ui/src/components/agents/ReviewSidebar.tsx b/ui/src/components/agents/ReviewSidebar.tsx index 079f2c06..60ea95b6 100644 --- a/ui/src/components/agents/ReviewSidebar.tsx +++ b/ui/src/components/agents/ReviewSidebar.tsx @@ -51,7 +51,6 @@ export interface ReviewSidebarData { view: ReviewSidebarView onViewChange: (view: ReviewSidebarView) => void onSelectGroup: (index: number) => void - onLocationClick?: (file: string, startLine: number, endLine: number) => void } const ReviewSidebarContext = createContext<{ @@ -105,7 +104,6 @@ export function ReviewSidebarPanel({ data }: { data: ReviewSidebarData }) { groups={data.groups ?? []} onSelectGroup={data.onSelectGroup} onSelectFile={data.onSelect} - onLocationClick={data.onLocationClick} /> ) : !data.files ? (