←
TRCKR-327
Created: 2025-12-12
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2025-12-12
Implemented 5-minute agent timeout detection.
Changes made:
1. server/routes/web.py (lines 168-230): Updated get_agent_status_for_issues() to check if agent last_seen_at is > 5 minutes old and return 'stopped' status instead of the reported status.
- Added AGENT_TIMEOUT_SECONDS constant (5 minutes)
- Check time_since_seen against timeout before using agent status
- Updated docstring to include 'stopped' status
2. server/routes/agents.py (line 222): Updated agent_to_response() to calculate is_stopped field
- Added is_stopped check for > 5 minutes
- Included is_stopped in AgentResponse object
3. server/models.py (line 444): Added is_stopped field to AgentResponse model
- Boolean field set to True if agent not seen in > 5 minutes
- Placed before is_stale and is_very_stale for logical ordering
4. server/templates/partials/agents_table.html (lines 37-40): Added 'stopped' status display in agents table
- Red stop-circle icon with 'Not seen in 5+ minutes' tooltip
- Checked before working/waiting/halted statuses
5. server/templates/partials/issues_table.html (lines 136-137, 52): Added 'stopped' status to issues table
- Red stop-circle icon with 'Agent stopped (5+ min)' tooltip
- Added 'stopped' to agent status filter dropdown
The timeout logic now works as follows:
- Agents with last_seen > 5 minutes: shown as 'stopped' (red stop-circle)
- Agents with last_seen 5 min - 24 hours: shown with their actual status (working/waiting/halted)
- Agents with last_seen > 24 hours: shown as 'stale' with their actual status + clock icon
- Agents with last_seen > 7 days: shown as 'very stale' with warning icon, or filtered out entirely
Tests passing:
- All agent detection tests passed (29 tests)
- All stale agent tests passed (7 tests)
- Deployed successfully to trckr.roboalch.com
The 5-minute threshold provides a clear visual indicator when an agent has stopped reporting, helping users quickly identify which agents are no longer actively running.