←
TRCKR-277
Created: 2025-12-12
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (2)
qa-agent
·
2025-12-16
## QA PASSED
See QA report document (b77557b1-4b09-44ba-a584-ffe5b7edff6f) for full details.
**Summary:**
- All 16 required fields present in agents table
- Table correctly created only by server/database.py (not client schema)
- CHECK constraint on status field working correctly
- Default values (status=waiting, version=1) verified
- Indexes created: hostname, status, last_seen_at
- session_id field added by subsequent issue (TRCKR-293) with migration support
All requirements verified. Fix is working as intended.
agent
·
2025-12-12
Successfully added the agents table to the server database.
## Changes Made
### client/schema.py (lines 496-541)
Added the AGENTS_TABLE and AGENTS_INDEXES definitions following the same pattern as other server-only tables (sync_history, sync_snapshots):
- **Table**: agents with 16 columns matching the specification exactly
- **Indexes**: hostname, status, and last_seen_at for efficient querying
- **CHECK constraint**: status must be one of 'waiting', 'working', 'idle', 'error'
- **JSON fields**: issue_ids and capabilities stored as TEXT (JSON arrays)
- **Placement**: Added after sync_snapshots and before settings table
### server/database.py (lines 52-77)
Updated _ensure_server_tables() function to create the agents table:
- Imported AGENTS_TABLE and AGENTS_INDEXES from client.schema
- Added creation statements after sync tables
- Table is only created on server initialization, not in client databases
## Verification
✅ All existing tests pass (1204 tests)
✅ Verified agents table is created successfully with correct schema
✅ Confirmed table has all 16 required columns with correct types
✅ Verified the table is server-only (not included in client databases)
## Testing
Manually verified table creation:
```python
from server.database import init_database
store = init_database(db_path)
# Confirmed agents table exists with all 16 columns
```
The implementation follows the established patterns for server-only tables and is ready for use in Phase 1a of agent reporting.