Commit 4f19ab4
authored
fix(scripts): pre-merge gate reads issue comments, not just review comments (#1549)
* fix(scripts): pre-merge gate reads issue comments, not just review comments
Codex posts clean verdicts ("Didn't find any major issues") as ISSUE
comments; pulls/{n}/comments returns only inline review comments, so
clean-verdict PRs were blocked forever despite an explicit sign-off,
contradicting the script's own documented contract (reviews, comments,
check runs). Verified against PR #1543 and #1545: BLOCKED -> OK.
* test(scripts): teach the pre-merge gh stub the issue-comments endpoint
The fake gh fell through to 'unexpected gh invocation' on the new
issues/{n}/comments lookup, failing all allow-merge scenarios (codex review
on #1549). Adds the endpoint plus two scenarios: a codex clean-verdict
issue comment satisfies the gate (the exact case the fix exists for), and
an unreadable issue-comments feed blocks.
* fix(scripts): require fresh clean-verdict codex issue comments
Issue comments are PR-wide, not head-scoped: a clean Codex verdict
posted before the latest push counted as reviewer activity for the new
head. The gate now keeps only issue comments created after the head
commit and, for Codex, requires the body to be a clean verdict —
findings arrive as review comments, so only the sign-off is an issue
comment. Adds stale and non-verdict scenarios to the gh stub.
* fix(scripts): pin codex issue-comment verdicts to the head SHA
Timestamp comparison against the head commit's committer date cannot
prove a verdict reviewed this SHA (committer dates survive cherry-picks
and rebases) and the unconditional commits API call blocked the gate on
transient failures even when no issue comments existed. Codex embeds
'Reviewed commit: <short sha>' in its clean verdicts, so the gate now
counts an issue comment only when it is a codex clean verdict whose
embedded SHA is a prefix of the current head — no timestamps, no extra
API call, and non-codex issue comments never count.
* fix(scripts): extract the reviewed-commit SHA instead of substring search
Searching for the head's first ten characters anywhere in the body
could accept a verdict whose prose merely mentions the SHA and rejects
verdicts where codex embeds a shorter short SHA. The gate now extracts
the hex run following the 'Reviewed commit' label (>= 7 chars, git's
short-SHA floor, markdown decoration tolerated) and requires it to be
a prefix of the current head. Stub head is now a realistic 40-char SHA;
adds short-SHA acceptance and SHA-in-prose rejection scenarios.
* fix(scripts): skip unpinned codex verdicts instead of aborting the gate
Under set -euo pipefail, the SHA-extraction grep pipeline exits nonzero
when a clean verdict has no 'Reviewed commit' label, killing the whole
gate. Tolerate the no-match case with || true so legacy unpinned
verdicts are simply never counted while reviews and check runs still
satisfy the reviewer requirement.1 parent 3a3e03f commit 4f19ab4
2 files changed
Lines changed: 162 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
111 | 121 | | |
112 | 122 | | |
113 | 123 | | |
| |||
126 | 136 | | |
127 | 137 | | |
128 | 138 | | |
129 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
130 | 163 | | |
131 | 164 | | |
132 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
82 | 122 | | |
83 | 123 | | |
84 | 124 | | |
85 | 125 | | |
86 | 126 | | |
87 | | - | |
| 127 | + | |
88 | 128 | | |
89 | 129 | | |
90 | 130 | | |
91 | | - | |
| 131 | + | |
92 | 132 | | |
93 | 133 | | |
94 | 134 | | |
| |||
194 | 234 | | |
195 | 235 | | |
196 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
197 | 322 | | |
198 | 323 | | |
199 | 324 | | |
| |||
0 commit comments