agentleFS
sherificansherifican/Agent-FleetOps/skills/concurrent-push-integration/SKILL.md

concurrent-push-integration

Skill34 starsChanged 37 days agoMITView on GitHub

When a push to a shared branch is REJECTED (the remote advanced), integrate the incoming work — never force over it. Invoke when `git push` fails with non-fast-forward / "fetch first", whenever two or more writers (agents, or an agent and a human, or an automated export) share write access to one repo, or any time you are about to reach for `--force`. A rejected push is information — someone else pushed — not an obstacle to bulldoze.

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When more than one writer can push to the same branch, git push will sometimes be rejected with !

    line 9
  2. Very specific:

    Use --force-with-lease, never bare --force.

    line 34

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Concurrent Push Integration — a rejected push means integrate, not overwrite

When more than one writer can push to the same branch, git push will sometimes be rejected with ! [rejected] ... (fetch first) (non-fast-forward). This is not an error to force past — it is the remote telling you someone else advanced the ref while you were working. Reaching for git push --force is the destructive move: it replaces the remote's history with yours and silently discards whatever the other writer pushed.

The protocol

  1. Never --force to clear a rejection. A rejection means the remote has commits you don't have. Forcing deletes them — in a multi-writer setup, that is another party's work.
  2. Fetch and read what landed. git fetch origin, then git log --oneline <your-base>..origin/main and git diff --stat <your-base>..origin/main. Now you can tell a benign parallel edit from a real conflict.
  3. Check for overlap with your own pending change — same files, same lines? No overlap → a clean rebase. Overlap → the rebase pauses on the conflicting hunk for you to resolve, keeping both intents.
  4. Rebase (or merge) your work on top of the remote: git rebase origin/main. You are moving your commit to sit after theirs, not replacing theirs.
  5. Verify BOTH survived before pushing. Grep the working tree for your change AND theirs. A rebase that silently dropped one side is worse than the rejection — do not trust "rebase succeeded", read the result.
  6. Push — now a fast-forward.

The one time force is legitimate — and how to make it safe

A deliberate, authorized rewrite of a commit you just pushed (e.g. correcting a malformed author email on your own tip commit) is a real use of force. Even then:

  • Use --force-with-lease, never bare --force. --force-with-lease refuses the push if the remote has moved since your last fetch — so if another writer slipped a commit in, the lease FAILS and stops you, which is precisely the signal to go integrate instead. Bare --force has no such guard and overwrites blind.
  • A lease failure is not an obstacle either — it is the same "someone else pushed" signal. Fetch, integrate, and re-decide whether the rewrite is still needed.

Why this matters more with agents than with people

Two humans on one repo coordinate socially ("I'm pushing now"). Two agents — or an agent and a human, or an agent and an automated export — push on independent schedules with no shared clock, so collisions are normal, not exceptional. The capability to push is shared, which makes "who pushes" a coordination decision, not a capability limit; the integration discipline above is what makes shared write access safe instead of a clobber lottery.

Why this exists

Distilled from a live incident where an agent and a human collaborator (the repository owner) both held push access to one repository. The agent's push was rejected mid-task because the human had pushed a one-line change moments earlier. The agent fetched, confirmed the incoming edit did not overlap its own, rebased on top, verified both changes survived in the tree, and pushed a fast-forward — no work lost on either side.

The agent-and-human case is the sharper one: a claim/driver lock can stop two agents from colliding, but it cannot bind a human collaborator's own hands — so recovery after a collision, not just prevention of one, is mandatory. (The incident was first written up with the wrong participant — "two agents" — which would have taught the wrong prevention; corrected here, which is itself the argument for recording provenance.) Generalized; identifiers removed.

Related: specs/driver-lock-protocol.md is the prevention half — claim a region before writing so two agents don't collide. This skill is the recovery half — what to do once a collision has happened anyway, which a lock cannot prevent when one writer sits outside its authority.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.