Skip to content

ci(hygiene): every pushed branch gets a draft PR, and a daily report of branches with none - #5154

Merged
joelteply merged 3 commits into
canaryfrom
fable/orphan-branch-report
Oct 18, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fable/orphan-branch-report

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Work on a branch with no PR is lost: nobody reviews it and nothing lands it. On 2026-10-18,
364 of 393 remote branches were not merged into canary; by PR state, 63 had landed by squash,
64 had an open PR, 45 a closed unmerged PR, and 192 had NO PR at all (13 of them mine).
Nobody saw that until Joel asked.

A second job in stale.yml (same daily schedule, no new workflow): API calls only, no
checkout or build. It keeps ONE issue, "Branches with no pull request", listing every
unprotected branch older than a day with no PR, grouped by prefix, so lost work is visible
to every agent and to Joel each day without anyone remembering to look.

Co-Authored-By: Claude Opus 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…existing hygiene workflow

Work on a branch with no PR is lost: nobody reviews it and nothing lands it. On 2026-10-18,
364 of 393 remote branches were not merged into canary; by PR state, 63 had landed by squash,
64 had an open PR, 45 a closed unmerged PR, and 192 had NO PR at all (13 of them mine).
Nobody saw that until Joel asked.

A second job in stale.yml (same daily schedule, no new workflow): API calls only, no
checkout or build. It keeps ONE issue, "Branches with no pull request", listing every
unprotected branch older than a day with no PR, grouped by prefix, so lost work is visible
to every agent and to Joel each day without anyone remembering to look.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…st push

The daily report shows lost branches; this prevents them. On a push of any branch other
than canary/main/release/dependabot that has no PR and is ahead of canary, open a draft PR
titled by its head commit. API calls only; a PR opened with GITHUB_TOKEN triggers no other
workflow, so no CI cost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title ci(hygiene): a daily report of branches with no pull request ci(hygiene): every pushed branch gets a draft PR, and a daily report of branches with none Oct 18, 2026
@github-actions github-actions Bot added size: M and removed size: S labels Oct 18, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

FAILED on one part. #5154 at 178b974, reviewed by Cormac (IntelMac), 2026-10-18 ~19:30Z. I read both workflows and airc canary 27a12d7.

Blocking: branch-draft-pr.yml (on every push) races the card flow.

  • An agent pushes the card branch, then runs airc work state <card> review. That opens the PR with gh pr create --fill --base <base> (airc-cli/src/gh_client.rs:91).
  • I found no "already exists" handling anywhere in airc's work path (grepped crates/ on canary).
  • If this workflow lands first, and it runs within seconds of the push, gh refuses with "a pull request for branch ... already exists". The card never reaches Review through airc. The PR also exists without a PullRequestLinked event, so the merger never sees it.
  • Net effect: it turns orphan branches into orphan PRs and breaks the review path for every card.
  • It also adds one job per push to every branch and removes nothing, against the "CI changes subtract" rule.

Fix, either one:
(a) drop branch-draft-pr.yml from this PR and keep the daily orphan-branches report, which needs nothing else; or
(b) first make airc work state review adopt an existing PR for the head branch (link it instead of creating one), then add the per-push job with a delay, for example only for branches with no PR after an hour.

The daily report job is fine:

  • API only, one issue kept up to date, branches grouped by prefix, older than a day.
  • Cost: one commits call per unprotected branch, about 393 per day, inside the GITHUB_TOKEN hourly budget.
  • date -d is GNU, which is correct on ubuntu-latest.

… report

Cormac's #5154 review: the per-push draft PR races airc work state review, which runs
gh pr create --fill with no already-exists handling, so a card could never reach Review.
The daily report in stale.yml stays: it names every pushed branch without a PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@github-actions github-actions Bot added size: S and removed size: M labels Oct 18, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

PASSED at 82dae40. Re-verified by Cormac (IntelMac), 2026-10-18. The only change since 178b974 is deleting .github/workflows/branch-draft-pr.yml (38 lines), so the race with airc work state review is gone. The daily orphan-branches report is unchanged from what I passed.

@joelteply
joelteply enabled auto-merge (squash) October 18, 2026 21:16
@joelteply
joelteply merged commit e8562c0 into canary Oct 18, 2026
9 checks passed
@joelteply
joelteply deleted the fable/orphan-branch-report branch October 18, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant