@@ -168,13 +168,24 @@ jobs:
168168 #
169169 # Reduce execution log -- needs steps.review.outputs.execution_file, empty when skipped
170170 # Upload tool usage -- needs steps.tool-usage.outcome == 'success', which is 'skipped'
171- # Notify on failure -- needs outcome 'failure' or 'cancelled', and this is 'skipped'
171+ # Notify on failure -- carries its own !inputs.dry_run, because it can now also fire
172+ # on a context failure rather than only on a review failure
172173 #
173174 # So a smoke run posts no review, no comment and no artifact. Everything before this step
174175 # still runs against the live API: the app token, the cross-repo prompt checkout, and the
175176 # nine context reads with the job's real permissions.
177+ #
178+ # steps.context.outcome, because the context step is continue-on-error and therefore fails
179+ # green. Anything that stops the script running -- a checkout that does not deliver it, a
180+ # renamed path, a sparse pattern that stops matching -- leaves pr_context, threads and
181+ # review_cycle unset, and an empty context is not a neutral one: a blank REVIEW CYCLE and an
182+ # empty prior-comments block read as cycle 1 with nothing raised before. That is a false
183+ # statement to the model, of exactly the kind the script's own guards exist to prevent, and
184+ # it would reach every consumer repo at once. No context, no review.
176185 - uses : anthropics/claude-code-action@v1
177- if : github.event.pull_request.user.login != 'dependabot[bot]' && !inputs.dry_run
186+ if : >-
187+ github.event.pull_request.user.login != 'dependabot[bot]' && !inputs.dry_run
188+ && steps.context.outcome == 'success'
178189 id : review
179190 continue-on-error : true
180191 with :
@@ -267,8 +278,15 @@ jobs:
267278 # (~100 review runs/week org-wide); the question is days-old, not quarters.
268279 retention-days : 14
269280
281+ # Also on a context failure, which now skips the review rather than feeding it an empty
282+ # context. Without this clause that path is the silent one: no review, no comment, green
283+ # check -- the shape of failure this workflow keeps being bitten by. !inputs.dry_run because
284+ # a smoke run reaches this step with the review skipped and must never write.
270285 - name : Notify on review failure
271- if : github.event.pull_request.user.login != 'dependabot[bot]' && (steps.review.outcome == 'failure' || steps.review.outcome == 'cancelled')
272- run : gh pr comment ${{ github.event.pull_request.number }} --body "Automated review unavailable (Claude step failed). Please review manually."
286+ if : >-
287+ github.event.pull_request.user.login != 'dependabot[bot]' && !inputs.dry_run
288+ && (steps.review.outcome == 'failure' || steps.review.outcome == 'cancelled'
289+ || steps.context.outcome == 'failure')
290+ run : gh pr comment ${{ github.event.pull_request.number }} --body "Automated review unavailable (the review step failed, or the context it needs could not be gathered). Please review manually."
273291 env :
274292 GH_TOKEN : ${{ github.token }}
0 commit comments