Repository navigation
ci: add advisory AI triage for pull requests before CI approval - #4639
Merged
Merged
Conversation
Contributor
|
✅ DCO Check Passed Thanks @dolfim-ibm, all your commits are properly signed off. 🎉 |
2 of 3 tasks
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
dolfim-ibm
force-pushed
the
ci/ai-pr-triage
branch
from
October 7, 2026 12:01
dd5cfb5 to
112cd56
Compare
Add the "AI PR Triage" workflow. It runs on pull_request_target and never checks out or runs PR code. - prepare (read-only token): finds possible duplicate PRs from shared issue references and overlapping diff hunks, applies deterministic CI-safety rules for sensitive paths, and summarizes groundtruth changes (formatting, coordinates, text, tables, structure). - analyze (no GitHub write access): runs Bob Shell in a read-only custom mode on the collected data and validates its JSON answer. - publish (no LLM): applies an allowlist of ai:* labels and updates one sticky comment. Deterministic findings always override a "safe" model verdict. Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
dolfim-ibm
force-pushed
the
ci/ai-pr-triage
branch
from
October 7, 2026 12:06
112cd56 to
0fc5237
Compare
dolfim-ibm
marked this pull request as ready for review
October 7, 2026 12:16
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
PeterStaar-IBM
previously approved these changes
Oct 7, 2026
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
1 of 3 tasks
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
cau-git
approved these changes
Oct 7, 2026
ceberam
approved these changes
Oct 7, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
AI PR Triageworkflow. It runs onpull_request_targetfor every non-draft PR, before a maintainer approves CI. It gives an advisory first look with Bob Shell. No job checks out or runs code from the PR.What it does
Duplicate PRs. It collects candidates with deterministic rules: other PRs that cite the same issue (issue timeline cross-references), and open PRs with overlapping diff hunks in the same files. Bob Shell then rates each candidate as
duplicate,related, orunrelated. The model can rate only PR numbers from this candidate list.CI safety. Path rules always force
ai:ci-needs-care: CI files, build and dependency files,conftest.py, shell scripts, binaries, and agent instruction files (AGENTS.md,.agents/,.bob/, …). Pattern hints in added lines (process execution,eval, network, encoded payloads, secret access) go to the model as context. The model can only make the verdict stricter, never less strict.Reference data summary. It sorts changed files under
tests/data/**/groundtruth/into formatting-only, coordinates-only, text, table, and structure changes, with per-file details (for exampletext: 386 → 385,table 0: shape 3x4 → 3x5,reading order changed). The model says if the changes areexpectedfrom the PR intent.Topic labels. The triage adds labels from the existing repository set (
bug,enhancement,docx,markdown,ocr,table structure, …). Rules map the conventional-commit title (fix→bug, scope(docx)→docx) and the changed source paths to labels, and the model can add up to 3 more from the same allowlist (.github/scripts/pr_topic_labels.py). They are added only on the first triage of a PR, labels that do not exist are never created, and topic labels are never removed. On the last 40 PRs, the rules gave every label that maintainers set, exceptxmlon an epub PR andtestson a dependency PR.Trust model
preparegit fetch, never checked outanalyzecontents: read, no write--disable-tool-groups edit,execute,browser,mcp,skill,artifact,subagent,mode, MCP and subagents offpublishpull-requests/issues: writeBob Shell
runpre-approves all tools of a mode. For this reason the mode has only thereadgroup. The prompt and the mode come from the base branch. The answer is discarded if it contains the API key.The labels are advisory:
ai:ci-safe,ai:ci-needs-care,ai:possible-duplicate. They never addtests:full. A new push removes them.Never a blocking check
The workflow is a review aid, not a gate. Every job and every step uses
continue-on-error. Long steps have a timeout below the job timeout. An error (missing secret, API outage, invalid model answer) shows as a warning annotation on the run, and the PR check stays green. The comment then shows only the parts that finished.Setup needed before merge
BOB_API_KEY(API key with the Inference scope).BOB_TEAM_ID(forgeneralkeys) andBOB_TRIAGE_MAX_COST(default2).Checklist:
.github/CI_LABELS.md)Review evidence:
uv run pytest tests/test_ai_pr_triage.py tests/test_groundtruth_diff.py tests/test_pr_topic_labels.py: 22 passed.make validate: passed.preparelocally against real PRs:msword_backend.py.structurefor the two PDF JSON files (text: 386 → 385) and separates the Markdown paragraph-break changes from whitespace-only changes.status: successin 31 s, with 8 tool calls and a cost of 0.167 (limit 2). It wrote no files.extractaccepted the answer.duplicate. fix(docx): read the active branch of a body-level mc:AlternateContent #4615, fix(docx): keep w:sym characters and map Symbol font text to Unicode #4622 and fix(docx): keep the text of wrapped runs in plain table cells #4455 were ratedrelated. CI safety wassafe.ai:possible-duplicateandai:ci-safe.<details>, and unrelated PRs are hidden.main, because it usespull_request_target. Thenpm install --ignore-scriptsinstall step is not tested on a runner yet.