open-swe/agent/tools/request_pr_review.py
Johannes du Plessis 1319347dd9
feat: route Slack PR review requests (#1245)
* feat: route Slack PR review requests

Add a lightweight Slack review command path that starts the reviewer graph directly and gives the core agent a handoff tool when review requests are misrouted.

* fix: harden Slack PR review routing

* fix: validate Slack PR review URLs

* fix: preserve malformed GitHub review routing
2026-05-06 17:14:43 -07:00

17 lines
552 B
Python

import asyncio
from typing import Any
from agent.utils.slack import parse_github_pr_url
from agent.webapp import trigger_pr_review_from_ref
def request_pr_review(pr_url: str) -> dict[str, Any]:
"""Start the reviewer agent for a GitHub pull request URL."""
pr_ref = parse_github_pr_url(pr_url)
if not pr_ref:
return {
"success": False,
"error": "Expected a GitHub PR URL like https://github.com/OWNER/REPO/pull/NUMBER",
}
return asyncio.run(trigger_pr_review_from_ref(pr_ref, source="slack"))