Skip to content

The twelve-seat cap counts pending additions atomically #222

Closed

Description

@bryantderosier

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):

  • requestMember reads the pending count (:450-457) and then inserts the proposal in a separate step, so two request_crew_member calls 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.

Activity

  1. added this to the Crews milestone on Sep 21, 2026
  2. added
    size:M
    on Sep 21, 2026
  3. added
    enhancement
    on Sep 22, 2026
  4. added 2 commits that reference this issue on Sep 23, 2026
    1a97982
    cbf8b1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementsize:M

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions