Repository navigation
Description
Summary
Add admin-configurable system-wide ceiling for max_parallel_tasks, plus the missing UI to let agent owners configure their per-agent value. Backend per-agent storage already exists (CAPACITY-001) but lacks (a) a UI control and (b) any system-level guard against a single agent monopolizing host compute by setting itself to the maximum.
Context
Today, max_parallel_tasks is per-agent (default 3, hardcoded range 1–10) and editable only by API (PUT /api/agents/{name}/capacity — routers/agent_config.py:404). Two gaps:
- No UI: Owners can't change capacity from agent settings — only via curl.
- No system ceiling: A single owner can set capacity to 10 on every agent they own. With dozens of agents, this saturates the host. The hardcoded 10 is arbitrary and not adjustable per-deployment (small VPS vs. 64-core box).
Need a two-tier model: admin sets the fleet-wide ceiling, owners pick within it.
Acceptance Criteria
System-level admin setting
- New system setting
max_parallel_tasks_ceiling(int, default 10) stored in existingsystem_settingstable, managed via/api/settings - Admin-only
PUT /api/settings/max-parallel-tasks-ceiling(1–32 range; reject values outside) -
PUT /api/agents/{name}/capacityvalidates against the ceiling, not the hardcoded10constant - If an existing agent's
max_parallel_tasksexceeds a newly-lowered ceiling, the slot service caps acquisitions at the ceiling at runtime (don't auto-rewrite stored values; just clamp on use)
Per-agent owner setting (UI)
- Add capacity control to agent settings panel (alongside timeout/read-only/autonomy)
- Slider or number input bounded by the current system ceiling (fetched from
/api/settings) - Show current usage (
in_use / max) inline so owners see real-time impact - Save calls
PUT /api/agents/{name}/capacity; surface 403/400 errors clearly
Admin settings UI
- Admin Settings page gets a "Fleet Capacity" section with the ceiling field
- Tooltip explains: "Maximum parallel tasks any single agent is allowed to consume on this host"
Tests
- API test: non-admin cannot set ceiling
- API test: setting per-agent capacity above ceiling returns 400
- Runtime test: lowering ceiling clamps slot acquisition for agents with stored values above the new ceiling
Technical Notes
Files to touch:
src/backend/services/settings_service.py— registermax_parallel_tasks_ceilingsettingsrc/backend/routers/settings.py— admin GET/PUT for the ceilingsrc/backend/routers/agent_config.py:432-435— replace hardcoded10withsettings_service.get_max_parallel_tasks_ceiling()src/backend/services/slot_service.py— clampmax_parallel_tasksat acquisition time against the ceilingsrc/frontend/src/views/AgentDetail.vue(or wherever timeout/autonomy settings live) — add capacity inputsrc/frontend/src/views/AdminSettings.vue— add Fleet Capacity section
Scope guard: Don't conflate this with #428 (CapacityManager refactor). That's the internal consolidation; this is the user/admin-facing controls layered on top. Both can ship independently.
Open question for design: Should there also be a per-owner aggregate cap (sum of max_parallel_tasks across all an owner's agents)? Probably overkill for now — single-agent ceiling is enough for the host-protection use case. Defer until we see it abused.
Activity
AndriiPasternak31 commentedon Jun 29, 2026
/claim
github-actions commentedon Jun 29, 2026
Claimed by @AndriiPasternak31. Label
status-in-progressadded.Next steps:
feature/506-<short-slug>Fixes #506test(capacity): drop redundant sys.modules bootstrap in #506 ceiling …
test(capacity): make #506 backlog-drain clamp test order-independent
test(capacity): resolve settings_service via sys.modules in #506 drai…
6 remaining items
feat(channels): make proactive message rate limits admin-configurable (…
feat(channels): make proactive message rate limits admin-configurable (…
fix(settings): one validated, audited write path for retention window…
feat(workspace): the session slides instead of expiring at 12 hours (…
feat(workspace): the session slides instead of expiring at 12 hours (…
feat(workspace): the session slides instead of expiring at 12 hours (…
fix(portal): the Workspace turn bound is the agent's own execution ti…
test: stub the three ent#435 settings helpers for the standalone sett…
fix(security): encrypt credential-bearing system_settings rows at res…
feat(hosting): install provenance + a first-run hardening guide gated…
feat(execution): a queued head that stops moving says so within a min…
feat(dispatch): a queued receipt says how deep, since when, and waiti…
fix(capacity): drop hardcoded cap of 10 in set_max_parallel_tasks (#4567