Skip to content

fix(quota): exempt admins from agent quota and add per-role limits (#274) - #275

Merged
vybe merged 3 commits into
mainfrom
feature/274-per-role-agent-quota
Apr 7, 2026
Merged

fix(quota): exempt admins from agent quota and add per-role limits (#274)#275
vybe merged 3 commits into
mainfrom
feature/274-per-role-agent-quota

Conversation

@vybe

@vybe vybe commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix: Admin users are now exempt from agent creation quotas (was incorrectly blocking admins)
  • Feature: Per-role quota configuration via Settings UI (admin=unlimited, creator=10, operator=3, user=1 defaults)
  • Improvement: Quota exceeded error now shows current/max agent counts

Changes

  • src/backend/services/settings_service.py — Added get_agent_quota_for_role() helper with per-role defaults and legacy fallback
  • src/backend/services/agent_service/crud.py — Use per-role quota check instead of global setting
  • src/backend/services/agent_service/deploy.py — Same per-role quota check for deploy-local path
  • src/backend/routers/settings.py — Added GET/PUT /api/settings/agent-quotas endpoints
  • src/frontend/src/views/Settings.vue — Added Agent Quotas section with per-role inputs
  • src/frontend/src/components/CreateAgentModal.vue — Better QUOTA_EXCEEDED error display
  • tests/test_agent_quota.py — Updated tests for admin exemption and per-role configuration

Test Plan

  • All 13 quota tests pass (pytest test_agent_quota.py -v)
  • Admin user can create agents past any quota limit
  • GET /api/settings/agent-quotas returns per-role config with defaults
  • PUT /api/settings/agent-quotas persists per-role limits
  • Negative quota values rejected with 400
  • Legacy max_agents_per_user still works as fallback
  • Redeploy bypass still works

Closes #274

Generated with Claude Code

vybe and others added 3 commits April 7, 2026 12:27
)

Admin users were incorrectly blocked by the global max_agents_per_user
quota. Now admins are always exempt, and quotas are configurable per role
(creator=10, operator=3, user=1 defaults) via Settings UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent quota applies to admins and lacks per-role configuration

1 participant