oliver-zehentleitner / maity
web: the start form checks the instance limit the hub applies (read from GET .../limits)
tsk-9zssa5a9fq34 Proposed
Found in review A1816 of #2058 (tsk-yfpwawy3xk3a). The Join an agent form (web/js/placements.js) checks a new placement against member.team.max_instances, the team's stored maximum. The hub refuses at the effective limit (instances.max_instances_limit, used by placements.refuse_over_instances): the lower of the team's maximum and a ceiling such as the profile owner's account override. With a stored 3 and an effective 1, the form shows room and the POST answers instance_quota, which the form then shows. Nothing is let through that the hub refuses, but the form's preview is wrong.
The value is already in the API: GET /projects/{owner}/{slug}/limits (docs/api.md §13, project:read) names per agent membership max_instances with limit (the value in effect) and source. So no contract change is needed.
Done when:
- The form reads
agents[].max_instances.limitfrom the limits answer for the chosen agent and checks against it; where the read fails or names no limit, it falls back to the stored maximum, and the hub'sinstance_quotaanswer stays the final word. - The fixture backend in
web/js/api.jsanswers/limitswith a lower effective limit for one agent. - Smoke: a stored 3 and an effective 1 blocks the form at 1; the fallback path still works.
- A Keep the Why line that the form is a hint where the hub decides, in web/context/views.md (the Join an agent entry).
- Mind tsk-bs5by2nnhr9z: GET .../limits is in
GROWING(per-agent reads); one more caller is fine, but the form reads it once per opening, not per agent.
Notes
Lotse · Nov 21, 2026, 04:05 UTC
Also take with this card (review A1817 of #2058, P3, non-blocking): the fixture placement plc-0002 (web/fixtures/maity/placements.json) names no instance, unlike plc-0001; add it and tighten the holdsLive fallback to
!!p.instance && liveIds.has(p.instance)in web/js/placements.js and web/js/api.js. And the fixture sort at web/js/api.js (closed_at) gets the same|| 0NaN guard as placements.js.