Skip to content

Include prior same-base range reviews in branch review prompts #767

@wesm

Description

@wesm

Problem

Branch/range review prompts include previous reviews before the range start, previous attempts for the exact same git_ref, and per-commit reviews inside the current range. They do not include prior range reviews that cover a subset of the current range but share the same start commit.

For CI panel reviews, that means a synthesized review for A..B is not included as context when a later push reviews A..D, even though the earlier synthesized result is directly relevant to the first part of the PR range.

Current behavior

internal/prompt.buildRangePrompt currently gathers:

  • previous commit review context before the range start
  • previous attempts only when git_ref exactly matches the current range
  • per-commit reviews for commits inside the range

Storage correctly treats panel synthesis rows as canonical and excludes panel members, but there is no lookup for prior same-start subset range reviews.

Expected behavior

Range/branch review prompts should include prior canonical range reviews that share the same start commit and are contained within the current range, especially synthesized CI panel reviews from earlier PR heads.

Notes

  • Include canonical review rows only; continue excluding panel member reviews.
  • Keep the context bounded, likely by review_context_count or a dedicated small limit.
  • Add coverage for A..B being included in a later A..D branch review prompt, and for unrelated-base ranges being excluded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions