Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneesstack72

Relationships

#1431 Concurrent @type auto-creation races: N simultaneous runs create N definitions sharing one name, and only one is reachable

Opened by vcjdeboer · 7/27/2026· Shipped 7/27/2026

Concurrent method runs that auto-create a definition via the @type prefix do not converge on one definition. N simultaneous runs against the same name create N definitions, each with its own UUID and its own data. Name lookup then resolves to one of them; the rest are unreachable by name.

No data is lost on disk. It becomes invisible.

Environment

  • swamp 20260727.000815.0-sha.db74fcac
  • macOS 15 (darwin-aarch64)

Reproduce

With any model type registered, and no existing definition named racy:

for i in 1 2 3 4; do
  swamp model @me/some-type method run observe racy &
done
wait

Observed

Four definitions are created, all named racy:

name=racy id=cbc19fe3-d476-481f-b027-fc9930b3c43e
name=racy id=c3e12b04-4323-49c5-9113-95379e7a6786
name=racy id=5872c095-0991-422d-b34b-9c464eb2c0dd
name=racy id=e932142d-4a1e-42b6-b670-78b924b63b47

All four executed and wrote data. Each UUID has its own data directory containing the resource plus its method-summary reports:

$ ls .swamp/data/@me/some-type/
cbc19fe3-d476-481f-b027-fc9930b3c43e/   reading  report-swamp-method-summary  report-swamp-method-summary-json
c3e12b04-4323-49c5-9113-95379e7a6786/   reading  report-swamp-method-summary  report-swamp-method-summary-json
5872c095-0991-422d-b34b-9c464eb2c0dd/   reading  report-swamp-method-summary  report-swamp-method-summary-json
e932142d-4a1e-42b6-b670-78b924b63b47/   reading  report-swamp-method-summary  report-swamp-method-summary-json

Name-based retrieval returns exactly one of them, with no indication that others exist:

$ swamp data list racy
resource (1 item):
  reading  v1  application/json  450B

$ swamp data get racy reading --json
{"modelId":"cbc19fe3-d476-481f-b027-fc9930b3c43e","version":1}

$ swamp model get racy --json
{"id":"cbc19fe3-d476-481f-b027-fc9930b3c43e","name":"racy","type":"@me/some-type"}

Three of the four runs' outputs are on disk and cannot be reached through any name-based command.

Separately, none of the four appear in swamp model list on this build:

$ swamp model list          # lists only definitions under models/
atom2  [@me/atomicity-probe]
atom   [@me/atomicity-probe]
atom3  [@me/atomicity-probe]
...                          # no `racy`

So there is no name-based or listing-based surface on which the duplicates are visible. Finding them requires walking .swamp/auto-definitions/ directly.

Expected

Concurrent auto-creation of the same name converges on a single definition — either by creating it once and having the other runs adopt it, or by failing the losers explicitly. A silent fan-out into N same-named definitions makes the extra runs' data unreachable through the interfaces that address models by name.

  • #1370 (shipped) — model search/list not enumerating .swamp/auto-definitions/. The listing behaviour above is reported as observed on 20260727.000815.0-sha.db74fcac, not as a claim about that fix. The race itself is independent of enumeration: even with the duplicates listed, four definitions would share one name.
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 4 MOREPR_MERGED+ 1 MORECONTRIBUTOR_NOTIFIED

Shipped

7/27/2026, 7:36:28 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack727/27/2026, 4:10:22 PM
Editable. Press Enter to edit.

stack72 commented 7/27/2026, 7:36:37 PM

Thanks @vcjdeboer for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.