repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Retry a review that returned without a verdict (#137)

fd5b0fd8dacb5aedf7fe13bac914815f1db133df

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

## What forced this

#114 made a no-op review fail loudly instead of reporting a green
mission-critical gate, and left no way back — the red is terminal until
a human re-runs the job. The fault it reports is one #114 itself
documented as intermittent.

Last night it fired four times in six minutes: `reviewer` and
`security-reviewer` on #125 (run 30173118143) and `reviewer` on #124
(run 30173085539). All four passed on `rerun_failed_jobs` against
unchanged heads, `7c96479` and `cf3c157`, with no edit to either diff.
Both PRs sat red until someone noticed, and #124 additionally drew a
`blocked`/`stalled` freeze from the sweeper, which read the red gate as
a builder failing review (#128).

## The call

Retry the agent once when it ends without a verdict. The condition is
deliberately "no verdict cast" and not "the step failed": the bug is the
agent returning **success** having done nothing — no comment, no label,
exit 0 — so a retry keyed on step outcome would never fire on it.

## What we deliberately didn't do

Did not factor the duplicated agent block into a composite action. That
is #51's DRY work, and folding it in would widen a reliability fix into
a refactor of all seven Codex workflows — a bigger diff to review for a
change whose value is that it is obviously correct.

Did not give `security-reviewer` different terms. `risk:high`
deliberately survives the `reset` job, so a label test alone would be
satisfiable there by a sticky label from an earlier head — which is the
exact hole the marker-comment evidence closes. Requiring both makes the
sticky path unable to fake a verdict, so the same retry is safe on both
jobs. That is acceptance item 4, decided rather than inherited.

## Evidence

The probe demands what the assertion demands: a verdict label **and** a
comment from this bot, for this head, newer than `REVIEW_STARTED_AT`,
whose first line begins with the job's marker. So a retry cannot pass on
attempt 1's leavings. A second empty attempt still ends red — the
assertion is untouched and remains the only arbiter, and fail-closed
`merge-gate` behaviour is unchanged.

Both attempts and the probe's verdict are echoed, so a recovered no-op
is countable from the log instead of invisible.

YAML parses and both jobs carry the expected seven steps. The retry path
itself is **unexercised**: workflow changes cannot be run in a
container, and a no-verdict cannot be induced on demand. p35 is the
harness for proving ADW mechanics live if you want it exercised before
trusting it.

## Surface touched

`.github/workflows/adw-review.yml` — the `reviewer` and
`security-reviewer` jobs.

## If this ages badly

Delete the probe and the attempt-2 step; the jobs return to one attempt
and today's behaviour exactly. If a retry ever masks a genuine reviewer
defect by passing on the second try, the log line naming attempt 2 is
the signal, and the fix is to escalate on any retry rather than to
remove it.

Closes #129

Changed files (1)

+144 / −2 text lines

Diff layout

.github/workflows/adw-review.yml

Modified

+144 / −2 text lines

8585 private-key: ${{ secrets.APP_PRIVATE_KEY }}
8686 - name: Mark the start of this review
8787 run: echo "REVIEW_STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
88 - uses: anthropics/claude-code-action@v1
88 # Attempt 1. continue-on-error so a hard agent failure falls through
89 # to the retry instead of ending the job; the assert still decides.
90 - name: Review (attempt 1)
91 continue-on-error: true
92 uses: anthropics/claude-code-action@v1
93 with:
94 github_token: ${{ steps.token.outputs.token }}
95 allowed_bots: agent-smith-bugabinga-adc
96 claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
97 prompt: |
98 Use the reviewer subagent to review PR
99 #${{ github.event.pull_request.number }} in ${{ github.repository }}.
100 Follow .claude/agents/reviewer.md: adversarial correctness review vs
101 the spec, craft lenses. Do not merge.
102 Post ONE terse PR comment: findings as one-line bullets (file:line —
103 the defect), most severe first, no preamble/praise/restating; a clean
104 pass is one line. The comment's FIRST LINE must begin with exactly
105 `Review: ${{ github.event.pull_request.head.sha }}` — the workflow
106 proves this job reviewed THIS commit by finding that prefix and that
107 sha, and a comment without both reads as if you never posted.
108 Then apply your verdict as a label: on approve add
109 `reviewed` and remove `changes-requested`; on request-changes add
110 `changes-requested` and remove `reviewed`.
111 You are a mission-critical gate.
112 claude_args: --model claude-opus-4-8 --effort xhigh --dangerously-skip-permissions
113 # The failure this absorbs is the agent returning SUCCESS having done
114 # nothing: no comment, no label, exit 0. Four jobs across two PRs failed
115 # that way inside one six-minute window, and all four passed on a manual
116 # re-run of the identical head (#129). So the retry condition is "no
117 # verdict cast", never "the step failed" — keying on step outcome would
118 # miss the bug this exists for.
119 - name: Did attempt 1 cast a verdict?
120 id: probe
121 env:
122 GH_TOKEN: ${{ steps.token.outputs.token }}
123 PR: ${{ github.event.pull_request.number }}
124 REPO: ${{ github.repository }}
125 MARKER: "Review:"
126 REVIEW_BOT: "agent-smith-bugabinga-adc[bot]"
127 HEAD_SHA: ${{ github.event.pull_request.head.sha }}
128 run: |
129 # -e is off deliberately: this step reports, it never decides. The
130 # assert below is the only arbiter, so a probe that failed hard would
131 # replace a recoverable no-op with an unrecoverable red.
132 set -uo pipefail
133 cast=false
134 labels=$(gh pr view "$PR" --repo "$REPO" --json labels \
135 -q '[.labels[].name] | join(",")' || true)
136 case ",$labels," in
137 *,reviewed,*|*,changes-requested,*)
138 # A verdict label can outlive the run that set it, so the label
139 # alone cannot prove this attempt did anything. Require this
140 # attempt's own marker comment for this head — the same evidence
141 # the assert demands, for the same reason, and the reason the
142 # sticky-label path cannot fake a verdict here either.
143 posted=$(gh api "repos/$REPO/issues/$PR/comments" --paginate \
144 --jq '.[] | [.created_at, .user.login, (.body | split("\n")[0])] | @tsv' \
145 | awk -F'\t' -v t="$REVIEW_STARTED_AT" -v m="$MARKER" -v b="$REVIEW_BOT" \
146 -v sha="$HEAD_SHA" \
147 '$2 == b && $1 >= t && index($3, m) == 1 && index($3, sha) > 0' | wc -l)
148 [ "${posted:-0}" -gt 0 ] && cast=true
149 ;;
150 esac
151 echo "cast=$cast" >> "$GITHUB_OUTPUT"
152 if [ "$cast" = true ]; then
153 echo "attempt 1 cast a verdict"
154 else
155 echo "::warning::attempt 1 ended without a verdict — retrying once"
156 fi
157 - name: Review (attempt 2, after a no-verdict attempt 1)
158 if: steps.probe.outputs.cast != 'true'
159 uses: anthropics/claude-code-action@v1
89160 with:
90161 github_token: ${{ steps.token.outputs.token }}
91162 allowed_bots: agent-smith-bugabinga-adc
159230 private-key: ${{ secrets.APP_PRIVATE_KEY }}
160231 - name: Mark the start of this review
161232 run: echo "REVIEW_STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
162 - uses: anthropics/claude-code-action@v1
233 # Attempt 1. continue-on-error so a hard agent failure falls through
234 # to the retry instead of ending the job; the assert still decides.
235 - name: Security review (attempt 1)
236 continue-on-error: true
237 uses: anthropics/claude-code-action@v1
238 with:
239 github_token: ${{ steps.token.outputs.token }}
240 allowed_bots: agent-smith-bugabinga-adc
241 claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
242 prompt: |
243 Use the security-reviewer subagent to review PR
244 #${{ github.event.pull_request.number }} in ${{ github.repository }}.
245 Follow .claude/agents/security-reviewer.md: sandbox, secrets, unsafe,
246 injection, supply chain. Do not merge.
247 Post ONE terse PR comment: only real findings as one-line bullets
248 (file:line — the risk), most severe first; a clean pass is one line.
249 The comment's FIRST LINE must begin with exactly
250 `Security review: ${{ github.event.pull_request.head.sha }}` — the
251 workflow proves this job reviewed THIS commit by finding that prefix
252 and that sha, and a comment without both reads as if you never posted.
253 Then apply your verdict: if nothing high-severity add `security-cleared`;
254 on a high finding add `risk:high` and ensure `security-cleared` is
255 absent (holds the merge for the owner).
256 You are a mission-critical gate.
257 claude_args: --model claude-opus-4-8 --effort high --dangerously-skip-permissions
258 # The failure this absorbs is the agent returning SUCCESS having done
259 # nothing: no comment, no label, exit 0. Four jobs across two PRs failed
260 # that way inside one six-minute window, and all four passed on a manual
261 # re-run of the identical head (#129). So the retry condition is "no
262 # verdict cast", never "the step failed" — keying on step outcome would
263 # miss the bug this exists for.
264 - name: Did attempt 1 cast a verdict?
265 id: probe
266 env:
267 GH_TOKEN: ${{ steps.token.outputs.token }}
268 PR: ${{ github.event.pull_request.number }}
269 REPO: ${{ github.repository }}
270 MARKER: "Security review:"
271 REVIEW_BOT: "agent-smith-bugabinga-adc[bot]"
272 HEAD_SHA: ${{ github.event.pull_request.head.sha }}
273 run: |
274 # -e is off deliberately: this step reports, it never decides. The
275 # assert below is the only arbiter, so a probe that failed hard would
276 # replace a recoverable no-op with an unrecoverable red.
277 set -uo pipefail
278 cast=false
279 labels=$(gh pr view "$PR" --repo "$REPO" --json labels \
280 -q '[.labels[].name] | join(",")' || true)
281 case ",$labels," in
282 *,security-cleared,*|*,risk:high,*)
283 # A verdict label can outlive the run that set it, so the label
284 # alone cannot prove this attempt did anything. Require this
285 # attempt's own marker comment for this head — the same evidence
286 # the assert demands, for the same reason, and the reason the
287 # sticky-label path cannot fake a verdict here either.
288 posted=$(gh api "repos/$REPO/issues/$PR/comments" --paginate \
289 --jq '.[] | [.created_at, .user.login, (.body | split("\n")[0])] | @tsv' \
290 | awk -F'\t' -v t="$REVIEW_STARTED_AT" -v m="$MARKER" -v b="$REVIEW_BOT" \
291 -v sha="$HEAD_SHA" \
292 '$2 == b && $1 >= t && index($3, m) == 1 && index($3, sha) > 0' | wc -l)
293 [ "${posted:-0}" -gt 0 ] && cast=true
294 ;;
295 esac
296 echo "cast=$cast" >> "$GITHUB_OUTPUT"
297 if [ "$cast" = true ]; then
298 echo "attempt 1 cast a verdict"
299 else
300 echo "::warning::attempt 1 ended without a verdict — retrying once"
301 fi
302 - name: Security review (attempt 2, after a no-verdict attempt 1)
303 if: steps.probe.outputs.cast != 'true'
304 uses: anthropics/claude-code-action@v1
163305 with:
164306 github_token: ${{ steps.token.outputs.token }}
165307 allowed_bots: agent-smith-bugabinga-adc