Repository navigation
Closed
Labels
enhancementNew feature or requestsize:M30-99 effective changed lines (test files excluded in mixed PRs).
Milestone
Description
A Crew holds at most twelve seats, counting requests still open. The count is right on the single-request path but not under concurrency or edits.
Where it breaks (apps/server/src/j5/a2a/CrewProposalService.ts):
requestMemberreads the pending count (:450-457) and then inserts the proposal in a separate step, so tworequest_crew_membercalls racing at eleven held seats both pass validation.- Approving an addition validates with
pendingSeats: 0(:624). The reservations of the proposal being approved are excluded on purpose, but every other open request is ignored too, so a person who adds seats on one addition card can push the Crew past twelve once the other open requests are approved. - A replayed request that already occupies the last free seat counts itself as pending and refuses on retry.
- The cap refusal's next step (
:207) says "let a member finish before asking for more". Finishing frees no seat; members stay on the roster until the Crew is archived.
What should change:
- Put request admission and approval expansion behind one atomic capacity decision that counts each open proposal's unfulfilled seats exactly once, including proposals whose claim is
approving, and excludes only the proposal being resolved. - A replayed request finds its existing proposal before it counts capacity.
- Reword the next step to say the Crew is full and a new Crew is the way to get more hands.
Tests to ship (CrewProposalService.test.ts, AgentCrewInstanceService.test.ts):
- two parallel requests at eleven held seats: exactly one is admitted
- approve an addition expanded by the person while another request is open: the total never exceeds twelve
- retry the request that holds seat twelve: it is not refused as a thirteenth
- a failed reserved addition is not counted twice
- keep the existing transactional actual-members cap test
Done when no interleaving of requests, edits, approvals, and retries can record a thirteenth seat or refuse a valid twelfth.
Related criteria: crews.md AC11 and the twelve-seat rule in the Definition.
Dependencies: soft, land #220 first. Stale reservations from failed retries count against the cap today, so the capacity counting here is easier to reason about and test once #220 removes them.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestsize:M30-99 effective changed lines (test files excluded in mixed PRs).
Activity
fix(crews): the twelve-seat cap is decided once, when a request is filed
fix(crews): the twelve-seat cap counts pending additions atomically (#…