Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(review_hog): match a pr_status request only to a turn that covers its head (#114910)

Julian Bez1f18623dc727
diff --git a/products/review_hog/backend/api/reviews.py b/products/review_hog/backend/api/reviews.py
index 009fe5b5fbc5..d9e5c5d5c887 100644
--- a/products/review_hog/backend/api/reviews.py
+++ b/products/review_hog/backend/api/reviews.py
@@ -426,6 +426,11 @@ class ReviewPRStatusParamsSerializer(serializers.Serializer):
choices=ReviewTriggerRequestRunMode.choices,
help_text="The `run_mode` the trigger was called with (default 'review'). Only used with `requested_at`.",
)
+ head_sha = serializers.CharField(
+ required=False,
+ help_text="The `head_sha` the trigger returned. Lets a turn that was already running on that head when "
+ "the request came in answer the request. Only used with `requested_at`.",
+ )
class ReviewPRStatusLatestReviewSerializer(serializers.Serializer):
@@ -451,7 +456,8 @@ class ReviewPRStatusRequestOutcomeSerializer(serializers.Serializer):
status = serializers.ChoiceField(
choices=ReviewRequestOutcomeStatus.choices,
help_text="How the request ended: 'pending' while a run for it is queued or running, 'completed' when a "
- "turn of the requested mode or deeper finished after `requested_at` (Deep covers Standard), 'skipped' "
+ "turn of the requested mode or deeper finished after `requested_at` and either started after it or "
+ "reviewed the given `head_sha` (Deep covers Standard), 'skipped' "
"when the run ended without doing the work, 'failed' when the run died or no run answered the request, "
"'unknown' when the run state could not be read (retry later).",
)
@@ -1092,8 +1098,8 @@ class ReviewRecentReviewsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
summary="Look up a pull request's review status",
description="Where a pull request's ReviewHog runs stand: `state`, the latest completed review turn, and "
"the latest Resolve run. Works for any pull request on the project, also ones the caller did not "
- "trigger. Pass the trigger's `requested_at` and `run_mode` to get `request_outcome`, which says when "
- "that request is done.",
+ "trigger. Pass the `requested_at` and `head_sha` the trigger returned, and the `run_mode` it was called "
+ "with, to get `request_outcome`, which says when that request is done.",
)
@action(methods=["GET"], detail=False, required_scopes=["review_hog:read"])
def pr_status(self, request: Request, **kwargs) -> Response:
@@ -1112,7 +1118,11 @@ class ReviewRecentReviewsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
lookup = PRStatusLookup(
team_id, owner=str(pr_info["owner"]), repo=str(pr_info["repo"]), pr_number=int(pr_info["pr_number"])
)
- pr_status = lookup.status(params.validated_data.get("requested_at"), params.validated_data["run_mode"])
+ pr_status = lookup.status(
+ params.validated_data.get("requested_at"),
+ params.validated_data["run_mode"],
+ params.validated_data.get("head_sha"),
+ )
return Response(ReviewPRStatusSerializer(_pr_status_payload(pr_status)).data)
@extend_schema(
diff --git a/products/review_hog/backend/pr_status.py b/products/review_hog/backend/pr_status.py
index 13a01456a461..13b3ccaec3d8 100644
--- a/products/review_hog/backend/pr_status.py
+++ b/products/review_hog/backend/pr_status.py
@@ -187,8 +187,13 @@ class PRStatusLookup:
else None,
)
- def _completed_turn(self, requested_at: datetime, requested_mode: str) -> int | None:
- """The newest completed turn that answers the request, if any."""
+ def _completed_turn(self, requested_at: datetime, requested_mode: str, head_sha: str | None) -> int | None:
+ """The newest completed turn that answers the request, if any.
+
+ A turn answers when it covers the requested mode, finished at or after the request, and either
+ started at or after it or reviewed the request's head. A request that joins a turn already
+ running on an older head must wait for its own turn.
+ """
report = self.report
if report is None or self.report_id is None:
return None
@@ -203,7 +208,9 @@ class PRStatusLookup:
finished_after_request = report.last_run_at >= requested_at
else:
finished_after_request = marker.started_at >= requested_at
- if finished_after_request:
+ started_after_request = marker.started_at >= requested_at
+ reviewed_requested_head = head_sha is not None and marker.head_sha == head_sha
+ if finished_after_request and (started_after_request or reviewed_requested_head):
return run_index
return None
@@ -221,7 +228,7 @@ class PRStatusLookup:
)
def _review_outcome(
- self, requested_at: datetime, requested_mode: str, state: ReviewPRState
+ self, requested_at: datetime, requested_mode: str, head_sha: str | None, state: ReviewPRState
) -> RequestOutcome | None:
if self.report is None or self.report_id is None:
return None
@@ -230,7 +237,7 @@ class PRStatusLookup:
for marker in run_outcome_markers(self.team_id, [self.report_id], since=requested_at)[self.report_id]
if marker.stage == RUN_STAGE_REVIEW
]
- run_index = self._completed_turn(requested_at, requested_mode)
+ run_index = self._completed_turn(requested_at, requested_mode, head_sha)
if run_index is not None:
# Finalize counts the turn before it publishes, so a publish failure marks the same turn failed.
turn_failed = [
@@ -287,7 +294,7 @@ class PRStatusLookup:
status=ReviewRequestOutcomeStatus.FAILED, reason=NO_MATCHING_RUN_REASON, review_id=self.report_id
)
- def status(self, requested_at: datetime | None, run_mode: str) -> PRStatus:
+ def status(self, requested_at: datetime | None, run_mode: str, head_sha: str | None = None) -> PRStatus:
state = self._state()
resolution = (
latest_resolution_summaries(self.team_id, [self.report]).get(self.report_id)
@@ -300,7 +307,7 @@ class PRStatusLookup:
request_outcome = self._resolve_outcome(requested_at, resolution, state)
else:
requested_mode = REVIEW_MODE_FLASH if run_mode == RUN_MODE_FLASH else REVIEW_MODE_FULL
- request_outcome = self._review_outcome(requested_at, requested_mode, state)
+ request_outcome = self._review_outcome(requested_at, requested_mode, head_sha, state)
if request_outcome is None:
request_outcome = self._unmatched_outcome(state)
return PRStatus(
diff --git a/products/review_hog/backend/tests/test_pr_status_api.py b/products/review_hog/backend/tests/test_pr_status_api.py
index bd879a308f66..1bd01490f99d 100644
--- a/products/review_hog/backend/tests/test_pr_status_api.py
+++ b/products/review_hog/backend/tests/test_pr_status_api.py
@@ -54,13 +54,15 @@ class TestPRStatusAPI(APIBaseTest):
**kwargs,
)
- def _turn(self, report: ReviewReport, run_index: int, review_mode: str, *, at: datetime) -> None:
+ def _turn(
+ self, report: ReviewReport, run_index: int, review_mode: str, *, at: datetime, head_sha: str = "sha1"
+ ) -> None:
with time_machine.travel(at, tick=False):
ReviewReportArtefact.add_turn_marker(
team_id=self.team.id,
report_id=str(report.id),
content=TurnMarkerArtefact(
- head_sha="sha1",
+ head_sha=head_sha,
run_index=run_index,
review_mode=review_mode,
reviewhog_version="v",
@@ -79,6 +81,14 @@ class TestPRStatusAPI(APIBaseTest):
report = self._report(last_run_at=AFTER + timedelta(minutes=1))
self._turn(report, 1, REVIEW_MODE_FULL, at=AFTER)
+ def _running_turn_on_older_head_finished_after_request(self) -> None:
+ report = self._report(last_run_at=AFTER)
+ self._turn(report, 1, REVIEW_MODE_FULL, at=BEFORE, head_sha="sha0")
+
+ def _running_turn_on_same_head_finished_after_request(self) -> None:
+ report = self._report(last_run_at=AFTER)
+ self._turn(report, 1, REVIEW_MODE_FULL, at=BEFORE)
+
def _deep_turn_before_then_standard_dropped(self) -> None:
report = self._report()
self._turn(report, 1, REVIEW_MODE_FULL, at=BEFORE - timedelta(minutes=5))
@@ -207,6 +217,33 @@ class TestPRStatusAPI(APIBaseTest):
("failed", "no_matching_run", None),
),
("queued", "_deep_turn_before_request", "review", WorkflowProbe.RUNNING, ("pending", None, None)),
+ # The request joined a turn that was already running on an older head, so that turn does
+ # not answer it: the request's own turn is still queued, or the queue dropped it.
+ (
+ "joined_turn_on_older_head_queued",
+ "_running_turn_on_older_head_finished_after_request",
+ "review",
+ WorkflowProbe.RUNNING,
+ ("pending", None, None),
+ "sha1",
+ ),
+ (
+ "joined_turn_on_older_head_idle",
+ "_running_turn_on_older_head_finished_after_request",
+ "review",
+ WorkflowProbe.NOT_RUNNING,
+ ("failed", "no_matching_run", None),
+ "sha1",
+ ),
+ # A duplicate request on the head a running turn already reviews is served by that turn.
+ (
+ "joined_turn_on_same_head",
+ "_running_turn_on_same_head_finished_after_request",
+ "review",
+ WorkflowProbe.NOT_RUNNING,
+ ("completed", None, 1),
+ "sha1",
+ ),
# A Temporal error must never read as "nothing runs", or a queued request would read as failed.
("temporal_error", "_deep_turn_before_request", "review", WorkflowProbe.UNKNOWN, ("unknown", None, None)),
(
@@ -239,10 +276,14 @@ class TestPRStatusAPI(APIBaseTest):
run_mode: str,
probe: WorkflowProbe,
expected: tuple[str, str | None, int | None],
+ head_sha: str | None = None,
) -> None:
getattr(self, setup)()
+ params = {"requested_at": REQUESTED_AT.isoformat(), "run_mode": run_mode}
+ if head_sha is not None:
+ params["head_sha"] = head_sha
- body, _ = self._get(probe, requested_at=REQUESTED_AT.isoformat(), run_mode=run_mode)
+ body, _ = self._get(probe, **params)
outcome = body["request_outcome"]
assert (outcome["status"], outcome["reason"], outcome["run_index"]) == expected
diff --git a/products/review_hog/frontend/generated/api.schemas.ts b/products/review_hog/frontend/generated/api.schemas.ts
index f226718fa555..1e76beda7f33 100644
--- a/products/review_hog/frontend/generated/api.schemas.ts
+++ b/products/review_hog/frontend/generated/api.schemas.ts
@@ -1190,7 +1190,7 @@ export const ReviewRequestOutcomeStatusEnumApi = {
} as const
export interface ReviewPRStatusRequestOutcomeApi {
- /** How the request ended: 'pending' while a run for it is queued or running, 'completed' when a turn of the requested mode or deeper finished after `requested_at` (Deep covers Standard), 'skipped' when the run ended without doing the work, 'failed' when the run died or no run answered the request, 'unknown' when the run state could not be read (retry later).
+ /** How the request ended: 'pending' while a run for it is queued or running, 'completed' when a turn of the requested mode or deeper finished after `requested_at` and either started after it or reviewed the given `head_sha` (Deep covers Standard), 'skipped' when the run ended without doing the work, 'failed' when the run died or no run answered the request, 'unknown' when the run state could not be read (retry later).
*
* * `pending` - Pending
* * `completed` - Completed
@@ -1587,6 +1587,11 @@ export const ReviewHogReviewsPerspectiveStatsRetrieveScope = {
} as const
export type ReviewHogReviewsPrStatusRetrieveParams = {
+ /**
+ * The `head_sha` the trigger returned. Lets a turn that was already running on that head when the request came in answer the request. Only used with `requested_at`.
+ * @minLength 1
+ */
+ head_sha?: string
/**
* GitHub pull request URL to look up, e.g. 'https://github.com/PostHog/posthog/pull/123'.
* @minLength 1
diff --git a/products/review_hog/frontend/generated/api.ts b/products/review_hog/frontend/generated/api.ts
index 721d507924c8..d22e59b3e067 100644
--- a/products/review_hog/frontend/generated/api.ts
+++ b/products/review_hog/frontend/generated/api.ts
@@ -661,7 +661,7 @@ export const getReviewHogReviewsPrStatusRetrieveUrl = (
}
/**
- * Where a pull request's ReviewHog runs stand: `state`, the latest completed review turn, and the latest Resolve run. Works for any pull request on the project, also ones the caller did not trigger. Pass the trigger's `requested_at` and `run_mode` to get `request_outcome`, which says when that request is done.
+ * Where a pull request's ReviewHog runs stand: `state`, the latest completed review turn, and the latest Resolve run. Works for any pull request on the project, also ones the caller did not trigger. Pass the `requested_at` and `head_sha` the trigger returned, and the `run_mode` it was called with, to get `request_outcome`, which says when that request is done.
* @summary Look up a pull request's review status
*/
export const reviewHogReviewsPrStatusRetrieve = async (
diff --git a/products/review_hog/mcp/tools.yaml b/products/review_hog/mcp/tools.yaml
index f53fd9757b25..93324c679ac1 100644
--- a/products/review_hog/mcp/tools.yaml
+++ b/products/review_hog/mcp/tools.yaml
@@ -93,6 +93,9 @@ tools:
skips that check). A request while a review runs is queued on that PR's run and returns
`joined_running_review`. Refusals: 409 with `code` `flash_after_full` (the PR has a Deep review, so ask for
`review` instead) or `resolution_not_opted_in` (`resolve_only` on a PR whose owner did not opt in); 409
- without a code while Resolve runs on the PR, or while a review runs for a `resolve_only` request. Poll
- progress with `review-hog-reviews-list` and read the findings with `review-hog-reviews-get`.
+ without a code while Resolve runs on the PR, or while a review runs for a `resolve_only` request. To wait
+ for the result, poll `review-hog-reviews-pr-status` with `pr_url`, `requested_at` and `head_sha` from this
+ response and the `run_mode` you sent, until `request_outcome.status` is not `pending` (`unknown` means retry
+ later), then read the findings with `review-hog-reviews-get` using its `review_id` and `run_index`. An
+ `already_reviewed` response needs no polling.
feature_flag: review-hog
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 8547b2f80f25..66f0ca1e5e69 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -11020,7 +11020,7 @@
"feature_flag": "review-hog"
},
"review-hog-reviews-trigger": {
- "description": "Start a ReviewHog run on a pull request. Pass the PR as `pr_url` (e.g. `https://github.com/PostHog/posthog/pull/123`). The repository must be accessible to the project's GitHub App installation. `run_mode` picks the variant: `review` (the default) is a Deep review, published to the PR, followed by the Resolve stage; `review_only` is a Deep review without Resolve; `flash` is a Standard review on a lower-cost model that never resolves; `resolve_only` skips the review and only works the PR's existing unresolved review threads. Resolve runs only when the pull request owner opted in to resolving comments, not the requester. The owner is the PR author, or the Inbox reviewer for a PR the PostHog app opened. The response's `resolve_will_run` says whether Resolve will run, and `resolve_skip_reason` says why not. IMPORTANT: Resolve writes to the PR itself. It may push signed fix commits to the PR's branch, reply to review threads, and resolve bot-authored threads. Nothing is deleted and the commits are plain appends, but the actions are public to everyone on the PR. Non-blocking: returns `status` `started`, with `repository`, `pr_number`, the `head_sha` the request targets, `review_mode`, `requested_at`, and `report_id` (null on the PR's first run; find it later with `review-hog-reviews-list`). If the PR's current commit already has a published review in the requested mode, it returns `already_reviewed` without starting a run (`resolve_only` skips that check). A request while a review runs is queued on that PR's run and returns `joined_running_review`. Refusals: 409 with `code` `flash_after_full` (the PR has a Deep review, so ask for `review` instead) or `resolution_not_opted_in` (`resolve_only` on a PR whose owner did not opt in); 409 without a code while Resolve runs on the PR, or while a review runs for a `resolve_only` request. Poll progress with `review-hog-reviews-list` and read the findings with `review-hog-reviews-get`.",
+ "description": "Start a ReviewHog run on a pull request. Pass the PR as `pr_url` (e.g. `https://github.com/PostHog/posthog/pull/123`). The repository must be accessible to the project's GitHub App installation. `run_mode` picks the variant: `review` (the default) is a Deep review, published to the PR, followed by the Resolve stage; `review_only` is a Deep review without Resolve; `flash` is a Standard review on a lower-cost model that never resolves; `resolve_only` skips the review and only works the PR's existing unresolved review threads. Resolve runs only when the pull request owner opted in to resolving comments, not the requester. The owner is the PR author, or the Inbox reviewer for a PR the PostHog app opened. The response's `resolve_will_run` says whether Resolve will run, and `resolve_skip_reason` says why not. IMPORTANT: Resolve writes to the PR itself. It may push signed fix commits to the PR's branch, reply to review threads, and resolve bot-authored threads. Nothing is deleted and the commits are plain appends, but the actions are public to everyone on the PR. Non-blocking: returns `status` `started`, with `repository`, `pr_number`, the `head_sha` the request targets, `review_mode`, `requested_at`, and `report_id` (null on the PR's first run; find it later with `review-hog-reviews-list`). If the PR's current commit already has a published review in the requested mode, it returns `already_reviewed` without starting a run (`resolve_only` skips that check). A request while a review runs is queued on that PR's run and returns `joined_running_review`. Refusals: 409 with `code` `flash_after_full` (the PR has a Deep review, so ask for `review` instead) or `resolution_not_opted_in` (`resolve_only` on a PR whose owner did not opt in); 409 without a code while Resolve runs on the PR, or while a review runs for a `resolve_only` request. To wait for the result, poll `review-hog-reviews-pr-status` with `pr_url`, `requested_at` and `head_sha` from this response and the `run_mode` you sent, until `request_outcome.status` is not `pending` (`unknown` means retry later), then read the findings with `review-hog-reviews-get` using its `review_id` and `run_index`. An `already_reviewed` response needs no polling.",
"category": "ReviewHog",
"feature": "review_hog",
"summary": "Trigger a ReviewHog review",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 981516dae4cb..c5e0f49af3ba 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -11625,7 +11625,7 @@
"feature_flag": "review-hog"
},
"review-hog-reviews-trigger": {
- "description": "Start a ReviewHog run on a pull request. Pass the PR as `pr_url` (e.g. `https://github.com/PostHog/posthog/pull/123`). The repository must be accessible to the project's GitHub App installation. `run_mode` picks the variant: `review` (the default) is a Deep review, published to the PR, followed by the Resolve stage; `review_only` is a Deep review without Resolve; `flash` is a Standard review on a lower-cost model that never resolves; `resolve_only` skips the review and only works the PR's existing unresolved review threads. Resolve runs only when the pull request owner opted in to resolving comments, not the requester. The owner is the PR author, or the Inbox reviewer for a PR the PostHog app opened. The response's `resolve_will_run` says whether Resolve will run, and `resolve_skip_reason` says why not. IMPORTANT: Resolve writes to the PR itself. It may push signed fix commits to the PR's branch, reply to review threads, and resolve bot-authored threads. Nothing is deleted and the commits are plain appends, but the actions are public to everyone on the PR. Non-blocking: returns `status` `started`, with `repository`, `pr_number`, the `head_sha` the request targets, `review_mode`, `requested_at`, and `report_id` (null on the PR's first run; find it later with `review-hog-reviews-list`). If the PR's current commit already has a published review in the requested mode, it returns `already_reviewed` without starting a run (`resolve_only` skips that check). A request while a review runs is queued on that PR's run and returns `joined_running_review`. Refusals: 409 with `code` `flash_after_full` (the PR has a Deep review, so ask for `review` instead) or `resolution_not_opted_in` (`resolve_only` on a PR whose owner did not opt in); 409 without a code while Resolve runs on the PR, or while a review runs for a `resolve_only` request. Poll progress with `review-hog-reviews-list` and read the findings with `review-hog-reviews-get`.",
+ "description": "Start a ReviewHog run on a pull request. Pass the PR as `pr_url` (e.g. `https://github.com/PostHog/posthog/pull/123`). The repository must be accessible to the project's GitHub App installation. `run_mode` picks the variant: `review` (the default) is a Deep review, published to the PR, followed by the Resolve stage; `review_only` is a Deep review without Resolve; `flash` is a Standard review on a lower-cost model that never resolves; `resolve_only` skips the review and only works the PR's existing unresolved review threads. Resolve runs only when the pull request owner opted in to resolving comments, not the requester. The owner is the PR author, or the Inbox reviewer for a PR the PostHog app opened. The response's `resolve_will_run` says whether Resolve will run, and `resolve_skip_reason` says why not. IMPORTANT: Resolve writes to the PR itself. It may push signed fix commits to the PR's branch, reply to review threads, and resolve bot-authored threads. Nothing is deleted and the commits are plain appends, but the actions are public to everyone on the PR. Non-blocking: returns `status` `started`, with `repository`, `pr_number`, the `head_sha` the request targets, `review_mode`, `requested_at`, and `report_id` (null on the PR's first run; find it later with `review-hog-reviews-list`). If the PR's current commit already has a published review in the requested mode, it returns `already_reviewed` without starting a run (`resolve_only` skips that check). A request while a review runs is queued on that PR's run and returns `joined_running_review`. Refusals: 409 with `code` `flash_after_full` (the PR has a Deep review, so ask for `review` instead) or `resolution_not_opted_in` (`resolve_only` on a PR whose owner did not opt in); 409 without a code while Resolve runs on the PR, or while a review runs for a `resolve_only` request. To wait for the result, poll `review-hog-reviews-pr-status` with `pr_url`, `requested_at` and `head_sha` from this response and the `run_mode` you sent, until `request_outcome.status` is not `pending` (`unknown` means retry later), then read the findings with `review-hog-reviews-get` using its `review_id` and `run_index`. An `already_reviewed` response needs no polling.",
"category": "ReviewHog",
"feature": "review_hog",
"summary": "Trigger a ReviewHog review",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 5200aa8ddae5..c7bc94850b64 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -95676,7 +95676,7 @@ export namespace Schemas {
} as const;
export interface ReviewPRStatusRequestOutcome {
- /** How the request ended: 'pending' while a run for it is queued or running, 'completed' when a turn of the requested mode or deeper finished after `requested_at` (Deep covers Standard), 'skipped' when the run ended without doing the work, 'failed' when the run died or no run answered the request, 'unknown' when the run state could not be read (retry later).
+ /** How the request ended: 'pending' while a run for it is queued or running, 'completed' when a turn of the requested mode or deeper finished after `requested_at` and either started after it or reviewed the given `head_sha` (Deep covers Standard), 'skipped' when the run ended without doing the work, 'failed' when the run died or no run answered the request, 'unknown' when the run state could not be read (retry later).
*
* * `pending` - Pending
* * `completed` - Completed
@@ -126614,6 +126614,11 @@ export namespace Schemas {
} as const;
export type ReviewHogReviewsPrStatusRetrieveParams = {
+ /**
+ * The `head_sha` the trigger returned. Lets a turn that was already running on that head when the request came in answer the request. Only used with `requested_at`.
+ * @minLength 1
+ */
+ head_sha?: string;
/**
* GitHub pull request URL to look up, e.g. 'https://github.com/PostHog/posthog/pull/123'.
* @minLength 1
diff --git a/services/mcp/src/generated/review_hog/api.ts b/services/mcp/src/generated/review_hog/api.ts
index ad1d3a561997..271a12f9a79b 100644
--- a/services/mcp/src/generated/review_hog/api.ts
+++ b/services/mcp/src/generated/review_hog/api.ts
@@ -65,7 +65,7 @@ export const ReviewHogReviewsRetrieveQueryParams = () => zod.object({
})
/**
- * Where a pull request's ReviewHog runs stand: `state`, the latest completed review turn, and the latest Resolve run. Works for any pull request on the project, also ones the caller did not trigger. Pass the trigger's `requested_at` and `run_mode` to get `request_outcome`, which says when that request is done.
+ * Where a pull request's ReviewHog runs stand: `state`, the latest completed review turn, and the latest Resolve run. Works for any pull request on the project, also ones the caller did not trigger. Pass the `requested_at` and `head_sha` the trigger returned, and the `run_mode` it was called with, to get `request_outcome`, which says when that request is done.
* @summary Look up a pull request's review status
*/
export const ReviewHogReviewsPrStatusRetrieveParams = () => zod.object({
@@ -79,6 +79,13 @@ export const ReviewHogReviewsPrStatusRetrieveParams = () => zod.object({
export const reviewHogReviewsPrStatusRetrieveQueryRunModeDefault = `review`
export const ReviewHogReviewsPrStatusRetrieveQueryParams = () => zod.object({
+ head_sha: zod
+ .string()
+ .min(1)
+ .optional()
+ .describe(
+ 'The `head_sha` the trigger returned. Lets a turn that was already running on that head when the request came in answer the request. Only used with `requested_at`.'
+ ),
pr_url: zod
.string()
.min(1)
diff --git a/services/mcp/src/tools/generated/review_hog.ts b/services/mcp/src/tools/generated/review_hog.ts
index 8c9ad5ec0942..5a63e09c0e5a 100644
--- a/services/mcp/src/tools/generated/review_hog.ts
+++ b/services/mcp/src/tools/generated/review_hog.ts
@@ -70,6 +70,7 @@ const reviewHogReviewsPrStatus = (): ToolBase<
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/review_hog/reviews/pr_status/`,
query: {
+ head_sha: params.head_sha,
pr_url: params.pr_url,
requested_at: params.requested_at,
run_mode: params.run_mode,