Repository navigation
Feature/ai pr review - #3
Conversation
There was a problem hiding this comment.
AI review (gpt-6-astra)
This PR adds an opt-in reusable workflow that sends PR metadata and diffs to OpenAI and posts the resulting review as a non-blocking comment.
Findings
-
P1 —
.github/workflows/pr-review.yml:51,58: Unavailable action versions prevent execution. Bothactions/checkout@v7andactions/setup-python@v7reference unpublished major versions, so the job fails before running the script. Use existing releases, preferably pinned to their commit SHAs. -
P1 —
.github/workflows/pr-review.yml:25: The default model is invalid.gpt-6-astrais not an available OpenAI API model, so the documented default configuration fails instead of posting a review. Choose an available Responses API model supporting the configured reasoning effort, and update the Python fallback, template, and documentation consistently. Add a smoke test for the default configuration. -
P2 —
pr_review/review.py:124-126: The fetched diff can belong to a different commit than the posted review. PR metadata and the diff are fetched separately from mutable endpoints. A push between those requests makes the model review the new diff while the comment claims—and is attached to—the old head SHA. Fetch a diff pinned to the captured base/head commits, or recheck both SHAs after fetching and retry if either changed. Add a test simulating a push between requests.
Reviewed at 556fe40. Automated review; use your judgment.
jamie-sgro
left a comment
There was a problem hiding this comment.
Overall I really dig this initiative. There's enough Prs where I've reviewed and first prompted codex or claude code to do an initial review and it comes up with glaring issues that are easily caught. This to me is a really solid use-case for AI -- where it's an extra layer of defence that we can opt to integrate. No harm in getting those initial reviews I think :)
There was a problem hiding this comment.
ditto from the tessera branch PR
[ready for review] might get a bit noisy with the number of times I flick this option when testing things like cicd or IAC. To add a handful of paragraphs every time will detract from the overall experience. I'd opt for [opened] then focus on enabling users to make it easy to do manual re-triggers well, since anyone could simply run gh workflow run ...
| # | ||
| # on: | ||
| # pull_request: | ||
| # types: [opened, ready_for_review] |
There was a problem hiding this comment.
ditto on [ready for review], also open to suggestions
| GITHUB_TOKEN: ${{ github.token }} | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
There was a problem hiding this comment.
I'm on https://platform.openai.com/api-keys and only see 4 keys, none of which are obviously tied to this workflow. Could you confirm the name of the key/identifier being used here?
There was a problem hiding this comment.
I created a new project Engineering AI, did you check that? Your link takes me straight to it 😄
| MAX_DIFF_CHARS = 400_000 | ||
|
|
There was a problem hiding this comment.
yeah if we have a PR with 400k chars diffed, we have a bigger problem on our hands
| }, | ||
| timeout=600, | ||
| ) |
There was a problem hiding this comment.
Raise to 1500 to match the timeout-minutes: 30. On higher reasoning it could take that long, hopefully not though. The 'thinking' and token-use still are being incurred anyways
| json={ | ||
| "model": OPENAI_MODEL, | ||
| "instructions": SYSTEM_PROMPT, | ||
| "input": user_input, | ||
| "reasoning": {"effort": REASONING_EFFORT}, | ||
| }, |
There was a problem hiding this comment.
Add "max_output_tokens" with some value like 64_000 so we can cap runaway spend
|
@EChebelyon I'll turn on the option to automatically delete merged branches. Looks like this repo doesn't have that yet |
Why & What
Review instructions
Will add it to tessera first and people can start adding them to other projects as well