Repository navigation
feat: implement issue #1165 — [qa-lead reach 3/3] Serve the pull_request surface from the persona mention router (architect decision (b), ADR-0007 consolidation) - #1167
Conversation
…est surface from the persona mention router (architect decision (b), ADR-0007 consolidation)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 Summary
Merge Risk: 🟡 Moderate · up to Pull request events can now trigger persona advisories. A PR with many labels could still receive an advisory despite an opt-out or hold label. A network hiccup during dispatch could also cause a duplicate advisory. Fix both before merging.
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Linked Issues check | [#1165] The PR adds the route-pull-request job, manifest-derived surface and event filtering, stop-marker enforcement, opt-out and write-gate checks, trust checks, and the caller-template trigger. T… |
Add tests in tests/persona_mention.bats or the existing workflow test harness that exercise the PR route's contract fetch. Assert that an exhausted 5xx fetch fails the job and that a 404 for a manifested persona refuses dispatch. Keep the… |
✅ Passed checks (4 passed)
-
-
-
Check name Status Explanation Title check ✅ Passed The title clearly identifies the main change: adding pull_request routing to the persona mention router. It includes extra issue and ADR context, but it remains specific and related to the changeset. Description check ✅ Passed The description directly explains the pull_request routing objective, affected workflows, tests, risk, rollback, and monitoring plan. It is clearly related to the changeset. Out of Scope Changes check ✅ Passed The workflow job, manifest-derived routing, safety gates, retry classification, caller-template trigger, and tests support [ #1165]. Thegrep --changes harden label matching, and the concurrency cha…Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (1 skipped: 1…
-
-
Full details: Linked Issues check
-
-
-
Explanation
[
#1165] The PR adds theroute-pull-requestjob, manifest-derived surface and event filtering, stop-marker enforcement, opt-out and write-gate checks, trust checks, and the caller-template trigger. The existing comment route remains unchanged apart from safegrep --handling and the concurrency-key extension. The required fetch-failure tests are not present.tests/persona_mention.batstestspm_should_retry_statusand pure verdict failures, but it does not test an exhausted contract fetch returning 5xx or a manifested persona contract returning 404 and refusing dispatch.Resolution
Add tests in
tests/persona_mention.batsor the existing workflow test harness that exercise the PR route's contract fetch. Assert that an exhausted 5xx fetch fails the job and that a 404 for a manifested persona refuses dispatch. Keep the existing comment-path tests passing.
-
-
✨ Finishing Touches 💡 1
-
-
-
🛠️ Fix failing CI checks 💡
-
-
-
- Commit to this branch
- Create a new PR
-
-
-
-
-
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
There was a problem hiding this comment.
Code Review
This pull request implements event-surface routing for the pull_request surface, allowing PR-advisory personas to be dispatched based on declared manifest surfaces. It introduces several helper functions in persona-mention.sh to evaluate surface decisions, trust floors, and write gates, updates the workflow trigger, and adds extensive BATS tests. The review feedback highlights opportunities to improve robustness and efficiency in the routing script, such as using native Bash parameter splitting instead of spawning awk, declaring local variables to prevent scope leakage, and propagating failures to ensure the system fails closed. Additionally, the feedback recommends improving the BATS tests by explicitly asserting on command exit statuses immediately after execution and verifying exact non-zero exit codes rather than using generic checks.
|
Acknowledged — this is a Codex usage-limit notice, not a review finding. No code action is required and there is no follow-up to track. |
|
Acknowledged — this is a Qodo trial-ended notice ( |
This comment has been minimized.
This comment has been minimized.
|
Acknowledged — SonarCloud reports the Quality Gate passed. No action required. |
Dev-Lead — fix-reviews (applied)Changes committed and pushed. Requested items addressed:
|
Resolved — the `needs-human-review` hold was lifted; dev-lead has picked this item up. Click to expand the prior hold notice.dev-lead is withholding action on this item. It is labeled To re-enable automated pickup: remove the |
don-petry
left a comment
There was a problem hiding this comment.
Maintainer review: changes required before merge
The stop-marker binding is right, and it is the architect's hard requirement: pm_pr_route_verdict checks stop markers first, fails closed on an unreadable contract, and is tested per branch. The routing still has three behaviour regressions compared with the surface it replaces (.github-private/.github/workflows/qa-lead-pr-advisory.yml). As written, once this reaches a channel and the stub is swept, qa-lead would post an advisory on every push to every trusted PR in every repo. This review answers the needs-human-review escalation (pr-review tier-3, HIGH); the hold is being cleared so these changes can be applied.
Required (in this order; #1 matters most)
1. Honour the surface's declared events, not only enabled. pm_surface_decision reads enabled/mode and ignores the row's events: list. The stub now subscribes pull_request: [opened, ready_for_review, synchronize, reopened], while qa-lead declares events: [opened, ready_for_review] and its notes say synchronize is deliberately excluded. Nothing in the router compares github.event.action against the declared events, so every synchronize dispatches a fresh advisory, and nothing downstream deduplicates (the runner has no already-advised check; that lived in the local gate).
- Pass
github.event.actioninto the route step via env (PR_ACTION), and make the per-persona decision skip unlessPR_ACTIONis in the row'sevents. A row with noeventslist does not fire: derive from declared surfaces, the same rule as the no-default_mode-fallback you already applied. - Emit a named skip (
skip undeclared-event <action>) so it's visible in the log. - bats:
synchronizeagainst qa-lead's row → skip;opened→ dispatch; a row withoutevents→ skip. - Narrow the stub's
types:to[opened, ready_for_review, reopened]unless a persona declaressynchronize. None does, and each subscribed type is a runner start in every repo on every push.
2. Check github.actor as well as the PR author in both recursion pre-filters (the workflow if: and pm_pr_should_route). This is the codeant/tier-3 finding. pull_request.user.login is the PR's author and never changes; the actor of a synchronize/reopened event is whoever pushed or reopened. A bot push to a human's PR passes the author check. Add github.actor to the if: bot exclusions, and pass it as PR_ACTOR into pm_pr_should_route (checked with pm_is_bot_actor). bats: human author with bot actor → blocked.
3. Forward the event action in the dispatch payload (client_payload[event_action]=$PR_ACTION) next to surface=pull_request. The persona-specific suppressors the local gate enforced (test-surface heuristic, automation-budget, already-advised idempotency) belong on the runner side in .github-private, which is where that policy and its scripts live. That work is tracked in petry-projects/.github-private#1905, and the runner needs surface/event_action to apply it. Do not try to port qa-lead-test-surface.sh or the budget gate into this router: they are persona and .github-private policy, and the router stays generic.
Budget guard
Commit 1 (events filter + narrowed stub types + tests) is the one that matters. If you run short, land that, then file a follow-up issue in petry-projects/.github for items 2–3 and stop. Don't attempt the runner-side gate here; it's in a different repo.
Not required
- Pagination on the
contents/personaslisting: that endpoint returns up to 1,000 entries, and there are fewer than 20 personas. - gemini's per-test exit-status suggestions were already applied in
80b23dac.
|
No description provided. |
|
No description provided. |
Dev-Lead — waiting on PR blockers (intent: fix-reviews)PR: #1167 |
|
No description provided. |
|
No description provided. |
Dev-Lead — waiting on PR blockers (intent: fix-reviews)PR: #1167 |
QA Lead — test-risk advisoryRisk tier: MEDIUM. This turns on an automatic persona trigger for every trusted PR across the org. The checks that stop or hold a persona (stop markers, opt-out label, write gate, trust floor, bot/marker guards) are well unit-tested one rule at a time. The workflow loop that runs them is not tested at all. What I'd shore up (highest leverage first):
Escalate? no. Before moving the published version forward, run an end-to-end smoke test on a sandbox repo with Advisory only — I comment, I do not change code. Ground: BMAD Test Architecture |
|
No description provided. |
|
No description provided. |
Dev-Lead — waiting on PR blockers (intent: fix-reviews)PR: #1167 |
don-petry
left a comment
There was a problem hiding this comment.
Maintainer review — two line-anchored items. The September items (declared-events filter, github.actor check, event_action forwarding, stub types) are all in and verified; I am resolving those threads.
|
No description provided. |
…r-persona failure Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Dev-Lead — fix-reviews (applied)Changes committed and pushed. Requested items addressed:
|
|
|
No description provided. |
|
No description provided. |
|
Re-reviewed the edited CodeRabbit summary. Its only finding is the Security Architecture Medium · reliability concern that the PR path retries |
|
CodeAnt's finding is that the workflow omits |
Dev-Lead — fix-reviews (no-changes)Agent reasoning |
don-petry
left a comment
There was a problem hiding this comment.
pr-review findings for 42c02bd7, posted by the maintainer
pr-review completed a full three-tier review of this head (run 38043713369) and reached approve, risk MEDIUM. It could not post the result itself (petry-projects/.github-private#2169), so the findings are recorded here. This comment is not an approval and carries no pr-review marker.
Verdict (tier 3, security audit): approve. The new route-pull-request job runs no PR-head code: it sources its tooling from the reusable's own pinned commit, passes every event field through env, and binds the same bot, marker, trust-floor, stop-marker, opt-out and write-gate brakes as the comment path. Fork heads are excluded before any token-dependent step.
Tier 1 and tier 2 escalated on an automated safety flag for a pull_request_target trigger. Tier 3 confirmed that as a false positive: the only occurrence is the comment at persona-mention-reusable.yml:406 stating the design is not pull_request_target; the stub subscribes to plain pull_request.
Findings — none blocking:
| Severity | Where | Finding |
|---|---|---|
| minor | standards/workflows/persona-mention.yml:68 |
The stub now runs on pull_request, so its definition is read from the PR merge commit, and the org token is present on more fleet runs. No new privilege: changing the stub already requires write access to the repo. |
| minor | scripts/lib/persona-mention.sh:492 |
The PR path intersects the surface trust floor with the persona-wide floor (can only tighten); the mention path's doc says the surface floor overrides it. The PR path is the safe direction; the two should be reconciled. |
| minor | scripts/lib/persona-mention.sh:639 |
The write gate is checked only when mode is exactly write; any other mode string is dispatched as-is. Relies on validate-personas.py enforcing the enum, as the comment path does. |
| minor | persona-mention-reusable.yml:532 |
PERSONA_REF is interpolated unencoded into the contents API query. Trusted caller input, default main. |
| minor | persona-mention-reusable.yml:515 |
Labels are read once at event time, so an opt-out label applied just after opened can be missed. Advisory mode only; the write gate fails closed. |
| info | persona-mention-reusable.yml:476 |
raw_fetch re-sources the library on every call (redundant). The concurrency comment says rapid events queue, but GitHub keeps one pending run per group. |
| info | tests/persona_mention.bats |
The job-level if: duplicates pm_pr_should_route and is not covered by bats, so the two can drift. The in-script call re-checks the same conditions. |
Checks on this head: all four required checks pass (SonarCloud, CodeQL, AgentShield, dependency-audit); 24 pass and 6 are skipped by design. The three dev-lead / * entries shown as failing are one cancelled orchestration run in which no step executed.
Maintainer verification, beyond the suite: 103 bats tests pass; the workflow's routing block was run against real PRs and the live persona manifests with only the dispatch call intercepted — opened routes qa-lead alone, synchronize routes nobody, a PR carrying needs-human-review is skipped at the stop marker, dev-lead and pr-review are skipped as served by their own runtime, and a failed fetch for an earlier persona no longer prevents later ones being evaluated.



Problem
[qa-lead reach 3/3] Serve the pull_request surface from the persona mention router (architect decision (b), ADR-0007 consolidation)
From the issue: As the org, I want the persona mention router to also serve the
pull_requestevent, so that a persona's PR-advisory surface is delivered by the one published ingress path instead of a second, repo-local runtime.Risk
Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.
Test plan
Tests added/updated:
tests/persona_mention.bats. Verification:bash scripts/dev-lead-lint.sh(shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.Rollback
Revert this PR. No non-revertible side effects (no tags, migrations, or external state).
Monitoring
Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.
Closes #1165