AI-powered CI failure analysis -- classifies test failures as code issues or product bugs. Supports Jenkins, Prow, and JUnit XML input.
Documentation -- configuration, API reference, integrations, and more.
An AI provider CLI must be installed and authenticated: Claude, Gemini, or Cursor. See docs for setup details.
mkdir -p data
docker run -d -p 8000:8000 -v ./data:/data \
-e JENKINS_URL=https://jenkins.example.com \
-e JENKINS_USER=your-username \
-e JENKINS_PASSWORD=your-api-token \
-e PROW_URL=https://prow.example.com \
-e GCS_BUCKET=your-gcs-bucket \
-e AI_PROVIDER=claude \
-e AI_MODEL=your-model-name \
ghcr.io/myk-org/rootcoz:latestFor Prow-only deployments, set PROW_URL and GCS_BUCKET instead of (or in addition to) Jenkins credentials. Both can also be configured per-request or via Server Settings.
| Variable | Default | Description |
|---|---|---|
MAX_CONCURRENT_AI_CALLS |
3 |
Maximum concurrent AI CLI processes. Prevents OOM with heavy models. |
MAX_CONCURRENT_AI_CALLS can be set via any of the supported interfaces:
- Environment variable:
MAX_CONCURRENT_AI_CALLS - API request field:
max_concurrent_ai_calls - CLI flag:
--max-concurrent - Config file (
~/.config/rootcoz/config.toml):max_concurrent_ai_calls
Example API override:
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"type": "jenkins", "job_name": "my-job", "build_number": 42, "max_concurrent_ai_calls": 2}'Prow analysis (requires a GCS bucket with public HTTPS read access for build artifacts):
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"type": "prow", "prow_job_name": "periodic-ci-e2e-aws", "build_id": "1234567890", "prow_url": "https://prow.ci.openshift.org", "gcs_bucket": "test-platform-results", "gcs_prefix": "logs/periodic-ci-e2e-aws/1234567890"}'Jobs can omit gcs_prefix; RootCoz auto-resolves it via prowjob.json or the Prow directory pointer (supports presubmit, postsubmit, and periodic jobs).
| Field | Env var | API / CLI | Config file |
|---|---|---|---|
prow_url |
PROW_URL |
--prow-url |
prow_url |
gcs_bucket |
GCS_BUCKET |
--gcs-bucket |
gcs_bucket |
gcs_prefix |
— | --gcs-prefix / payload |
— |
prow_job_name |
— | --job-name (prow) |
— |
build_id |
— | --build-number (prow) |
— |
- AI-Powered Failure Analysis — Classifies test failures as code issues or product bugs
- Multi-CI Support — Analyzes builds from Jenkins, Prow (GCS artifacts), or raw JUnit XML input with a unified pipeline
- Full Test Visibility — Stores and displays all test outcomes (passed, skipped, failed) from CI sources. Zero-failure jobs are handled as a fast path with no AI overhead.
- AI Token Usage Tracking — Track token consumption, costs, and duration for all AI CLI calls. Admin dashboard shows usage by provider/model/time period with CSV export.
- Public OpenAPI —
/openapi.json,/docs, and/redocare available without authentication - Sparse result fields —
GET /results/{job_id}?fields=status,result.summary,...returns only allowlisted paths (full values). Discover paths viaGET /api/results/fieldsorrootcoz results fields - Reports access flag — Non-admins need
can_view_reports(admin grant /rootcoz admin users set-can-view-reports) to call/api/reports/*androotcoz reports - Analyze-time labels — Pass
--label/-lonrootcoz analyze(orlabelsin the API / config.toml) to merge job metadata labels at submit time
rootcoz supports user-provided analysis agents that extend or customize the AI failure analysis pipeline. Agents are defined as Markdown files and are automatically discovered and executed during analysis.
- Place agent
.mdfiles in.rootcoz/agents/in your analyzed repository - When rootcoz clones the repo for analysis, it copies
.rootcoz/agents/to the workspace.pi/agents/ - The AI orchestrator loads the built-in
test-analyzeragent body as thesystem_promptfor per-group AI calls (read via thereadtool, not dispatched as a subagent) - Other project agents (non-
test-analyzer) are read via the STEP 0 hard gate before analysis begins — the AI reads each agent file using thereadtool to incorporate their guidance - To override the built-in analyzer, name your agent
test-analyzer— user agents take precedence
Create a Markdown file in .rootcoz/agents/ with YAML frontmatter:
---
name: my-analyzer
description: Brief description of what this agent does.
tools:
- read
- ls
- find
- grep
---
# My Custom Analyzer
Your agent instructions here...- Name: Must match
^[A-Za-z0-9._-]{1,64}$— prefer frontmattername:; filename stem is used as fallback when it matches the same regex - Format: Markdown file with YAML frontmatter.
name:is preferred (filename stem is the fallback when it matches the safe regex).description:andtools:are recommended — see below - Tools: Strongly recommended — list
tools: [read, ls, find, grep]in frontmatter to restrict available tools. Without this, pi may grant default builtins includingbash - Discovery: Names that don't match the regex are silently skipped (not sanitized/rewritten)
- Response (test-analyzer or overrides): Return a valid JSON object matching the
AnalysisDetailschema. Other STEP 0 agents return free-form text that gets incorporated into the analysis details:
{
"classification": "PRODUCT BUG | CODE ISSUE | INFRASTRUCTURE",
"pattern": "NEW | REGRESSION | FLAKY | INTERMITTENT | KNOWN_BUG | PERSISTENT",
"affected_tests": ["test_name_1"],
"details": "Detailed analysis text",
"artifacts_evidence": "Evidence from build artifacts"
}For CODE ISSUE, include a code_fix object. For PRODUCT BUG, include a product_bug_report object.
---
name: k8s-analyzer
description: Analyzes Kubernetes-related test failures including pod scheduling, networking, storage, and RBAC issues.
tools:
- read
- ls
- find
- grep
---
# Kubernetes Failure Analyzer
You specialize in analyzing Kubernetes-related test failures.
## Instructions
1. Read the failure details file provided by the orchestrator
2. Look for Kubernetes-specific errors (pod scheduling, resource limits, network policies)
3. Check build artifacts for kubectl logs, pod descriptions, and event dumps
4. Return your findings as free-form text (STEP 0 advisory agents are not per-group classifiers)
## Focus Areas
- Pod scheduling failures (Insufficient CPU/memory, node affinity)
- Network connectivity issues (DNS resolution, service endpoints)
- Storage provisioning failures (PVC binding, StorageClass issues)
- RBAC and security context problems- Agents are discovered from
.rootcoz/agents/*.mdfiles - The
namefield in frontmatter is preferred; filename stem is used as fallback - User agents take precedence over built-in agents with the same name
- Agent names are validated against
^[A-Za-z0-9._-]{1,64}$— non-matching names/stems are silently skipped
rootcoz ships a built-in test-analyzer agent that handles the core failure analysis. It is automatically copied to the workspace and used by the orchestrator. User agents with the same name override it.
When using orchestrated analysis (default, non-peer mode), the orchestrator AI sees ALL failure groups and can detect cross-failure patterns — correlations impossible with per-group isolation.
Patterns appear in the API response as cross_failure_patterns on the job result:
{
"cross_failure_patterns": [
{
"pattern": "15 failures share the same NFS mount timeout",
"affected_tests": ["test_a", "test_b"],
"suggested_root_cause": "NFS server infrastructure issue"
}
]
}On GET /results/{job_id}, the field lives at result.cross_failure_patterns. The frontend displays these patterns on the job report page between the summary and individual failure cards.
Note: Cross-failure patterns are only detected in orchestrated mode. When peer_ai_configs is set, the legacy per-group analysis path is used and no cross-failure patterns are generated.
uv tool install rootcoz
export ROOTCOZ_SERVER=http://localhost:8000
rootcoz health
rootcoz analyze --job-name my-job --build-number 42
rootcoz analyze --job-name my-job --build-number 42 --label Nightly -l CNV
rootcoz analyze --source prow \
--job-name periodic-ci-e2e-aws \
--build-number 1234567890 \
--prow-url https://prow.ci.openshift.org \
--gcs-bucket test-platform-results \
--gcs-prefix logs/periodic-ci-e2e-aws/1234567890
rootcoz results list
rootcoz results tests <job_id> # List test entries (passed/skipped/failed)
rootcoz admin token-usage # Summary dashboard
rootcoz admin token-usage --group-by model # Grouped breakdown
rootcoz admin token-usage --job-id <uuid> # Per-job usage
rootcoz admin token-usage --period month --format csv # CSV exportRun rootcoz --help for all commands.
| Endpoint | Description |
|---|---|
GET /api/admin/token-usage |
Aggregated token usage with filters and grouping (admin only) |
GET /api/admin/token-usage/summary |
Dashboard summary: today/week/month stats (admin only) |
GET /api/admin/token-usage/{job_id} |
Per-job token usage breakdown (admin only) |
See the API reference for all endpoints.
Users can receive browser push notifications when @mentioned in comments. The server uses VAPID for Web Push authentication.
| Variable | Description |
|---|---|
VAPID_PUBLIC_KEY |
VAPID public key (auto-generated with private key if not set) |
VAPID_PRIVATE_KEY |
VAPID private key |
VAPID_CLAIM_EMAIL |
Contact email included in VAPID claims |
Subscribe/unsubscribe is browser-only (managed via the web UI). To list users available for @mentions:
rootcoz mentionable-usersWhen deployed behind an OAuth proxy (e.g., OpenShift oauth-proxy), RootCoz can automatically identify users from the X-Forwarded-User header set by the proxy, eliminating the need for manual registration.
Set the following environment variable on the RootCoz server:
| Variable | Default | Description |
|---|---|---|
TRUST_PROXY_HEADERS |
false |
Trust X-Forwarded-User header for user identification |
Security: Only enable
TRUST_PROXY_HEADERSwhen RootCoz is behind a trusted reverse proxy that sets theX-Forwarded-Userheader. If enabled without a proxy, any client can spoof the header.
When TRUST_PROXY_HEADERS=true and X-Forwarded-User is present:
- The header value is used as the RootCoz username
- A
rootcoz_usernamecookie is automatically set so all downstream code works unchanged - The
/loginpage redirects to the dashboard (no manual registration needed) - Admin sessions and Bearer tokens still take precedence over the header
When the header is absent, the standard cookie-based registration flow is used (backward compatible).
# In your Deployment, add to the RootCoz app container (not the oauth-proxy sidecar):
env:
- name: TRUST_PROXY_HEADERS
value: "true"uv run python scripts/helm-setup.pyThe interactive setup script prompts for cluster type, hostname, AI provider, and credentials, then runs helm upgrade --install. See chart/README.md for manual install, upgrade instructions, and examples. See values.yaml for the full values reference with inline documentation.
Validate the chart with uvx --with tox-uv tox -e chart (requires Helm 3).
git clone https://github.com/myk-org/rootcoz.git
cd rootcoz
uvx --with tox-uv toxSee the development guide for full setup.
MIT