Repository navigation
fix(ci): re-classify PR risk on every push, not just PR-open - #560
libravault-pipeline-bot[bot] wants to merge 2 commits into
Conversation
pr-intake.yml only ran classify_pr_risk.py at pull_request: opened/ reopened, so a non-pipeline-authored PR that started risk:low and later grew into sensitive-path territory via a plain git push stayed mislabeled for its entire lifetime — defeating risk:high's role as a hard auto-merge backstop (confirmed live on PR #543). Add pull_request: synchronize to the trigger and, on that event, only re-run the deterministic risk classifier (idempotent) without redoing the status:needs-qa/status:needs-review handoff, since the PR is already further along the pipeline than "just intake'd" by the time it's pushed to again. Closes #558
QA verification — PR #560 vs. issue #558Issue is a bug/process report (no explicit acceptance checklist), so the bar applied is: the repro case (PR #543 — risk label never updated after a plain Checks
Verdict rationaleThe fix directly closes the gap described in #558 and confirmed live on PR #543: a risk label that only gets set once, at PR-open time, can go stale as a PR grows into sensitive-path territory. The QA verdict: PASS |
There was a problem hiding this comment.
Principal review — verdict: human-merge
Risk classification
risk:high is correctly applied and current (label timestamp
2026-08-24T20:56:34Z is after the branch's last commit,
2026-08-24T20:55:17Z). Independently re-ran
classify_pr_risk.py origin/dev origin/fix/pr-intake-reclassify-on-push
myself — confirms risk:high, .github/workflows/pr-intake.yml matches
the sensitive_paths pattern .github/workflows/**. risk:high alone
already forces human-merge regardless of the finding below; the PR's own
"Risk" section correctly self-flags this.
What the PR does
Adds pull_request: synchronize to pr-intake.yml's trigger so
classify_pr_risk.py re-runs on every push to an in-flight PR, not just at
open time — closing the real gap #558 describes (confirmed live on #543: a
PR that started risk:low and grew into core/vaultstore/** via plain
pushes never got relabeled). On synchronize it deliberately skips the
idempotency guard (correct — that guard's "already has a status label"
condition is exactly the expected state on a later push) and skips redoing
the status:needs-qa/status:needs-review handoff (correct — would
otherwise fight an in-flight QA/review round). Traced both EVENT_ACTION
branches by hand against the actual step logic; they do what the PR
description claims.
CONFIRMED finding — filed as #561
Skipping the idempotency guard on synchronize also skips the only
place pr-intake.yml checked a PR's own status:blocked label — that
guard's regex incidentally included blocked alongside
needs-qa/needs-review/etc. The guard step's remaining blocked check
only looks at the linked issue's labels
(.github/workflows/pr-intake.yml:161-180), and only if an issue is
linked at all.
Per docs/agent-team-pipeline.md: "applying status:blocked to an issue
or PR stops every agent from acting on it" — every sibling workflow
(dev-agent.yml, qa-agent.yml, principal-review.yml) enforces this
with a dedicated, unconditional check of the PR's own labels; pr-intake.yml
only ever got this via the guard's side effect, and this PR's synchronize
carve-out drops it for that event without replacing it.
Concretely: a PR with status:blocked applied directly (not via its
linked issue, or with no linked issue at all) still gets
classify_pr_risk.py --apply-label run against it on the next push,
changing its risk:* label despite a human having explicitly paused it.
Reproduced locally by extracting the guard logic with gh mocked to
report status:blocked as the PR's only label and no linked issue —
skip never becomes true.
This wasn't caught by QA's own bash-harness simulation either (its 5
scenarios cover issue-level blocking and idempotency, but not a
PR-level-only status:blocked on synchronize).
Filed as #561, fix sketch included there (check the PR's own
status:blocked unconditionally, same pattern as the other three
workflows' guard steps, separate from the opened/reopened-only
idempotency check).
Minor, non-blocking
- Branch carries a merge commit (
2ce5d47) instead of a rebase onto
dev, perAGENTS.md's "Working in a worktree" section (git worktree add→ rebase before opening a PR). Doesn't affect correctness, already
flagged by QA.
Other checks
- No new networking dependency/call introduced.
- Only sensitive path touched is
.github/workflows/pr-intake.ymlitself,
which the PR description explicitly flags (per policy, not to argue it
away) — consistent with the persona's requirement. docs/agent-team-pipeline.mdupdate accurately reflects the new
synchronizebehavior and guard carve-out.- CI: path-filtered JVM/iOS/UI suites correctly skip (docs+workflow-only
diff); no red checks.
Outcome
risk:high plus a CONFIRMED finding (#561) — routing to human-merge.
The synchronize fix itself is sound and closes a real gap; the blocked-PR
edge case is worth fixing before or shortly after merge, a human's call.
|
Human-merge sweep: this PR modifies |
|
Human-merge sweep: re-verified. Diff matches the principal review's description — |
|
Human-merge sweep: re-verified again. No new commits since the last review (still |
Problem
pr-intake.yml(the deterministic risk-classification backstop for PRs opened outside the automated dev-agent pipeline) only ranclassify_pr_risk.pyonce, at PR-open time (pull_request: opened/reopened). Subsequent pushes to an already-open PR never re-triggered it, unlikedev-agent.yml's own tail step, which re-classifies after every push it makes during a revise-mode run.Concrete case (PR #543): opened with a single low-risk commit, correctly classified
risk:low. Nine more commits were pushed afterward via plaingit push, including one touchingcore/vaultstore/**(asensitive_pathsentry). Therisk:lowlabel never updated, even though the final diff is actuallyrisk:high. Caught manually during review.This matters because
agent-policy.yml's whole design assumesrisk:highis a hard backstop, independent of what QA/review conclude — a PR that starts small and grows into sensitive-path territory can otherwise stay eligible for auto-merge for its entire lifetime if it wasn't opened by the pipeline bot itself.Fix
pr-intake.ymlnow also triggers onpull_request: synchronize.synchronize, theintakejob re-runsclassify_pr_risk.py --apply-label(idempotent — it just does a remove-other/add-current label swap) but explicitly skips:opened/reopenedfrom redoing intake on a PR already in the pipeline — forsynchronizethat state is exactly what's expected, not a skip condition)status:needs-qa/status:needs-reviewhandoff itself, and the accompanying PR comment (redoing that on every push would fight whatever status a QA/review round has since moved the PR to)status:blocked-on-linked-issue check still applies on every push (still skips reclassification for a blocked issue, consistent with "leave this alone" semantics), but only posts its explanatory comment onopened/reopenedto avoid reposting it on every subsequent push to a blocked PR.libravault-pipeline-bot[bot]) remain excluded from this workflow entirely, including onsynchronize—dev-agent.yml's own tail step already reclassifies after each push it makes during a revise-mode run, so there's nothing for this workflow to catch there.docs/agent-team-pipeline.md's description ofpr-intake.ymlto match.Risk
This touches
.github/workflows/pr-intake.yml, which matchesagent-policy.yml'ssensitive_paths(".github/workflows/**") —classify_pr_risk.pywill forcerisk:highon this PR regardless of anything said here, so this is flagged explicitly per the dev-agent persona's instructions, not to argue it away.Verification
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/pr-intake.yml'))"— YAML parses cleanly.pull_requestworkflow-step bash in this repo (the.github/scripts/test_*.shfiles only cover standalone scripts likeresolve_linked_issue.sh) — this change doesn't add a standalone script, so there's nothing new to add a harness for. I traced bothEVENT_ACTIONbranches (opened/reopened vs. synchronize) by hand against the guard/classify step logic above.pull_request: synchronizeGitHub Actions event (no self-hosted runner /actavailable here) — CI running this workflow for real on this PR's own subsequent pushes is the actual verification signal once it's live.Closes #558