Repository navigation
fix(running-in-ci): trim CI-poll loops to fit Bash tool's 10-min cap - #695
Conversation
The foreground CI-poll recipe and the rerun-jobs poll both ran `for i in $(seq 1 15); do sleep 60; ...; done` — a minimum of 15 minutes if CI didn't finish early. The Claude Code Bash tool's max configurable timeout is 600000 ms (10 min), past which the harness auto-backgrounds the call and blocks foreground `sleep` waits. Once that happens the gated follow-up (dismiss approval on failure, post failure analysis) can't fire in-session — background-completion notifications are not reliably delivered to a CI session, per the same skill's own policy. Trim both loops to `seq 1 9` (≥9 min minimum) so the recipe fits inside the harness cap, and add a note that callers must invoke Bash with `timeout: 600000` (the default 2-min timeout would kill the loop early). Closes #694 Co-Authored-By: Claude <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Self-review of the trim. Math checks out (9 × 60s + at most one 30s grace ≈ 570s, comfortably under the 600s Bash cap) and the inline 15-min/15 minutes references are all updated. One gap: the new timeout: 600000 caller note was only added next to the CI Monitoring loop, not the structurally-identical gh run rerun --failed rollup loop below — see inline. A reader who jumps straight to the rerun recipe still hits the 2-min default Bash timeout.
Self-review caught that the timeout: 600000 caller note was only added next to the CI Monitoring loop, not the structurally-identical gh run rerun --failed rollup loop below. A reader following just the rerun recipe would still hit the default 2-min Bash timeout. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Two more occurrences from a different repo, tonight on
A third PR in the same Dependabot batch, PRQL/prql#6011 (insta-cmd 0.6.0 → 0.7.0), got a clean empty-body APPROVED review from the same session shape — its CI finished in ~6 min, well under the 10-min cap, so the loop returned and the verdict shipped. Two notes on prioritization:
The Recording these two as additional structural-confirmation evidence in the |
#721 (base workflow-regen worktree on an open PR, not branch-ref existence) merged to main after this release branch was cut; it's a Fixed-scope change to the bundled nightly skill that adopters run, so it belongs in the 0.1.7 notes alongside #695. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Bumps generator version to 0.1.7, syncs the lockfile, and adds the `## 0.1.7` CHANGELOG section (published verbatim as the GitHub Release notes on tag push). Changes since 0.1.6: pin actions/checkout to v7 with review opting into the fork-PR checkout guard (#725); bump claude-code to 2.1.185 (#719); running-in-ci surfaces blocking scope rules instead of routing around them (#717) and caps CI-poll loops to the Bash 10-min limit (#695); nightly workflow-regen bases its worktree on an open PR rather than branch-ref existence (#721); de-duplicate composite-action step bodies under shared/steps/ with harness-named action paths (#712); correct the codex effort list (#710); review-reviewers and worker-deploy doc fixes (#707, #711).
Automated nightly regeneration of tend's workflow files. **tend version:** 0.1.6 → 0.1.7 **Notable changes:** - **Fork-PR review checkout fixed properly** (max-sixty/tend#725) — `tend-review` now uses `actions/checkout@v7` with `allow-unsafe-pr-checkout: true`, the upstream-intended way to re-enable fork-PR ref checkout that v7 blocks by default. This supersedes the manual `actions/checkout@v6` stopgap pinned in #3176: the generator now carries the fix, so the regen restores v7 with the explicit opt-in rather than the downgrade. - **CI-poll loops trimmed to fit the Bash tool's 10-min cap** (max-sixty/tend#695) — `running-in-ci` CI-monitoring loops are sized so they don't auto-background and drop a gated follow-up. - **Scope blockers surfaced instead of routed around** (max-sixty/tend#717) — when a scope rule blocks the correct action, the bot now reports the blocker on the thread rather than silently substituting a workaround. - **Nightly regen worktree bases on the open PR, not the branch ref** (max-sixty/tend#721) — keeps the regen diff incremental and the PR body accurate. - **Shared step scripts; actions named by harness** (max-sixty/tend#712) — explains the regenerated comment in `tend-notifications.yaml` ("the harness action's post-step"). Compare: max-sixty/tend@0.1.6...0.1.7 Co-authored-by: worktrunk-bot <[email protected]>
…1371) `_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. The loop reads the rollup every 60 s, and a read that shows nothing pending is confirmed by a second read 30 s later. A check that registers inside that 30 s window sends the pass back to the top. `for _ in range(9)` counted passes, not seconds, so every pass could charge its own confirmation: nine passes × 90 s. [#695](#695), which trimmed this loop to fit the cap in the first place, budgeted for "one at-most-once 30 s grace re-check" — the implementation never enforced the "at most once". Both sleeps now draw on a single budget. The longest green path is unchanged at 570 s (pending through eight reads, clean on the ninth), which is the ~9.5 minutes `monitor-ci` documents. A flapping rollup spends that same budget on more reads — 12 rather than 9 in the regression test — instead of overrunning. Reachable from every caller that polls: `nightly`'s Step 7 and `monitor-ci` both invoke it in the foreground with `timeout: 600000`, and `review`'s `references/approving.md` runs the sibling `approval` command the same way. <details><summary>Measured, before and after</summary> The regression test drives `poll` against a rollup alternating clean/pending and sums the injected sleeps. Before: 810 s. After: 540 s. Every path, with the fix in place (`settled, seconds slept, rollup reads`): | Rollup | Settled | Slept | Reads | |---|---|---|---| | always pending | no | 540 s | 9 | | flapping clean/pending | no | 540 s | 12 | | clean on the first read | yes | 90 s | 2 | | pending through 8, clean on the 9th | yes | 570 s | 10 | </details> Co-authored-by: tend-agent <[email protected]>
…essed limits (#1448) The CI poll gave up after 9 minutes. That figure came from #695, which trimmed the poll loop to fit Claude Code's default 10-minute ceiling on one Bash call; #876 then forbade re-running it. So a harness default set how long every session waits for a consumer's CI. On the last 30 merged PRs of each consumer, the slowest check outlasted it on every PR in leaf (15 min), numbagg (17 min) and worktrunk, and on about a third of PRQL's and Faber2026's. There the poll reports UNVERIFIED, so under `merge: yolo` the bot never merges (leaf-agent has merged none of its PRs), and a red check never dismisses a bot approval. This PR removes the limit, and fixes the other places where a guessed count or window bounded a decision. ### The CI poll waits for the checks, not a fixed time `poll_pr_checks.py` now waits until the checks settle, however long the repo's CI runs: a running check ends by its own job timeout. Three states have no such end, and each is ended by the event that shows it: - checks still pend and the PR head moves off the pinned commit: exit 3, UNVERIFIED. The commit can no longer merge, and a review of the new head is queued behind this session. `review/SKILL.md` already asked for this. - no check registers within 5 minutes: exit 2. A docs-only PR whose workflows are all path-filtered looks the same as checks not registered yet; the margin covers GitHub's registration lag, not CI. - the session nears its end: exit 3, UNVERIFIED. A check that registers and never finishes (a CLA status left pending, a job waiting on an environment approval) would otherwise hold the wait until the session is killed, with nothing reported on the PR and an outage issue filed. Each harness exports `TEND_DEADLINE`, when the session will be stopped: Claude's supervisor bound, or for Codex GitHub's 6-hour job cap less 10 minutes. The poll hands back 10 minutes before it, so the session can still report. The harness ceiling was configurable all along. Claude runs set `BASH_MAX_TIMEOUT_MS` to the run's timeout, and Codex runs raise `background_terminal_max_timeout`. Codex's instructions (`codex/agents-tail.md`) now say to wait on a running command in one `write_stdin` call: leaf's session polled every 30 s, 19 model turns of ~100k cached tokens for one 9-minute wait. The skills give the poll the longest command timeout the harness allows, and a test keeps a numeric one from coming back. `approval()` loses its cancelled-run heuristic, which existed only to decide a red still standing at the cap; waiting now reaches the replacement run's result. `rerun_failed_jobs.py` waits for its jobs the same way, and ends at the same deadline. ### Other fixed caps - **Dedup by search, not a recent-N scan.** ci-fix, triage, review-runs and review-reviewers listed the newest 200 issues or PRs and scanned the titles. On leaf the newest 200 PRs reach back two days, so ci-fix's "was this fix already rejected?" check missed anything older, and triage's open-issue list already truncates on PRQL (234 open). They now search by keyword, which matches titles and bodies at any age. ground-claims states the rule. open-pr's sibling recheck keeps its recency listing, with a projection small enough to show in full. - **`bot_review_state.py`** read the first 100 review threads, oldest first; it now follows every page. - **`review_runs_corrections.py`** took the newest 200 bot PRs and then filtered to those closed in the window, missing an older PR a maintainer closed that day. It now searches `closed:>=<since>`. - **nightly** reviewed `git log --since='24 hours ago' main`: a skipped night lost its commits, and a repo whose default branch isn't `main` reviewed nothing. It now reviews from the last successful nightly's head. - **review-runs** paginates its waiting-run and Dependabot-alert reads, and ci-fix's tracker lookups read 100 rather than 10. Tests pin each change; the poll tests run on a fake clock that raises if a wait never ends. A local `codex exec` probe confirmed a 400 s command waited out in 3 tool calls rather than about 13. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Problem
The bundled
running-in-ciskill's foreground CI-poll recipe (and the structurally-identicalgh run rerun --failedrollup loop) iteratedfor i in $(seq 1 15); do sleep 60; ...; done— a ≥15-minute wall clock if CI didn't finish early. The Claude Code Bash tool's max configurable timeout is 600000 ms (10 min); past that the harness auto-backgrounds the call. The skill's own policy says background-completion notifications are not reliably delivered to a CI session, so the gated follow-up (dismiss approval on failure, post failure analysis) can't fire — and the bot'ssleepworkarounds get blocked by the harness's anti-polling guards, ending the session before the dismissal runs.#694 documents six occurrences in a single 24h window on
max-sixty/worktrunk(six of ~20 token-bearingtend-reviewruns — ~30%). All six PRs merged cleanly so the loss-of-dismissal path was not exercised, but the failure mode is structural and would fail open on a future red-CI run.This is the same root-cause class as #674 (triage's full-suite gate exceeding the 10-min cap) but in a different code path — the gated CI dismissal path on review.
Solution
Trim both loops from
seq 1 15toseq 1 9. With 60s sleeps per iteration plus the at-most-once 30s grace re-check, the worst case sits comfortably inside the 600000 ms Bash cap so the loop runs to completion and the gated follow-up fires.Also added a one-line note that callers must invoke Bash with
timeout: 600000— the default 2-min Bash timeout would kill even the trimmed loop early.Updated the inline references that cited the old 15-minute figure (
"Polling for it deadlocks until the 15-min cap breaks it"→"loop cap","CI still running after 15 minutes"→"9 minutes","up to ~15 minutes"→"up to ~9 minutes").Testing
Skill text fix — no automated test. Verified by reading the recipe end-to-end: 9 iterations × 60s + one 30s grace + small
gh/jqoverhead per iteration stays under 600s. The reporter's evidence (six session log traces showing the auto-background sequence) is the reproduction.Closes #694 — automated triage