# Mission Control — Changelog

## v0.0.4

### Added
- **Gateway Data Collection Service** — Background asyncio task that polls gateway RPC endpoints and stores results in monitoring models
  - `gateway_collector.py` — GatewayCollectorService class with per-endpoint collection methods (cost, cron, session, health)
  - `models.py` — Pydantic schemas for parsing gateway RPC responses into typed Python objects
  - `__init__.py` — Package init, exports GatewayCollectorService
- **Collector startup/shutdown** — Added to main.py lifespan; launches collector as background task when gateways exist
- **Configurable collection intervals** via env vars: COLLECTION_INTERVAL_COST (300s), COLLECTION_INTERVAL_CRON (60s), COLLECTION_INTERVAL_SESSION (30s), COLLECTION_INTERVAL_HEALTH (60s)
- **Upsert pattern** — All DB writes use insert-or-update to avoid duplicate records

### Fixed
- Model FK definitions in monitoring.py and alert_rules.py: replaced `Column(UUID, ForeignKey(...))` with `Field(foreign_key=...)` to match codebase pattern
- Added missing `gateway_id` field to AlertRule model
- Removed OpenClawDBService inheritance from GatewayCollectorService (uses session factory pattern)
- Cleaned up duplicate/conflicting imports in collector

## v0.0.3

### Added
- **Phase 2: Monitoring database models** — 7 new SQLModel tables for gateway data collection
- **CostSnapshot** — Timestamped cost readings from gateway RPC (per-model, per-provider breakdown)
- **CronJobStatus** — Cron job state, schedule, failure tracking
- **SessionEvent** — Session lifecycle events with model, channel, context%, token counts
- **SubAgentRun** — Sub-agent execution records with duration, cost, token tracking
- **SystemHealthMetric** — CPU, RAM, swap, disk, gateway status metrics
- **AlertRule** — Configurable alert thresholds with comparison operators and cooldown
- **AlertEvent** — Triggered alert instances with acknowledgment and resolution tracking
- **Alembic migration 7a8b9c0d1e2f** — Creates all 7 monitoring tables with FKs and indexes
- **Alembic migration 8f9a0b1c2d3e** — Adds ON DELETE CASCADE to all FKs, SET NULL on acknowledged_by, 14 composite indexes
- **Security audit passed** — Hudson: 1 CRITICAL (CASCADE), 2 HIGH (mass assignment, indexes), 3 MEDIUM — all remediated

### Changed
- Frontend dev port changed from 3080 to 3037
- Migration env.py updated for transaction-per-migration to prevent failure chaining

## v0.0.2

### Added
- **Base platform forked and running** — Python/FastAPI backend + Next.js frontend copied into src/
- **Docker Compose dev environment** — compose.yml, .env, .dockerignore created
- **Dockerfile adapted** — Fixed build context for src/ layout, fixed scripts paths for webhook worker
- **All services operational** — db (Postgres 16), redis, backend (uvicorn :8000), frontend (Next.js :3000), webhook-worker
- **97 API endpoints verified** — Full OpenAPI surface confirmed at /docs
- **Git repo initialized** — main branch, initial commit 9aee2e4

### Infrastructure
- Ports mapped: backend → 8080, frontend → 3080 (host), avoiding Portainer/open-webui conflicts
- Auth mode: local (token-based, LOCAL_AUTH_TOKEN in .env)
- DB auto-migrate enabled

## v0.0.1

### Added
- **Project initialization** — STRUCTURE.md, PROJECT.md, FUTURE.md, HISTORY.md, DEVELOPMENT_LOG.md, VERSION.md
- **Source repos cloned** — openclaw-mission-control (base), openclaw-dashboard (tracking), openclaw-pixel-agents-dashboard (visualization)
- **Architecture plan** — Full 4-phase implementation plan documented in PROJECT.md