Skip to content

Concurrent claims and data safety

The report of one tester, as it returned it: a model's account, kept whole so that nothing in it is lost. Each finding gives where, the evidence observed and a proposed fix. A finding is a lead until someone has reproduced it against the present files.

Tested against: see its own summary; NOT yet acted on unless noted.

Summary

Concurrency lens, tested only on private bare remotes and clones under /concurrency/ (nothing written to /home/user/asoc-autom, nothing pushed).

The repository moved under test twice (85e3f4d -> 767644e -> decd5ae). Everything below was re-verified against a pinned copy of decd5ae, the live head when I stopped at 14:50Z (the live medium was then draining: max_live_holds 0, quiet_at 15:05Z). Defects I found at the seed commit that were fixed meanwhile and are NOT reported: release without --session deleting another's live hold; sync silent about a takeover; a mistyped stop falling back to 6; an ISO 'until' with seconds read as lapsed; stale status; claim skipping sync's attribution gate; the false "someone removed it" on release (present at 767644e, fixed in 130ded0).

What holds (observed): exclusive acquisition under real races. 25 rounds x 8 parallel claims of one line: exactly one "acquired" each; 8 rounds x 6 parallel takeovers of a lapsed hold: one each; max_live_holds 1 with 6 parallel claims of different lines, 10 rounds: one each; limit 6 with 8 claimers, 10 rounds: exactly 6, nobody starved by the retry loop. A claim in a dirty tree commits only the hold; nothing is swept in or lost (one nit: after the rebase path a staged modification comes back unstaged, "M " -> " M"). A refused push, an unreachable origin and a committed conflict in a non-union file all leave the clone exactly as it was. max_live_holds 0 stops claim and renew. Odd ids are refused; path-like ids to renew/release are harmless.

What does not hold: 10 findings below, 4 of them "breaks". The two worst: (1) sync prints "synced" after rebase --autostash fails to re-apply uncommitted edits, leaving conflict markers and a stash, and I used that to make a clone ignore a STOP that had just landed and acquire a hold; (2) merge=union silently fuses or splices two participants' marks on one line, which is exactly the case holds/README.md says is safe.

Test file: 18 tests, 272 lines (over the ~250 asked). At decd5ae: "Ran 18 tests in 53.018s / OK (expected failures=10)": 8 pass, 10 are marked expectedFailure with a comment each. It starts each test from an idle medium (removes holds, resets limits in its private remote) so it does not depend on the live state.

Fixes: swarm-fixes.patch (279 lines) applies cleanly to decd5ae (git apply --check). Against a scratch copy with it applied, all 10 expected failures become unexpected successes and the other 8 still pass ("Ran 18 tests / FAILED (unexpected successes=10)"). The per-finding fixes below are hunks of that patch. It was never applied to the real repository.

[breaks] sync reports success into conflict markers and an orphan stash; a STOP can be lost that way

Where: tools/swarm.py integrate(): rc, _, _ = git("rebase", "--autostash", "--quiet", f"origin/{b}") followed by if rc == 0: return True, "rebased onto the medium" (its docstring: "Never leaves a merge or rebase half done")

Evidence: At decd5ae. B pushes max_live_holds: 0. A has one unpushed commit and an uncommitted max_live_holds: 4. A: python3 tools/swarm.py sync -> rc 0: CHANGED on the medium since your last checkpoint: limits.conf. Read them again before going on. synced (rebased onto the medium) medium: origin/... | live holds: 0 of 4 (nobody) | ... note: 1 uncommitted change(s) stay local until you commit them A: git status --short -> UU limits.conf; limits.conf now contains <<<<<<< Updated upstream max_live_holds: 0 ======= max_live_holds: 4

Stashed changes (git stash list -> stash@{0}: autostash, seen at 767644e; integrate() is unchanged since.) A: claim tired-of-trees --by claude-code -> acquired tired-of-trees | session eff133 | until 2026-11-28T17:47Z, while B's clean clone prints live holds: 1 of 0 ... STOP: limits.conf sets max_live_holds to 0. The same happens for any non-union file (AGENTS.md, tools/swarm.py, a journal entry): git rebase exits 0 when only the autostash re-apply conflicts. Test: test_a_stop_is_not_lost_in_conflict_markers.

