Skip to content

feat(capacity): per-agent ticket capacity tracking#66

Merged
mpge merged 1 commit into
mainfrom
feat/agent-capacity
Jun 25, 2026
Merged

feat(capacity): per-agent ticket capacity tracking#66
mpge merged 1 commit into
mainfrom
feat/agent-capacity

Conversation

@mpge

@mpge mpge commented Jun 25, 2026

Copy link
Copy Markdown
Member

Ports agent capacity from the Laravel reference, continuing the cross-backend parity sweep. (WordPress was one of two backends still missing this domain.)

What

  • AgentCapacity model + table (escalated_agent_capacity via dbDelta): per agent, per channel — a configurable max_concurrent ceiling (default 10) and a running current_count, unique on (user_id, channel). Pure has_capacity() / load_percentage() helpers plus $wpdb CRUD, find_or_create(), and increment() / decrement() (never below zero).
  • CapacityService — mirrors the Laravel CapacityService: can_accept_ticket(), increment_load(), decrement_load(), all_capacities().

Verification

  • php -l clean on all files.
  • vendor/bin/pint --test (the lint CI gate) passes on all changed files.
  • New Test_Capacity_Service — pure tests for has_capacity / load_percentage + a live-wpdb flow test (fill to ceiling → blocked → release → free; decrement floors at zero). Runs in CI against the WP test harness.
  • New dbDelta block copies the exact format of the existing tables.

Port agent capacity from the Laravel reference. Adds an AgentCapacity
model + table (per agent, per channel: a configurable max_concurrent
ceiling and a running current_count, unique on user_id+channel) with pure
has_capacity / load_percentage helpers, and a CapacityService that creates
rows on demand (default ceiling 10) and increments/decrements load, plus
can_accept_ticket() so routing can avoid overloading agents.
@mpge mpge merged commit f6586c1 into main Jun 25, 2026
3 checks passed
@mpge mpge deleted the feat/agent-capacity branch June 25, 2026 03:15
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.

1 participant