Repository navigation
fix(poll): bound the settle loop by a sleep budget, not a pass count - #1376
Conversation
Reapplies #1371, reverted by #1375. `_settle` could sleep 810 s — 4.5 minutes past the 10-minute command cap its callers run it under — so the poll was killed and the session got no verdict on the commit it had just pushed. Both sleeps now draw on a single budget, so a flapping rollup spends that budget on more reads rather than overrunning.
tend-agent
left a comment
There was a problem hiding this comment.
The module docstring in generator/tests/test_poll_scripts.py still describes the loop this change replaces: "Sleep is injected, so the 9-iteration loop runs in milliseconds." _settle no longer runs a fixed nine iterations — the flapping case the new test covers makes six passes and twelve reads — so that sentence is now the one place in either changed file that still names the pass count, and it orients a reader to the pre-change shape. The fix is a phrase: "the budget-bounded loop" (or just "the poll loop").
It's outside the diff, so no inline suggestion. I've left it unpushed rather than breaking the byte-identity with 1c64a1f that the reapply rests on, and because it batches with whichever resolution you pick for the open question in the description — say which and I'll push both in one commit.
Regenerates the nine `tend-*.yaml` workflows from tend 0.3.1, up from 0.2.15. Behavior here is unchanged: the only substantive diff is two new action inputs, `merge: maintainer` and `control_plane_owner: ""`, both of which are the action's own defaults. `maintainer` is the merge authority this repo already runs under — the bot proposes, a maintainer merges. What the upgrade changes for this repo: - **`tend check` audits protected refs and credential environments more strictly** ([max-sixty/tend#1382](max-sixty/tend#1382)). A protected branch must now restrict creation, update and deletion together rather than update alone, and the credential audit no longer treats a ref-qualified reusable workflow as this tree's copy. This repo does not clear the new bar yet — the nightly filed #4242 with the single ruleset gap and the remediation. - **Yolo merge mode exists, and is off** ([max-sixty/tend#1172](max-sixty/tend#1172), [#1390](max-sixty/tend#1390)). The new inputs are how a repo would opt into letting the bot merge its own PRs; leaving them at the defaults keeps the current arrangement, and the `merge: maintainer` value is what the mitmproxy cache step is now gated on. - **`review-runs` sees the whole night** ([max-sixty/tend#1377](max-sixty/tend#1377)). Run listing now pages to the Actions ceiling instead of stopping at the first page, so a busy night's early runs stop falling out of the census; [#1374](max-sixty/tend#1374) keeps each correction row's author alongside it. - **CI polling is bounded by elapsed time, not iteration count** ([max-sixty/tend#1376](max-sixty/tend#1376), reinstating [#1371](max-sixty/tend#1371) after [#1375](max-sixty/tend#1375) reverted it). A settle loop against slow checks now stops on a sleep budget, so a long matrix can't quietly stretch a session. - **Install-test drift detection tightened** ([max-sixty/tend#1381](max-sixty/tend#1381)): generator output a PR never committed now fails tend's own drift check, which is the check that makes a regeneration PR like this one trustworthy. Full comparison: [0.2.15...0.3.1](max-sixty/tend@0.2.15...0.3.1). This PR does not touch `.config/tend.yaml`, whose `sandbox_setup:` key 0.3.1 now warns "will be refused in a later release". That migration is a separate change. #4240 overlaps this completely: it was generated with the same 0.3.1, so it carries the identical headers and the identical `merge: maintainer` / `control_plane_owner: ""` on the same lines, underneath a Claude → Codex harness swap. The only thing that distinguishes the two is which harness the action runs. Whichever lands first leaves the other conflicting on the eight `uses:` lines, resolved by regeneration rather than by hand. So this PR is worth landing on its own only for as long as the Codex cutover stays in draft — if that lands first, close this one. Verified by regenerating in the merged tree: `uvx [email protected] init` reproduces these nine files byte-for-byte, and the action declares `default: maintainer` and `default: ""` for the two new inputs at `0.3.1`, so neither changes behavior. Co-authored-by: worktrunk-bot <[email protected]>
Repeatedly registering checks could make the settle loop sleep for 810 seconds: each of nine passes could add its own confirmation wait. Polling and confirmation now share a sleep budget, bounding settle sleeps at 570 seconds. The regression case alternates clean and pending rollups and now sleeps 540 seconds.
The harness owns the command timeout. GitHub requests and the commit-resolution retry add time beyond the settle sleeps; a command that times out is unverified. The caller guidance keeps the ten-minute invocation setting without promising the script finishes within it. This also updates the stale fixed-iteration test description.
Validation: the 45 poll-script tests and all pre-commit hooks pass.