Spaces:
Sleeping
Regional Access Fix - Agents Can Work Across Regions
Problem
The initial implementation blocked agents from picking tickets outside their assigned region:
{
"available_actions": [],
"message": "Ticket not in your assigned region"
}
This was too restrictive for real-world scenarios.
Business Reality
In real ISP field operations:
- Agents need to earn a living
- Agents go where the work is
- Agents don't wait for work to come to their region
- Regional assignment is for preference/filtering, not access control
Solution
Removed regional restrictions from:
ticket_action_service.py- Removed region check in action calculatorticket_assignment_service.py- Removed_validate_agent_region_match()call- API documentation - Updated to reflect no regional restrictions
What Changed
Before
# Check region match
if team_member.project_region_id is None:
can_pick = True
elif team_member.project_region_id == ticket.project_region_id:
can_pick = True
else:
message = "Ticket not in your assigned region"
After
# Agent can pick any ticket in their project (no regional restriction)
# Region is just for filtering, not access control
actions = [
{"action": "pick", "label": "Pick Ticket", "type": "primary"}
]
How Region Works Now
Region field is used for:
- Filtering tickets by location
- Showing agent's preferred/primary region
- Analytics and reporting
- Route optimization suggestions
Region field is NOT used for:
- ❌ Blocking access to tickets
- ❌ Preventing self-assignment
- ❌ Restricting which tickets agents can see
Example Scenario
Agent Profile:
- Name: John
- Primary Region: Nairobi East
- Project: SwiftNet Fiber
Tickets Available:
- Ticket A: Nairobi East (his region)
- Ticket B: Nairobi West (different region)
- Ticket C: Mombasa (different city)
Result: John can pick all three tickets because they're all in his project.
Why? John might live near the border of Nairobi West, or he might be willing to travel to Mombasa for a high-value installation. The system shouldn't block him from earning.
Frontend Impact
No changes needed in frontend. The available_actions array will now include the "pick" action for all tickets in the agent's project, regardless of region.
Testing
After this fix, agents should see:
{
"available_actions": [
{
"action": "pick",
"label": "Pick Ticket",
"type": "primary"
}
],
"message": "Available for pickup"
}
For any open ticket in their project, as long as:
- They're on the project team
- They have capacity (< 4 active tickets)
- Ticket is not already assigned
Files Modified
src/app/services/ticket_action_service.py- Removed region checksrc/app/services/ticket_assignment_service.py- Removed region validationsrc/app/api/v1/ticket_assignments.py- Updated documentationdocs/agent/frontend/TICKET_ACTIONS_SYSTEM.md- Added note about no restrictionsdocs/agent/implementation-notes/TICKET_ACTIONS_IMPLEMENTATION.md- Updated testing checklist
Migration
No database migration needed. This is a business logic change only.
Backward Compatibility
Fully backward compatible. Existing assignments are not affected. Only changes how new tickets can be picked.