Proposed fix: Refuse before touching anything when uncommitted changes overlap what the medium changed. In integrate(), just before ahead = git("rev-list", ...):

mine = set(git("diff", "--name-only", "HEAD")[1].splitlines())
both = sorted(mine & set(git("diff", "--name-only", f"HEAD...origin/{b}")[1].splitlines()))
if both:
    return False, ("you have uncommitted changes to " + ", ".join(both) + ", which the medium has changed too. "
                   "Nothing was changed. Commit them (or set them aside), then run this again")

With it the clone is left untouched, sync exits 2, and the claim after the STOP is refused.

[breaks] merge=union silently fuses or splices two participants' marks on one line

Where: .gitattributes lines 3-4 (lines/*.md merge=union, sources/*.md merge=union). Contradicts holds/README.md: "That is enough here, because marks are added, not overwritten", and AGENTS.md: "passes are never rewritten".

Evidence: At decd5ae, two clones each append a mark to the same line and sync (the case of an old holder and the one who took over). (a) Same heading on both sides (two claude-code passes on one day): the medium ends up with ONE heading over both bodies: ### 2026-11-28 | claude-code | pass

A's pass. First sentence of A. Second sentence of A. B's reading of something else entirely. Second sentence of B. (b) Different headings, both quoting the same 4 lines: A's conclusion lands under B's heading: ### 2026-11-28 | claude-code | pass

A1: A opens its pass. ### 2026-11-28 | codex | reading

B1: B opens its reading.

In fact, the automaton that is asocial ... (4 quoted lines, once)

A2: A concludes that the property is an identity. B2: B concludes that it is only an analogy. Both syncs print synced (rebased onto the medium), rc 0; no sensor fires. (c) Two clones each record sources/minsky-1967.md (needs no hold): the merged file keeps one field block and has status: named and a stray --- in its body; brief says nothing. Tests: test_two_marks_under_the_same_heading_stay_two, test_two_marks_quoting_the_same_passage_are_not_spliced.

Proposed fix: Delete the two merge=union lines, so that two writers on one file stop on the conflict that sync already reports:

-lines/.md merge=union -sources/.md merge=union

and make the report usable (the tool aborts the merge, so the participant needs the command). In integrate() replace the end of the message with:

  • f". Nothing was changed. Run git merge origin/{b}, resolve by hand (in a line, keep both marks whole, each under its own heading), commit, and sync again"

If stopping is judged too costly, the alternative is a merge driver in swarm.py that accepts only pure append-after-the-common-end and conflicts otherwise; union cannot be made safe by a rule about headings.

[breaks] A hold can be 'acquired' already lapsed, twice in a row; --hours is unchecked (traceback, or a hold until 2038)

Where: tools/swarm.py cmd_claim and cmd_renew: hours = args.hours or limits["hold_hours"]; limits.conf hold_hours ("Anyone may lower these numbers")

Evidence: At decd5ae: A: claim tired-of-trees --by k --hours -1 -> acquired tired-of-trees | session 7c0d39 | until 2026-11-28T13:48Z (run at 14:48Z) B: claim tired-of-trees --by j -> acquired tired-of-trees | session adba3d | until 2026-11-28T17:48Z With hold_hours: 0 pushed to limits.conf: A -> acquired tired-of-trees | session 32fbc0 | until 2026-11-28T14:48Z, then B -> acquired tired-of-trees | session 5b1087 | until 2026-11-28T14:48Z (hold_hours: -2 and --hours 0.001 behave the same.) claim ... --hours nan -> ValueError: cannot convert float NaN to integer (traceback; inf and 1e9 give OverflowError) claim map-and-tracing --by k --hours 99999 -> acquired map-and-tracing | session 358e1b | until 2038-04-26T05:48Z, although holds/README.md says "with until no more than hold_hours after since". Test: test_a_hold_born_lapsed_is_not_acquired.

Proposed fix: Add

def lifetime(asked: float, limits: dict) -> tuple[float, str]:
    cap = limits["hold_hours"]
    hours = asked or cap
    if not (hours == hours and 0.1 <= hours <= cap):
        return 0, f"a hold lasts between 0.1 and {cap} hours (limits.conf, hold_hours); {hours} is not that"
    return hours, ""

and in cmd_claim replace hours = args.hours or limits["hold_hours"] with

    hours, why = lifetime(args.hours, limits)
    if why:
        print(f"not acquired: {why}")
        return 1

(the same in renew, with "not renewed"). hold_hours: 0 then refuses every hold with a reason instead of granting dead ones.

[breaks] A renew or release that loses to a takeover leaves an unpushable commit; every later command then fails

Where: tools/swarm.py cmd_renew / cmd_release: they commit locally and hand over to cmd_sync, which never takes the commit back (claim does, via undo_hold_commit)

Evidence: At decd5ae. A's hold has lapsed; A runs renew <line> --session <S> --hours 5 at the same instant B runs claim <line> (truly parallel): in 6 of 6 rounds (11 of 12 at 767644e) B wins and A is left [ahead 1, behind 1] with renew: tired-of-trees (claude-code) on top. Same for release, 6 of 6. From then on, in A's clone: sync -> rc 2 not pushed: two writers met in: holds/tired-of-trees. Nothing was changed. Resolve by hand (keep both sides of a line's passes), commit, sync again claim -> rc 1, the same text release -> rc 1, the same text A is never told its hold was taken over, cannot push its marks until it resets the commit by hand, and the advice ("keep both sides") applied to a hold file would write a hold with two holders. Also reachable without a race: renew while origin is unreachable keeps the commit (not pushed: origin is unreachable. Your commits are safe locally), and it collides later. Test: test_renew_that_loses_to_a_takeover_leaves_the_clone_usable.

Proposed fix: Make renew and release the same checked loop as claim: fetch, integrate, own_hold, write or remove the file, commit only it, push; on a refused push git reset --soft HEAD~1, restore holds/ from HEAD, re-read and retry; with origin unreachable change nothing. This is the def settle(args, verb, done) hunk of swarm-fixes.patch (about 45 lines replacing cmd_renew and cmd_release). With it the losing renew prints not renewed: the hold on <line> now belongs to another session (codex): it was taken over and the clone stays clean.

[misleads] renew and release ignore a failed commit and exit 0; neither confirms what it did

Where: tools/swarm.py cmd_renew: git("add", ...), git("commit", ...) with return codes dropped, then return cmd_sync(...); cmd_release likewise with git rm

Evidence: At decd5ae, with a pre-commit hook that fails in A's clone (any commit failure does it: a hook, index.lock, a signing program): renew tired-of-trees --session --hours 2 -> rc=0, output only medium: origin/... | live holds: 1 of 6 (1 claude-code) | ... note: 1 uncommitted change(s) stay local until you commit them local holds/tired-of-trees: until: 2026-11-28T16:48Z; on the medium: until: 2026-11-28T17:48Z. The holder's own copy shows the new time, the medium does not, and the exit status says success; with a longer renewal the hold lapses on the medium while its holder believes it live. A successful renew prints the same single medium: line, with no new time, so the two cannot be told apart. release behaves the same (rc 0, hold still on the medium, at 767644e). Test: test_renew_that_did_not_reach_the_medium_does_not_exit_0.

Proposed fix: Same hunk as the previous finding (settle): check the commit, and print the outcome only after the push has landed:

    err = commit_hold(args.id, f"{verb}: {args.id} ({hold['by']})")
    if err:
        print(f"not {done}: could not commit: {err}")
        return 1
    if push():
        print(f"{done} {args.id}{until}")   # e.g. `renewed tired-of-trees | until 2026-11-28T16:43Z`, `released tired-of-trees`

[misleads] A hold commit that fails leaves a phantom hold file, which the clone then obeys

Where: tools/swarm.py cmd_claim, the if rc != 0: branch after the commit: it runs git reset -- holds/<id> and returns, leaving the file written by write_hold

Evidence: At decd5ae, failing pre-commit hook in A's clone: claim map-and-tracing --by claude-code -> rc=1 not acquired: could not commit the hold:; git status --short -> ?? holds/map-and-tracing hook removed, same command again -> rc=1 not acquired: map-and-tracing is held by claude-code until 2026-11-28T17:48Z the medium has no such hold (git ls-tree on the remote: absent). The clone is locked out of the line by its own leftover, counts it in live holds, and a later git add -A would publish it. Also reproduced without a hook: two processes claiming different lines from ONE checkout (subagents sharing a working directory) left ?? holds/<id> in 15 of 20 rounds, with could not commit the hold: error: pathspec 'holds/map-and-tracing' did not match ... Unable to create ... index.lock. Test: test_failed_hold_commit_leaves_no_phantom_hold.

Proposed fix: In that branch put the file back to what HEAD has:

    if rc != 0:
        git("reset", "--quiet", "--", f"holds/{hold_id}")
        if existed:
            git("checkout", "--quiet", "--", f"holds/{hold_id}")
        else:
            (ROOT / "holds" / hold_id).unlink(missing_ok=True)
        print(f"not acquired: could not commit the hold: {err[:200]}")
        return 1

(swarm-fixes.patch factors this as restore_hold/commit_hold and also checks the git add.)

[misleads] A push that landed but looked failed makes claim deny its own hold, which then blocks the line for hold_hours

Where: tools/swarm.py cmd_claim retry loop: after push() returns False it undoes the local commit, refetches, and treats the hold it finds as someone else's

Evidence: At decd5ae, with a test double for git whose first push really pushes and then exits 1 (what a connection dropped after the server accepted looks like): claim tired-of-trees --by claude-code -> rc=1 not acquired: tired-of-trees is held by claude-code until 2026-11-28T17:47Z on the medium: by: claude-code / session: 765b05 / since: 2026-11-28T14:47Z / until: 2026-11-28T17:47Z (the session this very claim generated) .git/swarm-holds: absent, so release tired-of-trees -> nothing to release: the hold on tired-of-trees was not taken by this clone; pass --session if it is yours B: claim tired-of-trees -> not acquired: tired-of-trees is held by claude-code until ... Nobody was given the session; the line is dead until the lease runs out. The same end state appeared for real once in 20 rounds of two processes claiming from one checkout (one process's push carried the other's hold commit). Test: test_a_push_that_landed_after_all_is_recognised_as_the_hold.

Proposed fix: In cmd_claim, right after current = holds.get(hold_id):

    if current and current["session"] == session:   # an earlier push of ours landed after all
        remember(hold_id, session)
        print(f"acquired {hold_id} | session {session} | until {current['until']}")
        return 0

[misleads] Liveness is each reader's own clock and nothing senses a wrong one

Where: tools/swarm.py load_holds(): "live": until is None or until > now(); AGENTS.md table row "One holder per line" (says nothing of clocks); no sensor in sense()

Evidence: At decd5ae, running one clone with its clock shifted (now() patched in a wrapper, the tool untouched): A (true clock): acquired tired-of-trees | session f509d9 | until 2026-11-28T17:48Z B (+4 h), seconds later: acquired tired-of-trees | session c5393b | until 2026-11-28T21:48Z (its brief had offered it: [stranded] tired-of-trees: hold by claude-code lapsed at ...: take it over) A (-4 h) on another line: acquired map-and-tracing | session 200a7f | until 2026-11-28T13:48Z; B (true clock) at once: acquired map-and-tracing | session 3c92c1 | until 2026-11-28T17:48Z A is told at its next checkpoint that its hold was taken over, but no clone's brief mentions a clock, so the cause is invisible and repeats: a fast clock takes every live hold it is offered, a slow one can never keep one. Test: test_a_wrong_clock_cannot_make_two_holders_unnoticed.

Proposed fix: Two small checks. In sense():

for h in holds.values():
    since = unstamp(h["since"])
    if since and since > now() + dt.timedelta(minutes=10):
        add("stranded", h["id"], f"hold by {h['by']} says it began at {h['since']}, which is in the future: a clock "
            "is wrong (its holder's or yours). A hold taken over on a wrong clock has two holders: check both")

and in cmd_claim before write_hold:

    tip = git("log", "-1", "--format=%ct", f"origin/{branch()}")[1]
    if tip.isdigit() and int(tip) > now().timestamp() + 600:
        print("not acquired: this machine's clock is behind the medium's latest commit, so its hold would be born lapsed")
        return 1

A fast clock cannot detect itself from git alone; the sensor makes every other clone show it.

[friction] In a clone whose refspec does not cover the medium, brief shows stale state as fetched and every push fails for ever

Where: tools/swarm.py fetch(): git("fetch", "--quiet", "origin", branch()) updates origin/ only if remote.origin.fetch maps it

Evidence: At decd5ae. Clone A has remote.origin.fetch = +refs/heads/master:refs/remotes/origin/master (what git clone --single-branch or --depth 1 of the default branch leaves, with the medium fetched by name afterwards). B claims tired-of-trees. Then in A: brief -> medium: origin/... | live holds: 0 of 6 (nobody) | ... and an empty second line: neither "(not fetched ...)" nor "behind" (the fetch succeeded, into FETCH_HEAD only) claim map-and-tracing --by k -> after about 13 s: rc=1 not acquired: map-and-tracing (the medium kept moving; readbriefagain) sync (767644e) -> not pushed: the medium kept moving; run sync again The participant is locked out and told to keep retrying. Test: test_a_clone_with_a_narrow_refspec_still_follows_the_medium.

Proposed fix: Name the tracking ref explicitly:

def fetch() -> bool:
    b = branch()
    return b != "HEAD" and git("fetch", "--quiet", "origin", f"+refs/heads/{b}:refs/remotes/origin/{b}")[0] == 0

[friction] Failure messages name the wrong cause (detached HEAD, a branch origin lacks, a refused push, a conflict)

Where: tools/swarm.py: push() discards git's stderr; cmd_claim "origin is unreachable" and "the medium kept moving"; integrate()'s "two writers met in" message

Evidence: At 767644e (these paths are unchanged at decd5ae): - Detached HEAD: brief prints medium: origin/HEAD; claim retries six times, then not acquired: tired-of-trees (the medium kept moving; readbriefagain) (git's real error: "The destination you provided is not a full refname"). - Local branch mine that origin lacks: claim -> not acquired: origin is unreachable, and a hold only exists once it is pushed (origin is reachable). Then sync -> synced (no remote branch yet), which silently creates origin/mine; after that claim tired-of-trees succeeds on mine AND on the real medium (acquired ... session c78b09 and acquired ... session 21f95f): two holders in two media, no warning. - A pre-receive hook (or missing push permission) refusing every push: 12.8 s, then the same the medium kept moving. - A real conflict in limits.conf while an unrelated new file is staged: not pushed: two writers met in: error: Your local changes to the following files would be overwritten by merge: journal/new.md ... Resolve by hand (keep both sides of a line's passes), commit, sync again: the wrong file, and no command to resolve with (the tool has aborted the merge).

Proposed fix: Add

def why_not_fetched() -> str:
    b = branch()
    if b == "HEAD":
        return "this checkout is on no branch (detached HEAD): check out the medium's branch first"
    if git("ls-remote", "--exit-code", "--heads", "origin", b)[0] == 2:
        return f"origin has no branch {b!r}: a branch nobody else is on is not a shared medium"
    return "origin is unreachable, and a hold only exists once it is pushed"

use it in claim (print(f"not acquired: {why_not_fetched()}")), and change the last message to not acquired: <id> (six pushes were refused: the medium kept moving, or origin does not accept pushes to <branch>; readbriefagain). The wrong-file message goes away with the uncommitted-overlap check of the first finding; the missing command with the message change of the second.