Dispatch workflows push directly to main — races with concurrent human commits #7

Open
opened 2026-04-18 07:36:06 -07:00 by nelsong6 · 0 comments
nelsong6 commented 2026-04-18 07:36:06 -07:00 (Migrated from github.com)

Problem

The `go-dependency-update-template` and `release-and-dispatch-template` push directly to `main` when they bump go.mod and cut releases. When a human is also pushing to the same branch around the same time, the human's push gets rejected and they have to stash → pull --rebase → resolve go.mod/go.sum conflicts → push. Every cascade iteration.

Real example from today: pushed a tui.go change to fzt-terminal. The dep-update bot had just pushed a go.mod bump. My push was rejected. Had to:

  1. `git stash push -- CLAUDE.md` (unrelated uncommitted doc drift)
  2. `git pull --rebase`
  3. Resolve go.mod + go.sum conflicts (both sides had bumped the same deps)
  4. `git rebase --continue`
  5. Rebuild + re-push

Same dance happened again on fzt-automate immediately after. The friction is predictable, reproducible, and scales with the number of cascading repos — right now that's 5 repos per full cascade, meaning 5 chances per cascade for a race.

Design options

Bot creates a branch (e.g. `auto/deps-$(date +%s)`), commits the bump there, opens a PR, auto-merges when CI passes. Human commits still go to main directly. No race — the bot's work lives on a side branch until it's ready to merge, and the merge itself is atomic against whatever is on main at merge time.

Pros: No races. PR history is auditable. Auto-merge handles the atomic land.

Cons: ~30s latency per hop (branch → PR → merge). Auto-merge needs to be enabled at repo level. Need to handle the edge case where auto-merge can't apply because main drifted.

2. Bot holds a lock / serialized concurrency (narrower)

Already using GitHub Actions concurrency groups — extend to include human-initiated workflows. Doesn't help with human `git push` directly from terminal though, only workflow-to-workflow races.

3. Human-side retry wrapper

A shell helper that wraps `git push` with `pull --rebase` retry + auto-resolve on go.mod/go.sum conflicts (taking the newer version). Unblocks push friction but doesn't fix the underlying race.

Recommendation

Option 1. The templates already know how to mint installation tokens via the `romaine-life-app` GitHub App; creating a PR via `gh pr create` with that token is a one-step addition. Auto-merge needs to be enabled per repo, but can be in the same PR that ships this template change.

Happy to prototype the template change against one repo (fzt-frontend?) to validate before rolling out.

## Problem The \`go-dependency-update-template\` and \`release-and-dispatch-template\` push directly to \`main\` when they bump go.mod and cut releases. When a human is also pushing to the same branch around the same time, the human's push gets rejected and they have to stash → pull --rebase → resolve go.mod/go.sum conflicts → push. Every cascade iteration. Real example from today: pushed a tui.go change to fzt-terminal. The dep-update bot had just pushed a go.mod bump. My push was rejected. Had to: 1. \`git stash push -- CLAUDE.md\` (unrelated uncommitted doc drift) 2. \`git pull --rebase\` 3. Resolve go.mod + go.sum conflicts (both sides had bumped the same deps) 4. \`git rebase --continue\` 5. Rebuild + re-push Same dance happened again on fzt-automate immediately after. The friction is predictable, reproducible, and scales with the number of cascading repos — right now that's 5 repos per full cascade, meaning 5 chances per cascade for a race. ## Design options ### 1. Bot uses PRs instead of direct pushes to main *(recommended)* Bot creates a branch (e.g. \`auto/deps-\$(date +%s)\`), commits the bump there, opens a PR, auto-merges when CI passes. Human commits still go to main directly. No race — the bot's work lives on a side branch until it's ready to merge, and the merge itself is atomic against whatever is on main at merge time. **Pros:** No races. PR history is auditable. Auto-merge handles the atomic land. **Cons:** ~30s latency per hop (branch → PR → merge). Auto-merge needs to be enabled at repo level. Need to handle the edge case where auto-merge can't apply because main drifted. ### 2. Bot holds a lock / serialized concurrency *(narrower)* Already using GitHub Actions concurrency groups — extend to include human-initiated workflows. Doesn't help with human \`git push\` directly from terminal though, only workflow-to-workflow races. ### 3. Human-side retry wrapper A shell helper that wraps \`git push\` with \`pull --rebase\` retry + auto-resolve on go.mod/go.sum conflicts (taking the newer version). Unblocks push friction but doesn't fix the underlying race. ## Recommendation Option 1. The templates already know how to mint installation tokens via the \`romaine-life-app\` GitHub App; creating a PR via \`gh pr create\` with that token is a one-step addition. Auto-merge needs to be enabled per repo, but can be in the same PR that ships this template change. Happy to prototype the template change against one repo (fzt-frontend?) to validate before rolling out.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/pipeline-templates#7
No description provided.