feat(reviewer): wire PR inventory trust gate into live queue path (#196)
Run pr_inventory_trust_gate on empty gitea_review_pr inventory results, add assess_reviewer_queue_inventory for multi-repo completeness checks, and require trusted_empty before empty-queue claims in reports/templates. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
+42
-1
@@ -259,6 +259,7 @@ import issue_duplicate_gate # noqa: E402
|
||||
import role_session_router # noqa: E402
|
||||
import role_namespace_gate # noqa: E402
|
||||
import task_capability_map # noqa: E402
|
||||
import review_proofs # noqa: E402
|
||||
|
||||
|
||||
# Fail-closed exact-issue-lock file (#204): written by gitea_lock_issue,
|
||||
@@ -2274,6 +2275,23 @@ def gitea_merge_pr(
|
||||
return result
|
||||
|
||||
|
||||
def _local_git_remote_url(remote_name: str) -> str | None:
|
||||
"""Best-effort local ``git remote get-url`` for trust-gate corroboration."""
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
["git", "remote", "get-url", remote_name],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
cwd=PROJECT_ROOT,
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
return None
|
||||
url = (proc.stdout or "").strip()
|
||||
return url or None
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def gitea_review_pr(
|
||||
pr_number: int,
|
||||
@@ -2341,6 +2359,8 @@ def gitea_review_pr(
|
||||
prs_found_count = 0
|
||||
pr_details_list = []
|
||||
inventory_msg = ""
|
||||
inventory_trust_gate = None
|
||||
prs: list = []
|
||||
|
||||
h, o, r = _resolve(remote, host, org, repo)
|
||||
auth = None
|
||||
@@ -2425,7 +2445,28 @@ def gitea_review_pr(
|
||||
if inventory_msg:
|
||||
report_lines.append(inventory_msg)
|
||||
else:
|
||||
report_lines.append("Open PRs found: 0")
|
||||
inventory_trust_gate = review_proofs.pr_inventory_trust_gate(
|
||||
prs if inventory_attempted else None,
|
||||
remote=remote,
|
||||
org=o,
|
||||
repo=r,
|
||||
state="open",
|
||||
authenticated_profile=profile,
|
||||
local_remote_url=_local_git_remote_url(remote),
|
||||
has_finality_metadata=True,
|
||||
)
|
||||
report_lines.extend(
|
||||
review_proofs.format_pr_inventory_trust_gate_report(
|
||||
inventory_trust_gate
|
||||
)
|
||||
)
|
||||
if inventory_trust_gate.get("status") == "trusted_empty":
|
||||
report_lines.append("Open PRs found: 0 (trusted_empty)")
|
||||
else:
|
||||
report_lines.append(
|
||||
"Empty-queue claim blocked: "
|
||||
"pr_inventory_trust_gate did not return trusted_empty"
|
||||
)
|
||||
else:
|
||||
report_lines.append(inventory_msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user