feat(pr-review): internal-PR safety reviewer — review off-task-flow org PRs

Extend the inbound-PR reviewer beyond external/fork PRs to internal org-repo
PRs that bypassed the agent task-flow (a human-pushed branch). The org's own
in-flight integration PRs are skipped — a live task owns their branch and they
already pass QA + PM review — so the reviewer only flags off-process PRs.

- config: internal_pr_enabled (default OFF, like external_pr_enabled)
- PR_REVIEW_SOURCES = (external_pr, internal_pr); generalize dispatch, dedup,
  the decision queue, the git-gate exemption, and supersede to both sources
- TaskService.active_task_owns_branch (skip lifecycle PRs) + ingest source param
  with source-aware wording
- poll loop runs when EITHER flag is on; _ingest_pr_if_reviewable picks the
  source per PR (external: flag+author-allow; internal: flag+not-task-owned)
- 11 unit tests (decision logic + branch-ownership)
This commit is contained in:
Renn F
2026-06-17 16:50:09 +02:00
parent 34de96397f
commit 66a8ad40eb
5 changed files with 257 additions and 47 deletions
+10
View File
@@ -341,6 +341,16 @@ class Settings(BaseSettings):
"checks out, or executes external contributor code."
),
)
internal_pr_enabled: bool = Field(
default=False,
description=(
"Master switch for the internal-PR safety reviewer. OFF by default. "
"When on, the same poll also reviews org-repo (non-fork) PRs that are "
"NOT tied to an active task — i.e. branches pushed outside the agent "
"task-flow. The org's own in-flight integration PRs (whose branch a "
"live task owns) are skipped, since they already pass QA + PM review."
),
)
# ==========================================================================
# Workspaces (Multi-Agent Git)