The API server component of Power Fixer, providing the backend for GitHub issue triage with AI agent support. This server is the single source of truth for all agent-related state and is designed to run in Google Cloud (Cloud Run).
Quick setup guide: warpdotdev/power-fixer-setup
- Rust (install via rustup)
- PostgreSQL - Database for state management
- Warp API Key - set
WARP_API_KEYin your environment (or configure Secret Manager fallback) - (Optional) ngrok - For local development with external agent callbacks
- (Optional) gcloud CLI -
brew install google-cloud-sdkthengcloud auth login(for Secret Manager and Cloud Run workflows)
# Create the database (requires PostgreSQL running)
createdb powerfixer
# Copy and configure environment
cp .env.example .env
# Edit .env with your DATABASE_URL (default: postgres://postgres@localhost/powerfixer)# Build
cargo build --release
# Run with the helper script (optionally loads secrets from Secret Manager)
./script/server
# Or run directly
./target/release/power-fixer-server --port 3001
# With ngrok tunnel for external access
./script/server --ngrokCreate a .env file (see .env.example):
# Database connection (required)
DATABASE_URL=postgres://postgres@localhost/powerfixer
# Warp Platform API key (required for launching remote agents)
WARP_API_KEY=your_api_key
# WARP_API_BASE_URL=https://warp.dev/api/v1
# Server port (default: 3001)
POWERFIXER_CALLBACK_PORT=3001
# ngrok domain for external access (optional)
NGROK_DOMAIN=your-domain.ngrok-free.dev
# Optional Secret Manager fallback (when WARP_API_KEY is unset)
# POWERFIXER_GCP_PROJECT=your-gcp-project
# POWERFIXER_WARP_API_KEY_SECRET=powerfixer-warp-api-key
# Log level
RUST_LOG=infoPOST /api/v1/agent/launch- Launch an cloud agentGET /api/v1/agent/task/:task_id- Get task statusPOST /api/v1/agent/status- Callback endpoint for agent status updatesPOST /api/v1/agent/poll- Poll multiple task statusesDELETE /api/v1/agent/:id- Delete agent record by ID
GET /api/v1/state- Get full state for TUI syncPOST /api/v1/inbox/agent- Update agent inbox read/archived state
POST /api/v1/local-agent- Create local agent recordDELETE /api/v1/local-agent/:id- Delete local agentPATCH /api/v1/local-agent/:id/pid- Update local agent PID
POST /api/v1/triage/run- Create triage run with one or more agentsDELETE /api/v1/triage/run/:run_id- Delete triage run and linked agentsGET /api/v1/triage/excluded-issues- Get recently triaged issuesGET /api/v1/triage/summary- Get triage run summaryGET /api/v1/triage/coverage- Get triage coverage statsGET /api/v1/triage/results- Get triage results
GET /api/v1/dedupe/:agent_id- Get dedupe resultPOST /api/v1/dedupe/closure- Record dedupe closurePOST /api/v1/dedupe/:agent_id/addressed- Mark dedupe run as reviewedPOST /api/v1/dedupe/close-duplicates- Close selected duplicates in GitHub
GET /ws- WebSocket connection for real-time updatesGET /health- Health checkPOST /api/v1/issues/cache- Cache issue titlesPOST /api/v1/webhook/dedupe- Trigger dedupe from external webhook
The server has three main components:
Axum-based HTTP server handling all agent and state management operations.
Pushes real-time updates to connected TUI clients when agent states change.
Runs every 5 seconds, polling Warp's REST API for all active tasks and broadcasting state changes via WebSocket.
┌─────────────────────────────────────────┐
│ PowerFixer Server │
│ ┌─────────────┐ ┌───────────────────┐ │
│ │ REST API │ │ WebSocket Server │ │
│ └─────────────┘ └───────────────────┘ │
│ │ ▲ │
│ ▼ │ │
│ ┌─────────────────────────────────────┐│
│ │ Postgres Database ││
│ └─────────────────────────────────────┘│
│ ▲ ▲ │
│ │ │ │
│ ┌──────┴──────┐ ┌───────┴────────┐ │
│ │ Callback API│ │ Warp API Poll │ │
│ └─────────────┘ └────────────────┘ │
└─────────┬───────────────────┬───────────┘
│ │
Cloud Agents Warp REST API
docker build -t power-fixer-server .
docker run -p 3001:3001 \
-e DATABASE_URL=postgres://... \
-e WARP_API_KEY=... \
power-fixer-serverThe included Dockerfile and workflow templates can be used for Cloud Run deployment:
# Build and push to Artifact Registry
gcloud builds submit --tag us-central1-docker.pkg.dev/PROJECT_ID/power-fixer/server
# Deploy to Cloud Run
gcloud run deploy power-fixer-server \
--image us-central1-docker.pkg.dev/PROJECT_ID/power-fixer/server \
--platform managed \
--set-env-vars DATABASE_URL=... \
--set-secrets WARP_API_KEY=powerfixer-warp-api-key:latestYou can also provide WARP_API_KEY directly with --set-env-vars if you are not using Secret Manager.
The server uses PostgreSQL with the following tables:
- provider_configs - Issue provider configuration (GitHub org, etc.)
- issues - Tracked issues with external IDs and metadata
- agents - Unified agent table (fix, dedupe, triage types)
- agent_status_updates - History of agent state changes
- issue_actions - Audit log of actions taken on issues
- triage_runs - Power triage batch run metadata
- triage_run_agents - Junction table linking triage runs to agents
- triage_results - Per-issue triage evaluation results
- dedupe_runs - Dedupe analysis runs
- dedupe_duplicates - Potential duplicates found by dedupe
- dedupe_closures - Record of issues closed as duplicates
- agent_inbox_state - Read/archived status for agent inbox
- issue_inbox_state - Read/archived status for issue inbox
Migrations are in the migrations/ directory and run automatically on startup.
Agents report status via the callback API:
- Agent receives callback token at launch
- Agent makes authenticated POST to
/api/v1/agent/status:
{
"state": "IN_PROGRESS",
"summary": "Investigating issue...",
"branch_name": "fix/issue-123",
"pr_url": "https://github.com/...",
"session_url": "https://..."
}- Server updates DB and broadcasts via WebSocket
Note: Agents use a Python script for callbacks (not curl) due to environment restrictions on some runner machines.
Internal development continues in private repositories. The open-source repository mirrors selected releases and changes.