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.

chore(reviewhog): Increase retries for the implementation stage. (#83165)

Alex Lebedev05627a4a63b1
diff --git a/products/review_hog/backend/reviewer/constants.py b/products/review_hog/backend/reviewer/constants.py
index 46aad6178a95..89f3478fa880 100644
--- a/products/review_hog/backend/reviewer/constants.py
+++ b/products/review_hog/backend/reviewer/constants.py
@@ -138,8 +138,10 @@ MAX_THREADS_PER_RUN = 20
# Attempts for the per-PR resolution session. Retries are cheap — the per-thread verdicts persist,
# so a retry redoes unjudged threads and undelivered side effects (a crash in the post-reply window
# can still duplicate a reply; see temporal/resolution.py). On the final attempt a failed turn skips
-# its thread instead of raising, mirroring the validation session.
-RESOLUTION_MAX_ATTEMPTS = 2
+# its thread instead of raising, mirroring the validation session. Sized for prod worker rollouts:
+# deploys land every ~15 minutes and kill the in-flight attempt after a ~5-minute grace, so an
+# attempt survives ~2-4 turns and a full work-list needs several attempts to grind through.
+RESOLUTION_MAX_ATTEMPTS = 5
# CHUNKING MODEL
# Pins for the sandbox chunking turn (PRs over the one-shot gate), matching the one-shot pin below —
diff --git a/products/review_hog/backend/tests/test_resolution_activity.py b/products/review_hog/backend/tests/test_resolution_activity.py
index e9f0f9a93fe8..c05896078d52 100644
--- a/products/review_hog/backend/tests/test_resolution_activity.py
+++ b/products/review_hog/backend/tests/test_resolution_activity.py
@@ -15,6 +15,7 @@ from posthog.models.user import User
from products.review_hog.backend.models import ReviewReport, ReviewReportArtefact, ReviewSkillConfig
from products.review_hog.backend.reviewer.artefact_content import ThreadVerdictArtefact
+from products.review_hog.backend.reviewer.constants import RESOLUTION_MAX_ATTEMPTS
from products.review_hog.backend.reviewer.lazy_seed import sync_canonical_resolution
from products.review_hog.backend.reviewer.models.github_meta import PRMetadata
from products.review_hog.backend.reviewer.models.thread_resolution import ThreadResolution
@@ -447,7 +448,10 @@ class TestFailedRunActivity(NonAtomicBaseTest):
for p in self._base_patches(mock_activity, [self._thread("PRRT_9")]):
stack.enter_context(p)
stack.enter_context(patch(f"{_RESOLUTION}.start_sandbox_session", side_effect=RuntimeError("sandbox down")))
- for attempt, expected in ((1, ReviewReport.Status.ACTIVE), (2, ReviewReport.Status.IDLE)):
+ for attempt, expected in (
+ (1, ReviewReport.Status.ACTIVE),
+ (RESOLUTION_MAX_ATTEMPTS, ReviewReport.Status.IDLE),
+ ):
mock_activity.info.return_value.attempt = attempt
with pytest.raises(RuntimeError, match="sandbox down"):
async_to_sync(resolve_threads_activity)(self._input())
@@ -458,7 +462,7 @@ class TestFailedRunActivity(NonAtomicBaseTest):
# session-open dies too. With a completed turn behind it that must degrade to a skip —
# not fail the run, which would block this PR's resolution forever.
mock_activity = Mock()
- mock_activity.info.return_value.attempt = 2
+ mock_activity.info.return_value.attempt = RESOLUTION_MAX_ATTEMPTS
session = Mock()
session.task_run.task_id = "11111111-1111-1111-1111-111111111111"
session.task_run.id = "run-1"