Add OpenRouter PR review workflow (free-only model, diff trimming, auto-labeling)#10
Conversation
Codacy's Analysis Summary0 new issue (≤ 0 issue) Review Pull Request in Codacy →
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 790108c27c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| labelsToAdd.push('ai:approve'); | ||
| labelsToRemove.push('ai:request-changes'); | ||
| } else if (verdict === 'COMMENT_ONLY') { | ||
| labelsToAdd.push('ai:comment-only'); | ||
| } |
There was a problem hiding this comment.
Remove stale AI labels when verdict changes
If a PR’s verdict changes over time, the workflow can leave contradictory labels on the PR. In particular, the COMMENT_ONLY branch only adds ai:comment-only and never removes ai:approve or ai:request-changes, and the APPROVE branch only removes ai:request-changes (not ai:comment-only). This means a PR can end up with both “approve” and “comment-only” (or “request-changes” and “comment-only”) labels after subsequent runs, which defeats the triage signal. Consider removing the other AI labels whenever any verdict is set so the label state is mutually exclusive.
Useful? React with 👍 / 👎.
|



Motivation
:freemodels to prevent accidental paid usage.Description
.github/workflows/openrouter-pr-review.ymlthat fetches the PR diff, trims it to 150KB, constructs a prompt, calls the OpenRouter chat endpoint, validates the response, and writesreview.mdas output.:freesuffix on the model string (fail fast if not present) and includeDiff truncated: true|falsein the prompt to avoid overconfident summaries.Approve?verdict and creates/appliesai:approve,ai:request-changes, orai:comment-onlylabels, plus an idempotent comment poster that updates a single comment marked with<!-- openrouter-pr-review -->.LOGIC-MAP.md(logic/invariants),WE-CHOSE.md(three-perspective justification), andTESTING.md(test matrix and verification steps).Testing
Codex Task