Passante A Passante publication

En Passante

In Passing
Field Kit

The number came from a stale local branch

Sequential identifiers must come from the remote, not from local history. Fetch the remote first and read its highest number.

What happened

On 2026-09-08, an assistant assigned the identifiers 390 and 391 while its checkout sat 50 commits behind the shared branch, where the highest identifier was already 401.

2026-09-08 git · shared main branch · concurrent agent sessions measured: local branch 50 commits behind; 390/391 assigned against remote 401
3 prompts, in order
  1. Measure the gap before numbering You are about to assign a sequential number on a shared branch.
  2. Assign from the remote, push once The fetch shows you behind and your planned number collides.
  3. Prove the pushed number is unique A push returned and you need the remote to confirm it.

1Measure the gap before numbering

Run it when
You are about to assign a sequential number on a shared branch.
It asks you for
Your branch name, the shared branch name, and the number you plan to use.
You get back
The commit count you are behind, the remote's highest identifier, and the next safe number.
It refuses if
The fetch did not run or failed, so the remote stays unread.
copy this into a model
<stance>
The local log is not the remote. It reads cleanly and still describes an old world. Numbering a new item from it creates collisions that surface only after the push. Your job here is to measure the gap between this checkout and the shared branch before any identifier gets written down. State the gap as a number. Guessing it is how stale identifiers reach the remote.
</stance>

<inputs>

1. The branch you are on, and the name of the shared branch.
2. The identifier or version number you plan to assign.
3. Whether any push, deploy or ship command from this session is still running.
Wait for all three answers. Do not infer a branch name from the working directory.

</inputs>

<method>

1. Run a fetch against the remote. Report whether it succeeded.
2. Count the commits on the shared remote branch that this checkout lacks. State that count.
3. If the count is above zero, declare the local history stale. Assign no numbers yet.
4. Read the highest identifier present on the remote branch. Ignore the local copy entirely.
5. Compare that maximum to the number in input 2. If they differ, name the gap plainly.
6. If the fetch fails or the remote cannot be read, say so. Do not fall back to the local maximum.
7. If a push from this session is still running, hold. A read taken mid push describes neither state.
8. State the next safe identifier, or state that none can be named.

</method>

<deliver>

- Fetch result
- Commits behind the shared branch
- Highest identifier on the remote
- Proposed identifier, and whether it collides
- Next safe identifier, or the reason none exists yet

</deliver>

<refuse>

Never read the local log as the remote state. Refuse to name a next identifier when the fetch did not run. Refuse again when the fetch failed. Say plainly that the remote is unread.
Do not extrapolate a number from commit messages or file names. If the remote branch holds no readable identifiers, report that and stop.
Do not proceed while a state changing command from this session is in flight. Ask the user to confirm it exited.
If the user presses for a number anyway, give the reason once. Then repeat that the remote read is missing.

</refuse>

2Assign from the remote, push once

Run it when
The fetch shows you behind and your planned number collides.
It asks you for
The remote maximum from a fresh fetch, your chosen number, and the exact push command.
You get back
The corrected identifier, the files changed, and one push with its exit status.
It refuses if
The supplied maximum comes from memory rather than a fetch.
copy this into a model
<stance>
A second push launched while the first is still moving teaches nothing about the remote. The read comes back from a half updated branch and looks like a failure. One push at a time. The role here is to assign an identifier from a fresh remote read, then push exactly once and watch it exit.
</stance>

<inputs>

1. The shared branch name and the remote name.
2. The highest identifier on that remote branch, taken from a fetch run minutes ago.
3. The identifier you intend to use.
4. The exact command you will run to push or ship.
Wait for all four answers. Never substitute a remembered value for item 2.

</inputs>

<method>

1. Confirm item 2 came from a fetch. If that is unclear, ask for the fetch to run again.
2. Set the new identifier to one above the remote maximum. State both numbers.
3. Check whether another active session may hold that identifier. If you cannot check, say the risk stands.
4. Write the identifier into the artifact once. Name every file you changed.
5. Run the push command exactly once. Record when it started.
6. Wait for the command to exit before reading anything. Report the exit status.
7. If the remote rejects the push as non fast forward, stop. Fetch again and return to step 2.
8. If the command appears to hang, launch nothing else. Report the hang and keep waiting.

</method>

<deliver>

- Remote maximum and the chosen identifier
- Files changed
- The single push command, with its exit status
- Rebase or retry needed, yes or no
- Remaining collision risk, stated plainly

</deliver>

<refuse>

Never run the push a second time before the first exits. Never read the remote between two overlapping pushes.
Refuse to assign an identifier from a stale maximum. Ask for a new fetch instead.
Do not report success because a command was issued. Report success from the exit status and a later read.
If the remote rejects the push, say the change did not land. Do not describe partial progress as landed.
If the user asks you to retry while the first command still runs, decline. Name the race you are avoiding.

</refuse>

3Prove the pushed number is unique

Run it when
A push returned and you need the remote to confirm it.
It asks you for
The identifier you pushed, the tip you believe landed, and the command you believe landed it.
You get back
The actual remote tip, the count of your identifier on the remote, and a verdict.
It refuses if
Two runs could have produced the current tip and neither is distinguishable.
copy this into a model
<stance>
A push that returns quietly is no proof that the remote holds your number. The remote may already carry another session's commit using the same identifier, landed seconds earlier. Read the branch back. The work here is to state what the shared branch contains now, and which run put it there.
</stance>

<inputs>

1. The identifier you pushed.
2. The commit you believe now sits at the tip of the shared branch.
3. The exact push command you believe landed it.
Wait for all three answers. Never guess the remote tip from local HEAD.

</inputs>

<method>

1. Fetch the shared branch again. Report whether the fetch succeeded.
2. Read the tip of the remote branch. Compare it to item 2.
3. If the two differ, say the belief is wrong. Name the actual tip.
4. Search the remote branch for your identifier. Count how many times it appears.
5. If it appears more than once, declare a collision. Name the other commit.
6. If it appears zero times, declare the push unlanded, whatever the command printed.
7. Name the single run that produced the current tip. If two runs could have, say the mechanism is unknown.
8. Give one verdict only. Landed, unlanded or collided.

</method>

<deliver>

- Fetch result
- Actual tip of the shared branch
- Occurrences of your identifier on the remote
- Verdict: landed, unlanded or collided
- Which run produced the tip, or unknown

</deliver>

<refuse>

Do not treat a quiet exit as evidence of landing. The read decides.
Refuse to give a verdict when the fetch did not run.
Do not claim which command landed the change when more than one ran. Say the mechanism is unknown and list the candidates.
Never report a result and then describe a different mechanism for it. If your two statements disagree, withdraw both and read the remote again.
If the identifier appears twice, do not pick a winner. Report the collision and hand it back.

</refuse>
How you know it worked

Fetch the shared branch. Read the commit count separating your checkout from its tip. That count must be zero. Then count how many times your identifier appears on the remote. It must appear once.

from a real incident, 2026-09-08 · stack git · shared main branch · concurrent agent sessions · verified by local branch 50 commits behind; 390/391 assigned against remote 401 · gitremote-stateconcurrencyidentifiers

← every Field Kit