Repository navigation
fix(scripts): don't let tend-review gate the poll - #1053
Conversation
poll-pr-checks.sh exempted the caller's own check run and sibling runs of the same workflow, so a session that pushed to a PR blocked on tend-review's agent job — created by the very push being verified, and routinely longer than the 9-iteration cap. Closes #1050
tend-agent
left a comment
There was a problem hiding this comment.
The mechanism is right and the diagnosis in #1050 holds up — tend-review is created by the very synchronize the poll verifies, so blocking on it is structural, not occasional. One clause in the same chain is the right depth, and keying it on the workflow rather than the check name is what keeps a repo's own review job gating. Two things below; the first is a concrete gap in the prefix match.
tend-install-test is a generated tend-* workflow that is a verdict on the code. generate_install_test in generator/src/tend/workflows.py stamps name: tend-install-test, and its one step runs uvx "tend@$TEND_VERSION" init --with-install-test then git diff --quiet .github/workflows/ — a deterministic drift check, not an agent session. The new clause drops it, so the rationale in the header ("No tend agent job is a verdict on the code") doesn't cover the one workflow it exempts that isn't an agent job. Confirmed against the script's own jq — a single failing install-test check from workflow tend-install-test reduces to {"pending":[],"failed":[]}, i.e. exit 0 green. The window is narrow but reachable: install-tend is the documented path for changing an installed repo's config, it generates the file with --with-install-test, and on an already-installed repo tend-review/tend-mention do run on that PR — so a session that pushes to it and polls reads green with the drift check red. Inline suggestion on the jq line and the header sentence.
Empty-after-filter now reads green where the header says UNVERIFIED. The exit-code block documents "a commit with zero checks and zero statuses … the rollup is null then too, so 'nothing to gate on' is indistinguishable from 'nothing answered'" as exit 2. After this change a commit whose rollup holds only tend-* entries filters to {"pending":[],"failed":[]} and takes the exit-0 path with green: every gating check on $SHA settled green — the same epistemic state, opposite verdict. The hole predates the PR (own-run plus same-workflow could already empty the list) but this widens it from tend-review-as-caller to every caller: tend-review's check run is guaranteed present on the commit within seconds of the push, so it's now the tend entry that keeps the rollup non-null while the repo's own checks may not have registered at the 60 s and 90 s samples. It fails toward a false green, which is the one direction this script is built not to fail in. Worth considering distinguishing "filtered to empty" from "nothing to filter" — if the pre-filter node list was non-empty and the post-filter list is empty, that's exit 2 rather than green. Not asking for it in this PR, but it's the case the new clause makes common.
Same pattern outside the diff: the pre-APPROVE rollup block in plugins/tend-ci-runner/skills/review/SKILL.md (the FAILED= jq under "Before APPROVE specifically") applies no own-run, own-workflow, or tend- filter at all, so a red tend-mention / handle sitting on the head commit withholds an approval for exactly the tend-outage-not-a-code-verdict reason this PR argues against. Different file, different failure (a withheld approval rather than a false green) — happy to push that as a follow-up if you want it tracked.
Testing looks right: test_a_repo_check_named_like_tend_still_gates is the pin that matters, since it's what stops the exemption drifting onto check-run names. uv run pytest is green here too (589 passed).
Two gaps in the `tend-*` exemption this PR adds, both false greens. `tend-install-test` carries the prefix but runs no agent: it regenerates the committed workflow files and diffs them against the tree, so a red one is drift in the code under poll and is the one `tend-*` verdict that counts. Exempt every generated workflow bar that one. Filtering to empty is not green. A rollup holding only exempt entries answers nothing about the commit — the state the header already documents as exit 2 for a null rollup — and the exemption makes it routine, since `tend-review` registers within seconds of the push while the repo's own checks may not have. The reduction now emits nothing there, so the loop keeps polling and the cap reports UNVERIFIED rather than green.
tend-agent
left a comment
There was a problem hiding this comment.
Both findings from the last review landed and I verified them rather than taking the commit message's word: tend-install-test now exits 1 with the check named on stdout (test_install_test_gates_despite_the_tend_prefix), and an all-exempt rollup reaches exit 2 instead of the byte-identical-to-green reduction (test_filtering_to_empty_never_reads_green). I confirmed against generate_install_test in generator/src/tend/workflows.py that it really is the only generated workflow with no agent step — every other name: in generator/src/tend/templates/ (tend-review, tend-mention, tend-triage, tend-ci-fix, tend-notifications, tend-<scheduled>) invokes the composite action. And the "read UNVERIFIED via the cap before" claim in the description checks out against the base: 483f274 has no tend- clause at all, so a tend-only rollup left tend-review pending and hit the cap. uv run pytest generator/tests/test_poll_scripts.py is green here (28 passed).
One simplification inline. Nothing blocking.
Two smaller notes:
Nothing pins tend-install-test as the only agentless generated workflow. The exception is correct today because the generator has exactly one such workflow, but that fact lives only in a comment. A second deterministic generated workflow — another drift or lint check — would silently inherit the tend- exemption and re-open exactly the false green this commit closes, with no test going red. A cheap pin would be a generator test asserting every tend-* name it stamps either invokes the composite action or is named in the script's exception. Not asking for it here; flagging it since the failure mode is a wrong outward verdict rather than wasted compute.
Textual overlap with #1055. Different fix, not a duplicate — it makes an OID that resolves to no object terminal instead of a retry. But it edits the same rollup() header block and the same exit-2 enumeration from a base that predates this PR, so whichever lands second will conflict there. Worth knowing before merge order is decided; no semantic collision that I can see, since its NOSUCHCOMMIT early-return sits above the filter chain this PR touches.
|
Both review findings are applied in 35db26a and replied to inline; required checks are green on that commit. I took the second one (empty-after-filter) into this PR rather than leaving it as a follow-up, despite the review not asking for it here. The reasoning: the exemption and the guard are one safety property, not two changes. Without the guard this PR converts a tend-only rollup from UNVERIFIED-via-the-cap into On the What the two clauses do now| select($wf == "" or .workflow != $wf)
| select(.workflow == "tend-install-test"
or (.workflow | startswith("tend-") | not))
The reduction then emits nothing when the filtered group list is empty, so the loop keeps polling and the cap reports UNVERIFIED instead of Four tests cover it, each verified failing against the pre-fix script: |
… pin the exemption set The guard reads the same and keeps the reduction at its original indentation, so blame on those lines still points at the commit that wrote them. Adds test_poll_exemptions_match_the_agentless_generated_workflows: every `tend-*` workflow the generator stamps either invokes the composite action or is named back in as a gating check in poll-pr-checks.sh, never both and never neither. A second agentless generated workflow would otherwise inherit the `tend-` exemption and its red would read as green.
|
The inline simplification is applied in 86c9399, and I took the first note into this PR rather than leaving it flagged. The pin now exists. I verified it goes red in both directions rather than trusting that it passes: renaming the On #1055: agreed it's a textual conflict and not a semantic one, and it looks one-directional — its What the new test asserts, and why the invariant isn't self-evidentThe exemption's rationale is "no tend agent job is a verdict on the code". That is a claim about what the generator stamps, not about the Both operands are in-repo, so the test can only fail on a change to one of them — it never goes red on an upstream event. |
tend-agent
left a comment
There was a problem hiding this comment.
The pin from the last review landed, and I checked it against the script rather than taking the commit message's word. test_poll_exemptions_match_the_agentless_generated_workflows goes red in both directions: naming tend-review back into the exemption list fails with "runs an agent job but poll-pr-checks.sh names it back in as a gating check", and dropping the tend-install-test clause fails with the converse. Both operands are in-repo, so it can only fail on a change to one of them — that is the invariant the prefix exemption rests on, and it now has something holding it.
select(length > 0) is the same filter as the if length == 0 then empty form on an array input, and the reduction below it is untouched. uv run pytest generator/tests/test_repo_pins.py generator/tests/test_poll_scripts.py green here (30 passed), pre-commit clean over both changed files.
Incidentally the rollup on 86c9399 is the shape this PR is about: every ci check terminal green, tend-review / review the sole pending entry.
No new findings on the increment; the two notes from the last review are both closed. Can't approve my own PR, so this is the verdict — nothing blocking.
# Conflicts: # generator/tests/test_repo_pins.py
tend-agent
left a comment
There was a problem hiding this comment.
The base merge resolved the test_repo_pins.py conflict with a single blank line between the end of test_poll_exemptions_match_the_agentless_generated_workflows and the ACTION_PATH_REF comment block that follows it. ruff-format wants two there, so lint will go red on this commit:
$ ruff 0.14.11 format --check --diff generator/tests/test_repo_pins.py
@@ -92,6 +92,7 @@
"as green — name it back in alongside `tend-install-test`"
)
+
# Every `${{ github.action_path }}/…` reference in the two composite actions.
1 file would be reformatted
Inline suggestion below. Nothing else on the increment — the resolution kept both sides of the conflict, and the invariant the new test rests on survives main's shared/steps/ reorganisation (generate_all's signature is unchanged and every tend-* template still stamps uses: max-sixty/tend/).
tend-agent
left a comment
There was a problem hiding this comment.
Narrowing to the one workflow is right, and I checked the premise rather than the argument: across the twelve most recent PRs the only tend check runs that land on a PR head commit are tend-review / review and tend-mention's relay (one dispatch POST, seconds, 42 for 42 successful to date). tend-mention's verify and handle are always SKIPPED on a PR head, and structurally so — verify's if: admits only repository_dispatch, issues, and issue_comment, none of which carries the PR head as its run's head SHA, so the agent job that could outlive the cap never registers on the commit under poll. tend-review is the whole exposure, which makes the prefix rule, its hand-maintained exception, and the generator pin test machinery for a set of one. Deleting all three is the right depth. ci is green on e8fd471f, test included.
Two coverage holes, though, both provable by mutating the filter chain, and both closeable without adding a test.
The exemption's keying on the workflow rather than the check-run name is no longer observed. 2e9407b removed the only fixture pairing a check named review with a non-exempt workflow, and the failure coverage it defers to — test_red_names_the_failing_check_with_its_url — uses checks named tests and lint, which can never collide with the exemption. Rewriting the clause as select(.name != "review") now leaves the whole file green. This script ships to every adopter, and an adopter whose own CI job is called review would have its red silently exempted. The inline suggestion restores the pin in place: with the green companion renamed, a name-keyed filter drops both entries, the rollup filters to empty, and the test's returncode == 0 fails on exit 2.
The same-workflow ($wf) filter now has no test at all. test_own_run_and_same_workflow_are_filtered is the only test whose fixture holds an entry with .workflow equal to its env's GITHUB_WORKFLOW — _check_run("handle", status="QUEUED", workflow="tend-review", run_id=777) against the env fixture's "GITHUB_WORKFLOW": "tend-review". On main that entry was removed only by select($wf == "" or .workflow != $wf); this PR's new clause removes it too, so deleting the $wf clause outright leaves the suite green. That clause is what stops a session deadlocking on its own concurrency-queued sibling, which is the failure class #1050 is about. It's outside the diff, so two lines rather than an inline suggestion:
env = env | {"GITHUB_WORKFLOW": "tend-nightly"}
_serve(
env,
_resp(
_check_run("tests"),
_check_run("review", status="IN_PROGRESS", run_id=555, workflow="x"),
_check_run("handle", status="QUEUED", workflow="tend-nightly", run_id=777),
),
)Your call on whether either is worth keeping — but a fixture edit is about as cheap as machinery gets, and CLAUDE.md's Development section puts preventing a wrong outward action above the cost of the mechanism that prevents it. Both holes fail toward a false green, which is the direction this script exists not to fail in.
How the two holes were verified
uv isn't on the sandbox's PATH, so this is not a pytest run: I extracted the reduction from rollup() and ran it under jq over each remaining fixture, mapping the output to the exit code the loop would take (pending non-empty then cap, exit 3; failed non-empty, exit 1; both empty, exit 0; no output, exit 2). M1 deletes select($wf == "" or .workflow != $wf); M2 replaces select(.workflow != "tend-review") with select(.name != "review").
| fixture | asserts | base | M1 | M2 |
|---|---|---|---|---|
test_own_run_and_same_workflow_are_filtered |
exit 0 | exit 0 | exit 0 | exit 0 |
test_tend_review_does_not_gate |
exit 0 | exit 0 | exit 0 | exit 0 |
test_filtering_to_empty_never_reads_green |
exit 2 | exit 2 | exit 2 | exit 2 |
test_red_names_the_failing_check_with_its_url |
exit 1 | exit 1 | exit 1 | exit 1 |
test_superseded_failure_yields_to_its_replacement |
exit 1 | exit 1 | exit 1 | exit 1 |
Every remaining fixture is verdict-identical under both mutations. With the two fixes applied, M1 moves test_own_run_and_same_workflow_are_filtered to exit 3 and M2 moves test_tend_review_does_not_gate to exit 2 — each fails its own assertion, which is the pin.
The tend-mention claim above comes from the rollups of the twelve most recent PRs plus verify's if: block in .github/workflows/tend-mention.yaml, and from the workflow's run history (42 pull_request_review runs, all success).
The pin these fixtures carry was deleted once already because nothing in the file recorded that the check names and workflows are load-bearing: rename either back and the suite stays green while a false green becomes reachable.
# Conflicts: # plugins/tend-ci-runner/scripts/poll-pr-checks.sh
|
Both findings were already applied in How the two holes were re-verified
The bold cells are the holes; each is closed by the row below it. Deleting the own-run ( |
Automated nightly regeneration of tend's workflow files. **tend version:** 0.1.20 → 0.1.22 ## Notable changes - **Notifications now run off a recovery queue** (max-sixty/tend#1074). The pre-check drops the old layered inbox sweep (shadowed-run and closed-bot-PR marking) in favour of a single paginated snapshot taken before a 10-minute cutoff, passes that cutoff through to the agent, and keeps repository watching enabled with an idempotent `PUT .../subscription` on every cycle. The job also gains a serial `tend-notifications` concurrency group. - **`tend-review` re-targets instead of skipping** (max-sixty/tend#1082). The "skip when the live HEAD is already examined" gate step and its `if:` guards are gone; a live session now re-targets when HEAD moves. The concurrency group adds `queue: max` so a push can't evict a pending `ready_for_review` run. - **Skills check the default branch for a landed fix before opening a PR** (max-sixty/tend#1070), and `review-runs` gains the run census as a second stranded-trigger drain input (max-sixty/tend#1073). - **Poll/rerun script fixes** (max-sixty/tend#1053, max-sixty/tend#1055): `tend-review` no longer gates the CI poll, and an unresolvable commit fails fast rather than passing silently. - **Generator fixes**: `watched_workflows` and `branches` are validated as string lists (max-sixty/tend#1076), and block prompts no longer get padded blank lines (max-sixty/tend#1090). Full upstream diff: max-sixty/tend@0.1.20...0.1.22 Co-authored-by: worktrunk-bot <[email protected]>
Automated nightly regeneration of tend's workflow files. **tend version:** 0.1.20 → 0.1.22 **Notable changes** - Notifications recover work missed while the unread queue was stale, and the job now runs under its own `tend-notifications` concurrency group so overlapping schedules serialize instead of racing (max-sixty/tend#1074). - Skills check the default branch for a landed fix before opening a PR, cutting duplicate PRs for work that already merged (max-sixty/tend#1070). - `review-runs` gains the run census as a second stranded-trigger drain input (max-sixty/tend#1073), and reviews re-target when HEAD moves rather than being discarded (max-sixty/tend#1082). - The CI poll no longer lets `tend-review` gate it, and the commit-resolution script fails fast instead of proceeding on an unresolved SHA (max-sixty/tend#1053, max-sixty/tend#1055). - The generator validates `watched_workflows` and `branches` as string lists, and stops padding blank lines inside block prompts (max-sixty/tend#1076, max-sixty/tend#1090). max-sixty/tend@0.1.20...0.1.22 **Beyond the regeneration:** 0.1.22's `tend-review.yaml` sets `concurrency.queue: max`, which GitHub accepts but the pinned `actionlint` hook rejects, so this PR also adds a scoped `-ignore` for that one schema message to `.pre-commit-config.yaml` — otherwise `lint` is red and the PR can't merge on its own CI. Tracked upstream as max-sixty/tend#1094. --------- Co-authored-by: leaf-agent <[email protected]>
tend-reviewstarts on every push to a PR and often outlives the poller's nine-minute budget, so waiting for it makes the poll time out after the repository checks have settled. This change adds one exact workflow exemption fortend-review; the existing own-run and same-workflow filters remain. A rollup with no gating checks stays unverified.Verification:
uv run pytest generator/tests/test_poll_scripts.py -q(27 passed), plus pre-commit on the changed files.Closes #1050