Critical tasks for project demonstration
NEVER LEAVE TEST INCIDENTS OPEN - THEY DISTURB THE ON-CALL ENGINEER!
When testing PagerDuty:
- ALWAYS use a unique
dedup_key(e.g.,test-sky-$(date +%s)) - IMMEDIATELY resolve the incident after triggering
- Include
(TEST BY SKY)in summaries so engineers know it's a test
# Trigger test
curl -X POST https://events.pagerduty.com/v2/enqueue \
-H "Content-Type: application/json" \
-d '{"routing_key":"<KEY>","event_action":"trigger","dedup_key":"test-123","payload":{"summary":"(TEST BY SKY) Test","severity":"warning","source":"test"}}'
# IMMEDIATELY RESOLVE (same dedup_key!)
curl -X POST https://events.pagerduty.com/v2/enqueue \
-H "Content-Type: application/json" \
-d '{"routing_key":"<KEY>","event_action":"resolve","dedup_key":"test-123"}'- Fix Claude model mismatch in
kubernetes_agno_mcp.py(hardcodedclaude-sonnet-4-20250514→ use config) - Verify AI agent triggers on PagerDuty webhook receipt
- Confirm incident analysis generates proper output (7 tabs: Summary, Impact, Actions, RCA, etc.)
- Test YOLO mode execution flow (verified via SSE logs)
- Validate agent decision-making and remediation suggestions
Files to check:
backend/src/oncall_agent/agent.pybackend/src/oncall_agent/agent_enhanced.pybackend/src/oncall_agent/mcp_integrations/kubernetes_agno_mcp.pybackend/src/oncall_agent/config.py
- Verify WebSocket/SSE connection for real-time logs (fixed: SSE must connect directly to backend, not through Next.js rewrites)
- Check agent log streaming to frontend dashboard
- Confirm log entries appear in incident detail view (real-time via SSE)
- Test log persistence in database (in-memory storage working)
- Validate log format and readability
Files to check:
backend/src/oncall_agent/api/routers/agent_logs.pyfrontend/app/(dashboard)/incidents/[id]/page.tsxfrontend/components/incidents/
- Add "Send Test Event" button to frontend dashboard
- Implement Events V2 API call with test payload
- Include "(TEST BY SKY)" in summary to prevent panic
- Add visual feedback (loading, success, error states)
- Auto-resolve test incidents immediately after triggering
- Log test events separately for easy identification
- Add Node.js to Docker container for MCP server
- Fix kubeconfig mount path for appuser
- Deploy kubeconfig to production server (
/root/.kube/config) - Verify kubectl commands work through MCP
- Test pod listing, logs retrieval, deployment status
- Access to 3 EKS clusters: staging, infra-dev, infra-prod
- Test destructive operations (restart, scale) in YOLO mode
- Add K8s connection health check to dashboard
- Replace in-memory incident storage with PostgreSQL
- Migrate AI analysis results to database
- Add database connection health check
- Implement proper error handling for DB failures
Current State: PostgreSQL persistence is now working. Tables auto-created on startup.
Files modified:
backend/src/oncall_agent/api/routers/incidents.py- Uses IncidentService/AnalysisServicebackend/src/oncall_agent/api/webhooks.py- Uses database for incidents/analysisbackend/src/oncall_agent/services/incident_service.py- New database servicebackend/api_server.py- Database initialization on startup
- Add Slack webhook integration for analysis notifications
- Send notification when AI analysis completes
- Include incident summary, severity, and recommended actions
- Configure Slack webhook URL in environment variables
- Post as thread reply under PagerDuty incident message
- Concise format with cause, fixes, and report link
Status: Fully deployed and working! Slack notifications post as thread replies under PagerDuty messages.
Configuration (Production):
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/xxx
SLACK_BOT_TOKEN=xoxb-xxx
SLACK_CHANNEL_ID=C07A3NZAYSD
SLACK_CHANNEL=#oncall
SLACK_ENABLED=trueNotification Format:
🤖 AI Analysis
Cause: Out of Memory (OOM) - Pod exceeded memory limits
Recommended Fixes:
• kubectl get pods -n production --field-selector=status.phase=Failed
• kubectl rollout restart deployment api-service -n production
View Full Report (link to incident)
- Remove built-in authentication (already done)
- Verify Authentik proxy headers are being read (
dependencies.py) - Hardcoded
user_id=1are intentional fallbacks for demo/no-auth mode - Test protected endpoints work through proxy (webhooks use
get_user_from_request) - Document proxy header expectations
Status: Authentik integration is complete. Headers parsed:
X-Authentik-Username,X-Authentik-Email,X-Authentik-NameX-Authentik-Uid,X-Authentik-Groups
Falls back to demo user (id="1") when not configured.
Status: Waiting for design input from Sky. This will be done last in Phase 1.
- Complete UI redesign (all pages)
- Redesign incident list view
- Redesign incident detail page
- Redesign report download UI
- Redesign AI agent logs panel
- Redesign dashboard layout
- Mobile responsiveness
- Consistent design system
- Dark mode support (optional)
Note: Sky to provide design mockups/requirements before implementation.
- Review report generation logic
- Ensure reports include:
- Incident summary
- AI analysis results
- Actions taken (or recommended)
- Timeline of events
- Resolution status
- Test report export (JSON/Markdown) - verified via Playwright E2E
- Validate report storage and retrieval
- Connect reports to actual AI agent analysis output
- Add report generation trigger after incident resolution (optional enhancement)
- Test YOLO mode destructive operations on staging cluster
- Implement rollback safeguards
- Add K8s cluster selector for multi-cluster support
- Implement read-only vs read-write mode toggle in UI
- Add Prometheus/Grafana monitoring stack
- Create alerts for backend health
- Monitor SSE connection stability
- Track API response times
| Service | URL |
|---|---|
| Backend API | http://oncall.frai.pro:8001/api/v1/ |
| PagerDuty Webhook | http://oncall.frai.pro:8001/webhook/pagerduty |
| Health Check | http://oncall.frai.pro:8001/health |
| API Docs | http://oncall.frai.pro:8001/docs |
# Health check
curl http://oncall.frai.pro:8001/health
# Trigger test incident (Events V2 API)
curl -X POST https://events.pagerduty.com/v2/enqueue \
-H "Content-Type: application/json" \
-d '{
"routing_key": "911db5258f304f03d02feac429aad2a2",
"event_action": "trigger",
"dedup_key": "test-sky-'$(date +%s)'",
"payload": {
"summary": "(TEST BY SKY) Demo simulation - please ignore",
"severity": "warning",
"source": "dreamops-manual-test"
}
}'
# Check backend logs
ssh root@37.27.115.235 "cd /opt/dreamops && docker compose logs backend --tail=50"Migration from Direct Anthropic API to LiteLLM Proxy:
| Component | Status | Model |
|---|---|---|
agent.py |
✅ Updated | Uses OpenAI SDK with LiteLLM base_url |
agent_enhanced.py |
✅ Updated | AsyncOpenAI client |
enhanced_agent.py |
✅ Updated | AsyncOpenAI client |
kubernetes_agno_mcp.py |
✅ Updated | Agno OpenAIChat with LiteLLM |
github_agno_mcp.py |
✅ Updated | Agno OpenAIChat with LiteLLM |
agno_github_agent.py |
✅ Updated | Agno OpenAIChat with LiteLLM |
| Production Config | ✅ Deployed | gpt-4o via Azure fallback |
Configuration:
USE_LITELLM=true
LITELLM_API_BASE=https://litellm.calmdune-a4eb8421.westus.azurecontainerapps.io
LITELLM_API_KEY=sk--_QXj0LN6knTEtPI3N2StQ
CLAUDE_MODEL=gpt-4oE2E Test Results (Playwright):
- AI Analysis: ✅ Working (85% confidence, 15.27s response time)
- Model Used: gpt-4o via LiteLLM proxy
- Real-time Logs: ✅ Streaming via SSE
Backend Logs Evidence:
kubernetes_agno_mcp - INFO - Executing action: identify_oom_pods
kubernetes_agno_mcp - INFO - Query: Execute Kubernetes operation: identify_oom_pods with parameters: {'namespace': 'default', 'timeframe': '1h', 'dry_run': True}
kubernetes_agno_mcp - INFO - Executing action: increase_memory_limits
kubernetes_agno_mcp - INFO - Query: Execute Kubernetes operation: increase_memory_limits with parameters: {'namespace': 'default', 'increase_percentage': 50, 'target_deployments': 'auto-detect', 'dry_run': True}
K8s-Specific Detection:
- Alert Type:
oom_kill(correctly identified) - Resolution Actions Generated:
identify_oom_pods(95% confidence)increase_memory_limits(90% confidence)scale_deployment(75% confidence)
K8s Commands in Analysis:
kubectl get pods -n production --field-selector=status.phase=Failedkubectl patch deployment payment-service-deployment -n productionkubectl scale deployment payment-service-deployment -n production --replicas=3kubectl top pod -n production
Screenshots: .playwright-mcp/k8s-mcp-evidence.png
Settings Verified in UI:
- Mode: Approval Mode (Active)
- Confidence Threshold: 70%
- Risk Matrix: Low (5 auto), Medium (5 approval), High (5 approval)
Applied to Agent Processing:
'ai_mode': 'plan'- Confirms Approval Mode is active'auto_remediation_enabled': False- Agent respects settings- Actions generated but NOT auto-executed (per Approval Mode)
Recent Configuration Changes Audit Trail:
- "Mode changed to approval" - Just now
- "Confidence threshold updated to 70%" - 2 minutes ago
Screenshots: .playwright-mcp/ai-agents-settings-proof.png
Verified with Playwright MCP:
| Feature | Status |
|---|---|
| Remove hardcoded incidents | ✅ Working |
| Real incidents from DB | ✅ 3 incidents visible |
| AI Analysis on UI | ✅ 7 tabs displaying |
| K8s MCP integration | ✅ Alert type detected |
| JSON report download | ✅ Downloaded successfully |
| Markdown report download | ✅ Working |
| Real-time SSE streaming | ✅ Connected |
Key Fixes Applied:
frontend/app/(dashboard)/incidents/page.tsx- Relative URLs for downloadsfrontend/lib/hooks/use-agent-logs.ts- SSE stream URL fixfrontend/components/dashboard/alert-usage-card.tsx- API URL fix
Claude Model Mismatch:✅ Fixedkubernetes_agno_mcp.py:65usesclaude-sonnet-4-20250514instead of config value- Hardcoded user_id: Multiple routers have
user_id=1 # TODO: Get from auth(works with Authentik proxy) Backup files to clean:✅ Cleanedagent.py.bak,uv.lock.bakDatabase persistence: PhonePe service TODOs for database storage✅ PhonePe removed- 307 Redirect Console Errors:
/api/v1/agent/configshows redirect warnings (non-blocking)
- Show dashboard with existing incidents
- Click "Send Test Event" button
- Watch PagerDuty webhook arrive
- Show AI agent analysis in real-time logs
- Display incident report with analysis
- (Optional) Show Kubernetes remediation if connected
- Runbook integration (auto-suggest runbooks based on incident type)
- Teams notifications (in addition to Slack)
- Incident correlation (group related incidents)
- SLA tracking and alerting
- Custom remediation playbooks
- Set up proper CI/CD with staging environment
- Implement blue-green deployments
- Add rate limiting on webhook endpoints
- SSE disconnection recovery
- Learn from resolved incidents (feedback loop)
- Custom AI prompts per team/service
- Confidence threshold tuning
- Multi-language support for notifications
Last Updated: 2025-11-28