Skip to content

Feature/ai pr review - #3

Merged
EChebelyon merged 6 commits into
mainfrom
feature/ai-pr-review
Nov 16, 2026
Merged

EChebelyon merged 6 commits into
mainfrom
feature/ai-pr-review

Conversation

@EChebelyon

@EChebelyon EChebelyon commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Why & What

  • AI PR Review workflow

Review instructions

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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. Both actions/checkout@v7 and actions/setup-python@v7 reference 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-astra is 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 jamie-sgro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 ...

Comment thread .github/workflows/pr-review.yml Outdated
#
# on:
# pull_request:
# types: [opened, ready_for_review]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto on [ready for review], also open to suggestions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +69 to +70
GITHUB_TOKEN: ${{ github.token }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I created a new project Engineering AI, did you check that? Your link takes me straight to it 😄

Comment thread pr_review/review.py
Comment on lines +19 to +20
MAX_DIFF_CHARS = 400_000

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah if we have a PR with 400k chars diffed, we have a bigger problem on our hands

Comment thread pr_review/review.py
Comment on lines +82 to +84
},
timeout=600,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread pr_review/review.py
Comment on lines +77 to +82
json={
"model": OPENAI_MODEL,
"instructions": SYSTEM_PROMPT,
"input": user_input,
"reasoning": {"effort": REASONING_EFFORT},
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add "max_output_tokens" with some value like 64_000 so we can cap runaway spend

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@EChebelyon
EChebelyon merged commit 6f6e4fa into main Nov 16, 2026
@jamie-sgro

Copy link
Copy Markdown
Member

@EChebelyon I'll turn on the option to automatically delete merged branches. Looks like this repo doesn't have that yet

@jamie-sgro
jamie-sgro deleted the feature/ai-pr-review branch November 24, 2026 08:50
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.

2 participants