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
fix(queue): record the real outcome when a reopen-reclose fails
Both the warning comment and the actual close call in
maybeRecloseDisallowedReopen were wrapped in .catch(() => undefined),
but the function unconditionally wrote a github_app.reopen_reclosed
audit event with outcome:"completed" regardless of whether the close
API call actually succeeded. A 403 from reduced permissions, a 404,
or a transient 5xx was silently swallowed while the audit ledger kept
recording a successful re-close — an operator trusting the audit
trail would believe the one-shot close was enforced when the PR may
still be open. This mirrors the same audit-fidelity gap already fixed
on the draft-dodge path.
Capture the close call's settled result and branch the audit outcome
on it: "completed" only when closePullRequest actually resolves,
"error" otherwise, with the underlying error captured in metadata.
The courtesy comment's own failure still never affects this — it's
independent of whether the close succeeded.
constoriginallyClosedBy=closer??"Gittensory (close beyond the inspected event window)";
8030
8035
awaitrecordAuditEvent(env,{
8031
8036
eventType: "github_app.reopen_reclosed",
8032
8037
actor: "gittensory",
8033
8038
targetKey: `${repoFullName}#${pr.number}`,
8034
-
outcome: "completed",
8035
-
detail: `re-closed a disallowed reopen by ${reopener} (originally closed by ${closer??"Gittensory (close beyond the inspected event window)"}) — one-shot; resubmit a new PR`,
? `re-closed a disallowed reopen by ${reopener} (originally closed by ${originallyClosedBy}) — one-shot; resubmit a new PR`
8043
+
: `FAILED to re-close a disallowed reopen by ${reopener} (originally closed by ${originallyClosedBy}) — the close API call did not succeed; the PR may still be open`,
const audit = await env.DB.prepare("select detail from audit_events where event_type = ?").bind("github_app.reopen_reclosed").first<{ detail: string }>();
11418
+
const audit = await env.DB.prepare("select outcome, detail from audit_events where event_type = ?").bind("github_app.reopen_reclosed").first<{ outcome: string; detail: string }>();
11419
+
expect(audit?.outcome).toBe("completed"); // #2260: a successful close is unaffected
11419
11420
expect(audit?.detail).toContain("originally closed by maintainer");
11420
11421
// #review-audit: the early return after a re-close stamps the delivery processed (was left "queued").
11421
11422
const webhookRow = await env.DB.prepare("select status from webhook_events where delivery_id = ?").bind("reopen-write-collab-close").first<{ status: string }>();
// The handler still owns the decision (never falls through to normal re-review) even though the API call failed.
11713
+
const webhookRow = await env.DB.prepare("select status from webhook_events where delivery_id = ?").bind("reopen-close-fails").first<{ status: string }>();
11714
+
expect(webhookRow?.status).toBe("processed");
11715
+
});
11716
+
11681
11717
it("does NOT re-close a disallowed reopen on an OBSERVE-only / un-opted-in repo (autonomy floor, #review-audit)", async () => {
0 commit comments