Skip to content

Include PR review context in lens prompts#79

Merged
haasonsaas merged 1 commit into
mainfrom
codex/pr-lens-review-context
May 14, 2026
Merged

Include PR review context in lens prompts#79
haasonsaas merged 1 commit into
mainfrom
codex/pr-lens-review-context

Conversation

@haasonsaas
Copy link
Copy Markdown
Contributor

Summary

  • Add PR body, issue comments, review bodies, inline review comments, and non-green checks/statuses to each lens prompt.
  • Make existing bot/human review comments usable as evidence while requiring the lens to verify against the diff before emitting a finding.
  • Add coverage that review context is included in the prompt.

Why

The first successful sweep produced zero high-confidence findings, but active deploy PRs had Bugbot review comments that the lens never saw. This closes that context gap instead of lowering the confidence threshold and increasing comment noise.

Test plan

  • ruby -c .github/scripts/evalops-pr-lens-review.rb
  • ruby -Itest -e 'ARGV.each { |path| require "./#{path}" }' test/*_test.rb
  • ruby -e 'require "yaml"; ARGV.each { |f| YAML.load_file(f); puts "ok #{f}" }' .github/workflows/*.yml .github/workflow-templates/*.yml
  • git diff --check
  • actionlint .github/workflows/evalops-pr-lens-review.yml
  • Local live context smoke against evalops/deploy#2832 confirmed Bugbot inline review comments are included.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 14, 2026

PR Summary

Medium Risk
Adds multiple new GitHub API fetches (comments, reviews, check runs/statuses) and injects their contents into the LLM prompt, which could increase runtime/rate-limit exposure and inadvertently send sensitive text to the model.

Overview
Extends the PR lens prompt generator to include live PR context (PR body, recent issue comments, review bodies, inline review comments, and non-green check runs/statuses), with truncation/limits via MAX_CONTEXT_ITEMS and short_text to cap prompt size.

Updates build_lens_prompt/run_lens to pass this review_context through, and tightens the prompt rules to treat existing comments as evidence only after verifying against the diff. Adds a test ensuring the prompt includes the new context section and rule text.

Reviewed by Cursor Bugbot for commit cb94a0f. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas haasonsaas merged commit a8a7196 into main May 14, 2026
4 checks passed
@haasonsaas haasonsaas deleted the codex/pr-lens-review-context branch May 14, 2026 21:36
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit cb94a0f. Configure here.

end

[
"Pull request body:\n#{short_text(pr_json["body"], max_bytes: 2_500).empty? ? "(none)" : short_text(pr_json["body"], max_bytes: 2_500)}",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate short_text call for PR body

Low Severity

short_text(pr_json["body"], max_bytes: 2_500) is evaluated twice with identical arguments on the same line — once for the .empty? check and once for the value. Storing the result in a local variable would eliminate the redundant computation and make the ternary easier to read.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cb94a0f. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant