You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(review): let a bot-captured before/after satisfy the screenshot-table gate (#4128)
evaluateScreenshotTableGate now accepts a botCaptureSatisfied input: when the
visual-capture pipeline (review.visual.enabled) already rendered a real
before/after pair for the PR's current head, the gate is satisfied without a
hand-authored body table. The capture result is persisted to a new
pull_requests.visual_capture_satisfied_sha column (keyed to head SHA, mirrors
approved_head_sha) by maybePublishPrPublicSurface and re-read by the
maintenance pass in the same webhook, so no capture is re-run and no return
value needs threading through every caller.
Also resolves the dead ScreenshotTableGateAction surface: request_changes and
comment were fully typed/validated but processors.ts only ever branched on
"close", so setting either silently did nothing. Both are removed; "close" is
now the only valid action, and a legacy config value normalizes to it with a
warning like any other invalid input.
if(record.action!==undefined)warnings.push(`settings.requireScreenshotTable.action must be one of close, request_changes, comment; using the default "close".`);
75
+
if(record.action!==undefined)warnings.push(`settings.requireScreenshotTable.action must be "close" (the only supported value; #4110 removed request_changes/comment as dead config surface); using the default "close".`);
Copy file name to clipboardExpand all lines: src/queue/processors.ts
+29-5Lines changed: 29 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,7 @@ import {
56
56
markPullRequestsRegated,
57
57
markPullRequestReviewsInvalidated,
58
58
markPullRequestSurfacePublished,
59
+
markPullRequestVisualCaptureSatisfied,
59
60
getLatestRegatedAt,
60
61
claimRegateFanoutSlot,
61
62
recordAgentCommandFeedback,
@@ -358,7 +359,7 @@ import { randomUUID } from "node:crypto";
358
359
import { isRetryableJobError, RetryableJobError } from "./retryable";
359
360
import { screenshotsAllowed } from "../review/visual-wire";
360
361
import { isVisualPath } from "../review/visual/paths";
361
-
import { buildCapture, type CaptureRoute } from "../review/visual/capture";
362
+
import { buildCapture, hasSuccessfulBotCapture, type CaptureRoute } from "../review/visual/capture";
362
363
import { incr } from "../selfhost/metrics";
363
364
import {
364
365
renderReviewingPlaceholder,
@@ -2778,17 +2779,22 @@ async function runAgentMaintenancePlanAndExecute(
2778
2779
);
2779
2780
2780
2781
// Screenshot-table gate (#2006): a DETERMINISTIC check (no AI) that an in-scope (label/path-matched)
2781
-
// contributor visual/frontend PR's body contains a before/after screenshot table. Off by default
2782
-
// (settings.screenshotTableGate.enabled === false), so the pure evaluator below is effectively free for the
2783
-
// common case. Only "close" is wired as an enforcement action here (the other configured actions stay
2784
-
// advisory, matching the issue's phased rollout) -- the ternary below is the ONLY place that reads `.action`.
2782
+
// contributor visual/frontend PR's body contains a before/after screenshot table -- OR (#4110) that the
2783
+
// bot's own visual-capture pipeline already produced a real before/after render for this exact head
2784
+
// (markPullRequestVisualCaptureSatisfied, written earlier in this same webhook by maybePublishPrPublicSurface
2785
+
// -- see that function's beforeAfter block -- and re-read here on `pr`, which this caller already re-fetched
2786
+
// fresh from the DB). Off by default (settings.screenshotTableGate.enabled === false), so the pure evaluator
2787
+
// below is effectively free for the common case. "close" is the only enforcement action this gate has (#4110
2788
+
// removed the dead request_changes/comment surface) -- the check below is the ONLY place that reads `.action`.
2785
2789
/* v8 ignore next -- defensive: resolveRepositorySettings always populates screenshotTableGate (getRepositorySettings's DB defaults), so this fallback is unreachable in practice. */
0 commit comments