Repository navigation
skills(running-in-ci): recheck PR state before pushing follow-up commits - #573
Conversation
…e push Two rules to prevent a tend session from holding a GitHub Actions job alive past its intended scope: - Re-check PR state before pushing a follow-up commit. Any wait (CI poll, coverage fetch, sleep) lets a maintainer merge or close the PR; pushing then leaves an orphan commit and triggers polling that never converges (`gh pr view --json headRefOid` returns the SHA at merge time forever). - Bound every Bash polling loop. An unbounded `until <check>; do sleep N` launched via `run_in_background: true` survives the agent exiting and holds the job alive until the workflow timeout (default 360 min) cancels it. Closes #572 Co-Authored-By: Claude <[email protected]>
|
|
||
| ### Bound every polling loop | ||
|
|
||
| Use `for i in $(seq 1 N); do ... done` — never an unbounded `until <check>; do sleep N; done` from Bash. A backgrounded `until` loop survives the agent exiting and holds the GitHub Actions job alive until the workflow timeout (default 360 min) cancels it. If the harness blocks `sleep N && check` and suggests `until <check>; do sleep 2; done`, add a counter: |
There was a problem hiding this comment.
do we have any contra-examples? I'm keen to avoid lots of "don't do bad things" comments
There was a problem hiding this comment.
Honest answer: just the one incident behind #572, not a pattern. And the CI Monitoring section right above already shows the positive recipe (for i in $(seq 1 15); do … done), so this is largely restating in negative form what's already there.
Options:
- Drop the section. The CI Monitoring recipe is the positive form; the new content adds little.
- Keep just the non-obvious bit as a one-liner appended to the CI Monitoring recipe: that the harness's suggested
until <check>; do sleep 2; doneis safe inMonitorbut a trap in backgrounded Bash. That's the part not derivable from the existing recipe.
I'd lean toward option 2 — the harness/Monitor distinction is the specific knowledge that prevented the deadlock, and a one-liner attached to existing positive guidance avoids a standalone "don't" section. Happy to go with 1 if you prefer fewer rules over more nuance.
(The first rule — re-check PR state before pushing — stays as is; that one's a positive recipe.)
There was a problem hiding this comment.
Dropped in 5361680. PR title/body updated to reflect the single remaining rule.
The CI Monitoring section above already shows the positive `for ... seq` recipe; the additional rule was the negative form of guidance already present.
## Why Cut the 0.1.2 release so consumer repos (and tend's own nightly regen) pick up the new `claude-interactive` harness and per-workflow `harness`/`model` overrides. ## What's new since 0.1.1 **New `claude-interactive` harness** (`max-sixty/tend/[email protected]`) — opt-in alternative to the released `claude` harness. PTY-supervised interactive `claude` via `script(1)`, end-of-turn detected through Stop/StopFailure hooks. Built as the trial path ahead of Anthropic's June 15 billing split between Agent-SDK metering and the flat Claude Code subscription. Smoke tested end-to-end on tend itself. PRs: #609, #611, #613, #614, #615, #616. **Per-workflow `harness` / `model` override** — adopters can flip a single workflow to a different harness or model without changing `.config/tend.yaml` defaults. #612. **Skill refinements** — nightly upstream-bot rebases (#605), running-in-ci PR bar (#604) and recheck (#573), env-filter loophole fix (#599), authorAssociation warning (#600), review-gates Gate 1 (#602). **Bug fix** — mention queue-delay now uses `comment.updated_at` so edit events report accurately (#595). ## Compatibility Released `claude` harness path is byte-identical; `claude-interactive` is strictly additive and opt-in. Consumer repos that don't touch `harness:` see no change beyond the new skill text and the mention-edit fix.
Problem
A
tend-mentionhandle job in a consumer repo deadlocked for ~6 hours after pushing a follow-up commit to a PR that had been merged minutes earlier. The bot polled the merged PR'sheadRefOidin an unbounded backgrounduntilloop, holding the GitHub Actions job alive until the workflow's 360-minute cap cancelled it. Side effects: an orphan commit left on the now-deleted branch, the next handle job queued for 5h53m behind the deadlocked one (cancel-in-progress: false), andtoken-usage.jsonreporting0for the cancelled run.The push-after-merge cause is intrinsic to tend's design (push follow-ups on PRs) and not adopter-specific.
Solution
One rule added to
plugins/tend-ci-runner/skills/running-in-ci/SKILL.md, under Pushing to PR Branches: re-check PR state before pushing a follow-up commit. Any wait — CI poll, coverage fetch, sleep, background task — lets a maintainer merge or close the PR. If state isn'tOPEN, skip the push. After merge,gh pr view --json headRefOidreturns the SHA at merge time forever, so polling it for a new push is a guaranteed deadlock.The originally-proposed second rule ("bound every polling loop") was dropped during review — the CI Monitoring section already shows the bounded-
forrecipe, and a negative-form restating added little.Testing
Skill text only — no code paths to test.
Closes #572 — automated triage