Repository navigation
fix(scripts): fail fast when a commit cannot be resolved - #1055
Conversation
tend-agent
left a comment
There was a problem hiding this comment.
Reviewing my own PR, so this is a COMMENT rather than an approval.
The sentinel holds up. object: null at exit 0 really is unambiguous — gh api graphql exits non-zero on an errors envelope, so || return 0 takes that path before the new test is reached — and it can't collide with a real commit carrying no rollup, which keeps object non-null. Full uv run pytest generator/tests/test_poll_scripts.py is green here (26 passed). Three things on the edges:
-
absent=0sits above the blip check, so an empty rollup between two absent sightings clears the counter:NOSUCHCOMMIT→ blip →NOSUCHCOMMITnever reaches the verdict, and the run falls back to the cap path carrying both symptoms this PR set out to remove — nine minutes of sleeping, thenhead_note's false "branch advanced". An empty rollup is "no answer", not evidence the commit exists, so it shouldn't reset. Moving the line one down also makes the header's claim that a merge-ref commit "remains the one exit-2 cause head_note can still misfire on" true rather than nearly true. -
The
caseguard in the grace re-check is the one line in this diff whose loss is a false green, and nothing pins it. I confirmed that locally by reverting it to[ -z "$cur" ] && continue: a rollup carrying aFAILUREthen exits 0, because both[ "" -gt 0 ]tests error out on the sentinel (integer expression expected) and the script falls through toecho "green". A future edit that simplifies thatcaseback to a-ztest passes the whole suite today. -
test_unresolvable_oid_is_terminal_not_a_transient_blipassertsHEAD_SHA in outand"UNVERIFIED, not green" in out, but the old fallback line —no rollup returned for $SHA — UNVERIFIED, not green— matches both, so only the call-count assert actually distinguishes the new verdict from the behaviour before the fix. Worth pinning the string the PR body says it asserts.
Pushing all three, since there's no human author to act on them.
…-green guard Review follow-up on the sentinel. Three edges: - `absent=0` ran above the blip check, so an empty rollup between two `NOSUCHCOMMIT` sightings cleared the count. Absences alternating with blips then never reached the verdict and the run fell out at the cap into the nine-minute wait plus head_note's false "branch advanced" — the two symptoms this fix exists to remove. Only a rollup resets now. - The `case` guard at the grace re-check is the one line whose loss is a false green: the sentinel reaching $R makes both `-gt 0` tests die with `integer expression expected`, so a red rollup reports green. Nothing pinned it; a regression test does now. - The unresolvable-OID test's asserts were also satisfied by the pre-fix `no rollup returned for <sha>` line, so only the call count separated the two behaviours. It pins the verdict string instead.
The sentinel gave an OID that names no object its own response shape (`object: null`), so the null-rollup test's docstring — written when both cases arrived as one — now names a case that routes elsewhere. Left as is, it invites a later edit to treat that test as covering the absent OID and drop the sentinel's own tests.
tend-agent
left a comment
There was a problem hiding this comment.
Reviewing my own PR, so this is a COMMENT rather than an approval.
All three points from the last round landed correctly. absent=0 now sits below the blip check, so NOSUCHCOMMIT → blip → NOSUCHCOMMIT reaches the verdict on the third poll; test_the_sentinel_at_the_grace_recheck_never_reads_green genuinely pins the case guard (reverting it to [ -z "$cur" ] && continue makes that test exit 0 instead of 1); and the verdict-line assert now separates the new path from the old fallback. Full uv run pytest generator/tests/test_poll_scripts.py is green here (28 passed), shellcheck -S warning is clean.
One thing the new increment introduced, and one comment that drifted with it.
-
The verdict can now contradict a rollup this same run already read.
absentis reset only by a usable rollup at the top of an iteration — but the grace re-check one line further down setsRand thencontinues on the sentinel without touchingabsent. So a green rollup followed by two sentinel answers exits 2 claiming the commit doesn't exist. Reproduced with the suite's own fixtures —_serve(env, _resp(_check_run("tests")), NO_SUCH_COMMIT)gives<sha> is not a commit in owner/repo — UNVERIFIED, not green, after the script has read and reduced that commit's check rollup. The gate outcome is UNVERIFIED either way, so nothing goes false-green; what's wrong is the claim, and it's the same shape as the false "branch advanced" note this PR exists to remove — a categorical statement about a commit, contradicted by what the run itself saw. A non-emptyRis positive proof the OID resolves, so a later null is a blip whatever the count — which is exactly how the grace re-check already treats it. Guarding the exit on[ -z "$R" ]costs one condition and leaves every existing test on the same path. -
Two consecutive sightings rather than onein the block comment no longer holds after theabsent=0move — a blip between two sightings still reaches the verdict, which is the point of the fix, and the comment two lines down says so. In a file where the comments carry the design rationale, the two shouldn't read against each other.
Pushing both, plus a regression test for the first, since there's no human author to act on them.
The absent counter is cleared only by a rollup at the top of an iteration, but the grace re-check sets $R and continues on the sentinel without touching it. So a green rollup followed by two sentinel answers reached the verdict and exited 2 claiming the commit is not in the repository — having just read and reduced that commit's rollup. A non-empty $R is proof the OID resolves, so gate the verdict on it: the sentinel is a blip whatever the count, which is how the grace re-check already treats it.
tend-agent
left a comment
There was a problem hiding this comment.
Reviewing my own PR, so this is a COMMENT rather than an approval.
Both points from the last round landed correctly. The [ -z "$R" ] guard is genuinely pinned — reverting it to [ "$absent" -ge 2 ] fails exactly test_a_rollup_already_read_outranks_a_later_absence and nothing else — and the block comment no longer claims the two sightings must be consecutive. uv run pytest generator/tests/test_poll_scripts.py is green here (29 passed); CI is green on this head apart from this review's own job.
One inline suggestion on the new test, plus a note on something pre-existing that the increment now touches.
The pre-existing part, recorded here rather than fixed here. When the retained $R has pending == [] and every later poll answers nothing, the cap report prints poll cap hit — still pending on $SHA (UNVERIFIED, not green): followed by an empty list — a claim contradicted by the only rollup the run holds. It is reachable on the unmodified script through empty blips at the grace re-check (_serve(env, _resp(_check_run("tests")), NULL_ROLLUP) gives exit 3 with nothing under the header), so this PR doesn't introduce it. What changed is that the guard routes the sentinel onto the same report, and test_a_rollup_already_read_outranks_a_later_absence serves precisely that fixture — so the misreport is now covered by a test that doesn't look at it. It belongs in its own change: it's about what the cap report says, not about how a null object is classified, and folding it in would mix the two. Verdict direction is safe either way (UNVERIFIED), so it isn't blocking.
Verification notes
- Guard is load-bearing and pinned:
sed-reverting line 207 toif [ "$absent" -ge 2 ]; thenleaves 28 passed, 1 failed — only the new test. - New-test scenario's actual outcome: exit 3, stdout
poll cap hit — still pending on <sha> (UNVERIFIED, not green):with an empty list, 10 GraphQL calls. - Same output from the unmodified script via
_serve(env, _resp(_check_run("tests")), NULL_ROLLUP), which is what places the cap-report wording outside this PR's scope.
Pushing the inline suggestion, since there's no human author to act on it.
The regression test asserted only that the "not a commit" verdict is absent, which any run that fails to produce it satisfies — a crash, a set -e death, a verdict re-routed elsewhere. A usable $R is retained on that path, so the cap report owns the outcome; pin exit 3 so a change to that routing is visible rather than silently satisfying the negative.
tend-agent
left a comment
There was a problem hiding this comment.
Reviewing my own PR, so this is a COMMENT rather than an approval.
Nothing outstanding on 40bdae0. The refactor deletes the sentinel rather than refining it, which is the right direction, and 40bdae0 closed the one finding I had assembled against 503831f: the reject message no longer asserts the commit is absent, which it could not know — gh api exits non-zero on a 5xx, a rate limit, or a transport failure just as it does on a 404, and 2>/dev/null discards which. could not resolve … as a commit is true under all of them. The narrowing that comes with it — a GitHub API blip twice in ten seconds now aborts in ten seconds where the loop used to absorb it across nine minutes — is fail-safe (exit 2, UNVERIFIED) and not worth retry machinery to recover.
One cross-PR note: #1053 edits the same two comment blocks in this file and will conflict whichever lands second. The substantive half is that #1053 keeps an unresolvable OID in rollup()'s "Empty output means no usable rollup" list, which this PR removes — correctly, since after this change an unresolvable OID is rejected at entry and never reaches rollup(). Merging #1053 second would put that stale cause back.
Verification
uv run pytest generator/tests/test_poll_scripts.py -qon40bdae0: 25 passed.shellcheck -S warningclean.- The two ways the new entry gate could have locked out real callers, neither reachable from the fake-
ghsuite, both checked against live GitHub from this run:- A
refs/pull/N/mergecommit resolves throughGET /repos/max-sixty/tend/commits/{sha}, so it passes the precheck and still reaches the null-rollup exit-2 path — the header's claim that it "remains the one exit-2 cause head_note can still misfire on" holds. - A fork PR's head commit resolves in the base repo through both that endpoint and
repository.object(oid:), so polling a fork PR is unaffected.
- A
- Angles checked without a finding: the invariants the deleted sentinel/
absentmachinery enforced are each re-established (one absent sighting is not a verdict → the 10s retry; a rollup already read outranks a later absence → absence is now only ever read at entry; the grace-recheck false-green guard → no sentinel can reach$R). The cap report's empty-pendingcontradiction remains pre-existing and out of scope, as the previous round recorded.
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]>
A well-formed OID that names no commit currently spends the full poll budget and can emit a false branch-advanced note. The poller now validates the commit before entering the loop, retries once after ten seconds for a just-pushed commit, and returns unverified without the note if the lookup still fails. This keeps commit validation outside the rollup state machine.
Verification:
uv run pytest generator/tests/test_poll_scripts.py -q(25 passed), plus pre-commit on the changed files.Closes #1054