Repository navigation
review: decide the pre-approval check in the script, not in prose - #1217
Conversation
`references/approving.md` had the agent run `poll_pr_checks.py snapshot`, then branch on its fields: a failure beside pending checks meant poll to settle and re-snapshot; a failure still standing at the poll cap meant resolving each failure's Actions run and approving only if every one was cancelled. The skill said so itself — "don't leave this to improvisation: the same stale red must not draw an APPROVE on one PR and a withheld approval on the next" — which is a rule with every input in the script's hands. `poll_pr_checks.py approval <pr> <sha>` replaces `snapshot`, its only caller being this file, and prints `approve:` or `withhold:`. It shares the settle loop `poll` already ran, now extracted as `_settle`. The reference drops from 65 lines to 45. The head-moved comparison goes rather than moving: every review POST in the review skill runs behind `review_preflight.py post -- …`, which refuses a moved head at the moment of posting, so a second check before the wait guarded the same thing earlier and more weakly. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PoS7vwmM9mqPmS2UGBLJiw
tend-agent
left a comment
There was a problem hiding this comment.
_run_conclusion is the only gh call left unguarded in the module — fetch_rollup and head_note both catch CalledProcessError, and enrich_tend_outage_issues.py wraps its own gh run view the same way. When that call fails (a 5xx, a rate limit, a detailsUrl whose run id doesn't resolve in this repo), the exception unwinds to the __main__ handler, which exits with gh's status — 1, the code withhold: already uses — having printed no verdict at all.
That is the one path where the reference gives the agent nothing to read: approve:/withhold: key on stdout, and "any other exit decided nothing" keys on an exit code this path shares with a real red. It also lands after the full ~9-minute settle, so the decision this PR moved into the script goes back to improvisation on exactly the run where it cost the most to reach. Returning "" puts it on the terminal-red branch that already exists, which is what the old prose gave an unresolvable URL.
Reproduced against the current head with a gh stub that 404s on run view: the rollup read and the settle loop both complete, then the process exits 1 with an empty stdout.
…t be read `approval` resolves each failing check to its Actions run to tell a cancellation artifact from a real red. That `gh run view` call was unguarded, so a 5xx or a run id this repo can't resolve unwound to the `__main__` handler and exited with gh's status — 1, the same code `withhold:` uses — with nothing on stdout, after the full settle wait. A run that can't be read now decides nothing: exit 2, the code the module already uses for an unreadable rollup, with the unread checks on stderr. A failure confirmed real still withholds, since the unread run can't change that verdict. Treating the unreadable run as a real red was the other option; a failed API read isn't evidence the check failed on its merits. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PoS7vwmM9mqPmS2UGBLJiw
Regenerates the `tend-*.yaml` workflows for tend 0.2.7 (from 0.2.6). The diff is the version comment and the `max-sixty/tend/claude@` action pin in all eight workflows; no job, trigger, or permission changed. What adopters get from the upgrade: - **The sandbox can write zsh here-documents again.** Scratch files for heredocs now go to the writable temp dir instead of a path the sandbox denies, so a session that shells out through zsh no longer fails on them (max-sixty/tend#1211). This run hit exactly that failure while composing this description. - **`review-runs` stops reporting paths that have since gone green.** It re-queries the closure read before calling a path still red, so a run fixed between the scan and the report is no longer written up as an outstanding failure (max-sixty/tend#1210). - **`review-runs` now checks open Dependabot alerts** as part of its live repository scan, so unaddressed security advisories surface in the daily sweep (max-sixty/tend#1214). - **Sessions load less bundled guidance.** `running-in-ci` and `review` keep the rules every session needs and move the rarer actions — opening a PR, pushing, monitoring CI, posting, draft mode — into `references/` files read on demand, dropping from 52 KB to 20 KB and 41 KB to 25 KB respectively. That leaves more of each session's context for the actual work (max-sixty/tend#1215). - **PR review decides its pre-approval check in a script** rather than re-deriving it from prose each session, which makes the approve/don't-approve call consistent run to run (max-sixty/tend#1217). Full comparison: max-sixty/tend@0.2.6...0.2.7 `.config/tend.yaml` pins no model, so nothing there needed to move. Co-authored-by: worktrunk-bot <[email protected]>
Before an empty-body APPROVE,
review/references/approving.mdhad the agent runpoll_pr_checks.py snapshotand then branch on its fields in prose. A failure beside pending checks meant poll until they settle and re-snapshot. A failure still standing at the poll cap meant resolving each failing check to its Actions run and approving only when every one wascancelled, because a cancelled contributor makes anif: always()merge-gate omnibus reportFAILURE. The reference said so itself: "Don't leave this to improvisation: the same stale red must not draw an APPROVE on one PR and a withheld approval on the next." Every input to that decision was already in the script's hands.poll_pr_checks.py approval <pr> <sha>replacessnapshot(this reference was its only caller) and prints one verdict,approve:orwithhold:. It reuses the settle looppollalready ran, now extracted as_settle, and resolves run conclusions itself. A run it can't read — a 5xx, or a run id the repo doesn't resolve — decides nothing: it exits 2, the code the module already uses for an unreadable rollup, unless another failing check is confirmed real, which still withholds.approving.mdkeeps what the agent does with each verdict, and drops from 65 lines to 45.The head-moved check goes rather than moving. Every review POST in the review skill runs behind
review_preflight.py post -- …, which refuses a moved head at the moment of posting, so a second comparison before the wait guarded the same thing earlier and more weakly.generator/tests/test_poll_scripts.pyreplaces the two snapshot tests with one seven-case table: nothing failing, only this run andtend-reviewin the rollup, terminal red, a red that settles green, and at the cap a cancelled run, a real failure, and a status context with no run to inspect. A second test covers a run that can't be read, alone and beside a real failure. Disabling the settle wait, the cancelled-run approval, or the unreadable-run guard each fails a test.Follows #1215, which pushed the review pre-flight's decisions into
review_preflight.pythe same way.🤖 Generated with Claude Code
https://claude.ai/code/session_01PoS7vwmM9mqPmS2UGBLJiw