Repository navigation
ci: auto-merge provider-info-sync PRs when CI, Greptile and Bugbot are clean - #41494
Conversation
…e clean Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryAdds a GitHub Actions workflow and supporting Python evaluator that automatically merges eligible provider price-sync pull requests after validating their author, changed-file scope, CI results, Greptile score, Bugbot review, and human review state.
Confidence Score: 5/5The PR appears safe to merge; no blocking or independently actionable issue remains in the current changes. The prior head-SHA race is fully fixed by including the evaluated Important Files Changed
Reviews (3): Last reviewed commit: "fix(ci): drop the pull_request_review tr..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…low only runs from main Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 9e84d8a. Configure here.
TLDR
Problem this solves:
berriai-litellm-provider-info-sync[bot]wait for a human to approve and mergeHow it solves it:
auto-merge-price-syncworkflow evaluates open sync-bot PRs and merges the clean onesUser Flow
Before: the sync bot opens a price PR and it sits until someone on the team reviews it
litellm-providers/price-syncand opens a PR againstmainAfter: a clean sync PR merges on its own within half an hour of the last bot result
litellm-providers/price-syncand opens a PR againstmainauto-merge-price-syncrun triggered by the last comment, check suite, status or scheduled tick merges the PR with a merge commit as the sync App, and the run log lists the gates it checkedDesign
The workflow runs on
issue_comment,check_suite,status, a 30 minute schedule andworkflow_dispatch. All of those run the workflow file and checkout frommain, never the PR branch, so the App credentials are never exposed to PR code. There is deliberately nopull_request_reviewtrigger: that event runs the workflow from the PR merge ref, which would let a same-repo PR execute its own copy of the script with the App token. A Bugbot review is picked up by its check suite completing or by the next scheduled tick. The workflow's own token is read-only and the merge uses a short-lived token minted fromPROVIDER_INFO_SYNC_APP_IDandPROVIDER_INFO_SYNC_APP_PRIVATE_KEY; when those secrets are absent the run logs "app credentials not configured" and exits green, so the workflow can land before the secrets exist.github/scripts/auto_merge_price_sync.pyis stdlib only. A pureevaluate(EvaluationInputs) -> Verdictcollects every hold reason so a run log shows all of them at once. The gates, in order: author inPR_AUTHOR_ALLOWLIST; PR open, not draft, mergeable and notdirty; changed files classify ascost-map-only(new category inclassify_changes.sh: at least one of the three cost map files and nothing outside them andtests/test_litellm/,tests/proxy_unit_tests/); every context required by themainrulesets is green as a check run or commit status; every other check run on the head sha is completed with success, skipped or neutral (this workflow's own run excluded); every commit status is success; the latest GreptileConfidence Score: N/5comment is 5 and not older than the head commit; the latest non-stalecursor[bot]review whosecommit_idis the head sha contains "found no new issues"; no human reviewer's latest review is CHANGES_REQUESTED. The merge usesmerge_method: mergebecausemain-mergeonly allows merge commits and pinsshato the head that was evaluated, so a commit pushed between evaluation and the merge call makes GitHub return 409 instead of merging unreviewed code. A 405 or 409 from the merge call is logged and the run stays green so the next tick re-evaluatesSetup outside this PR, already done: add the sync App as a bypass actor in "pull requests only" mode on
guard-main,main-merge,Protect Sensitive FilesandProtect dot directoriesso its token can merge without a team approval, and add the two App secrets. Until the bypass is in place the merge call returns 405 and the run logs itOverlaps with #39845 (LIT-6995), which reconciles a different App's
litellm_cost_map_sync_*PRs inside its own sync workflow. This one gates on Greptile and Bugbot and works for any App login in the allowlist, so the two could be unified later by adding that App's login hereRelevant issues
Affected release
Linear ticket
Resolves LIT-7920
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Read-only dry run of the script against the already merged sync PR #41457, using a personal token and
DRY_RUN=1so no merge call is made. It shows the evaluation collecting every hold reason rather than stopping at the first one:The last two holds are real for that PR: Greptile scored it 4/5 on the first commit and did not re-review the last push, and Bugbot never reviewed it, so under this workflow it would have waited for a human, which is what happened
Link to Devin session: https://app.devin.ai/sessions/bbfced756d18415d85c92948ab0de8f4
Open in Devin Desktop: https://app.devin.ai/desktop/session/bbfced756d18415d85c92948ab0de8f4?variant=devin
Note
Medium Risk
Introduces automated merges via a GitHub App, but scope is limited to allowlisted bot PRs, cost-map-only diffs, and strict CI/Greptile/Bugbot gates with pinned head SHA.
Overview
Adds automated merging for open price-sync PRs from
berriai-litellm-provider-info-sync[bot]when every safety gate passes, instead of waiting for a maintainer.classify_changes.shgains acost-map-onlymode: the diff must touch at least one of the three model price JSON/schema files and must not include changes outside that set (with exceptions fortests/test_litellm/andtests/proxy_unit_tests/). Docs and other paths still fail the check..github/scripts/auto_merge_price_sync.pyloads PR metadata from GitHub, runs the classifier, and returns a merge verdict only if the author is allowlisted, the PR is mergeable, required branch checks and all other check runs/statuses are green, Greptile’s latest score is 5/5 on the head commit, Bugbot’s head-commit review reports no new issues, and no human has CHANGES_REQUESTED. Holds are logged;DRY_RUN=1skips the merge API call. Merges use a merge commit withshapinned to the evaluated head.auto-merge-price-syncworkflow runs on comments, completed check suites, commit statuses, a 30-minute cron, and manual dispatch—always frommain, with a short-lived App token for the merge step when secrets are set.Unit tests cover each gate in
test_auto_merge_price_sync.pyand the new classifier cases intest_circleci_path_filter.py.Reviewed by Cursor Bugbot for commit 9e84d8a. Bugbot is set up for automated code reviews on this repo. Configure here.