Skip to content

feat(capacity): admin-configurable system-wide ceiling + agent-settings UI for max_parallel_tasks #506

Closed

Description

@vybe

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:

  1. No UI: Owners can't change capacity from agent settings — only via curl.
  2. 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 existing system_settings table, managed via /api/settings
  • Admin-only PUT /api/settings/max-parallel-tasks-ceiling (1–32 range; reject values outside)
  • PUT /api/agents/{name}/capacity validates against the ceiling, not the hardcoded 10 constant
  • If an existing agent's max_parallel_tasks exceeds 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 — register max_parallel_tasks_ceiling setting
  • src/backend/routers/settings.py — admin GET/PUT for the ceiling
  • src/backend/routers/agent_config.py:432-435 — replace hardcoded 10 with settings_service.get_max_parallel_tasks_ceiling()
  • src/backend/services/slot_service.py — clamp max_parallel_tasks at acquisition time against the ceiling
  • src/frontend/src/views/AgentDetail.vue (or wherever timeout/autonomy settings live) — add capacity input
  • src/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

  1. added
    priority-p2
    type-feature
    on Apr 25, 2026
  2. added
    complexity-medium
    theme-reliability
    on Jun 3, 2026
  3. added
    status-incubating
    status-ready
    and removed
    status-incubating
    on Jun 14, 2026
  4. AndriiPasternak31 commented on Jun 29, 2026

    @AndriiPasternak31
    Contributor

    /claim

  5. added
    status-in-progress
    on Jun 29, 2026
  6. github-actions commented on Jun 29, 2026

    @github-actions

    Claimed by @AndriiPasternak31. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/506-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #506
  7. 6 remaining items

  8. removed
    status-in-dev
    status-ready
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

complexity-mediumpriority-p2theme-reliabilitytype-feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions