You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tree: a burst of two same-name same-role calls names that Bot twice in the lead's role text #840
Two create_child_bot calls that are in flight at the same time with the same name and the same role become one lead with one child — and that lead's role text says the name twice: Lead of the FlyBot group: coordinates FlyBot Programmer, FlyBot Programmer.
Why (main be48393b)
A burst takes one seat per call and marks the seats that share a key as a group: plugins/tree/src/allocate.js:125-136. The group's names are collected straight from the seats — seats.filter(o => o.key === key).map(o => o.name) (:135) — so two calls named the same contribute the name twice.
Those names are handed to the one shared lead as memberNames (:204 → createLead), and createLead writes them into the lead's role text verbatim: Lead of the ${label} group: coordinates ${memberNames.join(', ')}. (plugins/tree/src/organize.js:173).
The child itself is not duplicated: the second call reaches planChild and finds the Bot the first one made, so it reuses it (allocate.js:98, :213-214). Result: one child, a role text naming it twice.
This is not #819. #819 stopped a call from taking a seat when it would reuse an already existing Bot (:120-124). Here both calls do create work and both seats are real; they only collapse into one Bot later, in the reuse branch.
Acceptance criteria
Two concurrent create_child_bot calls from one caller with the same name and same role produce: one member Bot, one lead, and a lead role text in which that name appears once (coordinates FlyBot Programmer.), with the group label unchanged.
A burst whose members have different names still lists every name once, in seat order — deduping must not drop a member that was not reused.
Negative control: with the dedupe removed, the new case fails on the duplicated name only — the created-Bot count and the child count in the same test stay correct, so the test cannot pass for the wrong reason.
Kill conditions — do not:
dedupe by role text or by a mangled name (use the same normalisation the reuse check uses, norm(name));
change how seats are counted, or drop a seat before the reuse decision (planChild) has run;
Claiming #840. Branch fix/840-burst-duplicate-name, cut from 153d5d45.
The dedupe goes where the names become the lead's roster, not where the seats are counted: createChild still decides "is this a group" by the calls that took a seat, and the list handed to joinGroup is deduped by norm(name), the same normalisation the reuse check uses. So two same-name same-role calls stay one group with one lead, and that lead names the Bot once. A burst with different names is unchanged: every name appears once, in seat order. No seat is dropped before planChild runs, and nothing makes the two calls create two Bots.
A note on the fixture: the reuse happens exactly as the issue says — the second call reaches planChild and finds the Bot the first one made — so the case keeps one member and one lead with and without the fix, and fails on the duplicated name alone.
Activity
Birfy commentedon Oct 23, 2026
Written-by: Dev
Claiming #840. Branch
fix/840-burst-duplicate-name, cut from153d5d45.The dedupe goes where the names become the lead's roster, not where the seats are counted:
createChildstill decides "is this a group" by the calls that took a seat, and the list handed tojoinGroupis deduped bynorm(name), the same normalisation the reuse check uses. So two same-name same-role calls stay one group with one lead, and that lead names the Bot once. A burst with different names is unchanged: every name appears once, in seat order. No seat is dropped beforeplanChildruns, and nothing makes the two calls create two Bots.A note on the fixture: the reuse happens exactly as the issue says — the second call reaches
planChildand finds the Bot the first one made — so the case keeps one member and one lead with and without the fix, and fails on the duplicated name alone.