Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/hooks/detect-new-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ DOCUMENTED_TOOLS=(
"ec2-deploy"
"sno-deploy"
"payload-monitor"
"edge-ocp-ci-monitor"
"ci-tooling"
"ci-tooling/readiness-report"
"environments/lvm-operator"
Expand Down
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Edge Tooling is a multi-tool deployment and development toolkit for OpenShift an
| EC2 Watchman | `watchman/` | Automatic EC2 shutdown and weekly Slack reporting |
| SNO Deploy | `sno-deploy/` | Single Node OpenShift with DU configuration |
| Payload Monitor | `payload-monitor/` | Nightly payload health monitoring for edge topologies (SNO/TNA/TNF) |
| Edge OCP CI Monitor | `edge-ocp-ci-monitor/` | Same payload dashboard, with Chai Bot MCP investigations and data-only fallback |
| CI Tooling | `ci-tooling/` | Sippy Component Readiness and related CI helper CLIs |
| LVM Operator Environment | `environments/lvm-operator/` | Development workspace template for LVMS |
| Plugin Marketplace | `plugins/` | Claude Code plugin marketplace for OpenShift/edge workflows |
Expand All @@ -27,6 +28,7 @@ Edge Tooling is a multi-tool deployment and development toolkit for OpenShift an
- Single-node OpenShift → SNO Deploy
- LVM Operator development → LVM Operator Environment
- Monitor nightly payload health for edge topologies → Use Payload Monitor
- Monitor nightly payload health with Chai MCP analysis → Use Edge OCP CI Monitor
- Component Readiness snapshot (HA vs TNF/TNA/SNO) → CI Tooling (`ci-tooling/readiness-report`)
- Claude Code plugins for OpenShift/edge → Plugin Marketplace (`/plugin marketplace add openshift-eng/edge-tooling`)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Automation, AI skills, and deployment tools for OpenShift edge engineering. This
| Single Node OpenShift with DU config | [sno-deploy/](sno-deploy/) |
| LVM Operator development workspace | [environments/lvm-operator/](environments/lvm-operator/) |
| Nightly payload health monitoring | [payload-monitor/](payload-monitor/) |
| Nightly payload dashboard with Chai MCP analysis | [edge-ocp-ci-monitor/](edge-ocp-ci-monitor/) |
| Component Readiness triage report (HA vs edge) | [ci-tooling/readiness-report/](ci-tooling/readiness-report/) |
| Multi-repo workspace management | [workspace plugin](plugins/workspace/) via the marketplace |
| Claude Code plugins for edge workflows | [plugins/](plugins/) via the marketplace |
Expand Down Expand Up @@ -75,6 +76,7 @@ Then enable whichever plugins you need. See the [plugin README](plugins/README.m
| [watchman/](watchman/) | Stop stale EC2 instances and send weekly Slack reports |
| [sno-deploy/](sno-deploy/) | Deploy Single Node OpenShift with DU configuration |
| [payload-monitor/](payload-monitor/) | Nightly payload health monitoring for edge topologies |
| [edge-ocp-ci-monitor/](edge-ocp-ci-monitor/) | The same payload dashboard enriched by Chai Bot over MCP |
| [environments/lvm-operator/](environments/lvm-operator/) | Development workspace for the LVM Storage operator |

## CI Tools
Expand Down
8 changes: 8 additions & 0 deletions edge-ocp-ci-monitor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.venv/
reports/
__pycache__/
*.pyc
.env
.env.local
.pytest_cache/
.ruff_cache/
235 changes: 235 additions & 0 deletions edge-ocp-ci-monitor/README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions edge-ocp-ci-monitor/edge_ocp_ci_monitor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Chai-backed frontend for the shared Edge OCP payload-monitor engine."""

import sys
from pathlib import Path

# Both standalone tools live in the same checkout/image. Keep the existing
# collector package authoritative rather than maintaining a second copy.
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "payload-monitor"))
94 changes: 94 additions & 0 deletions edge-ocp-ci-monitor/edge_ocp_ci_monitor/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
"""Standalone Chai frontend over unchanged payload collector modules."""

from __future__ import annotations

import asyncio
import logging
import os
import webbrowser
from copy import deepcopy

import click
from payload_monitor import __main__ as payload_cli

from .analysis import AnalysisResult, Settings, analyze_targets, build_targets
from .collection import collect_report
from .report import generate_html, generate_json, merge_analysis_data
from .security import protect_logs

logger = logging.getLogger("edge_ocp_ci_monitor")


def _monitor_params():
params = deepcopy([param for param in payload_cli.main.params if param.name != "from_json"])
for param in params:
if param.name == "merge_analysis_path":
param.help = "Patch externally supplied analysis JSON into an existing HTML report."
return params


@click.command(name="edge-ocp-ci-monitor", params=_monitor_params())
@click.pass_context
@protect_logs(lambda *args, **kwargs: os.environ.get("CHAI_MCP_TOKEN", "").strip())
def main(ctx, **options):
"""Edge OCP CI Monitor: the payload dashboard enriched through Chai MCP.

Reads CHAI_MCP_URL and CHAI_MCP_TOKEN from the environment. Missing
configuration or unavailable AI produces a dashboard with a warning.
"""
open_browser = options.pop("open_browser", False)
output = ctx.invoke(collect_report, **options)
if output.report is None:
# Explicit --merge-analysis is a local operation, never a new AI run.
if open_browser:
webbrowser.open(output.html_path.resolve().as_uri())
return

# Do not expose SDK request details even when collector --verbose is used.
for name in ("fastmcp", "httpx", "httpcore", "httpx2", "httpcore2", "mcp"):
logging.getLogger(name).setLevel(logging.WARNING)

settings, warnings = Settings.from_environment()
for stream in output.report.streams:
for payload in stream.payloads:
for job in payload.jobs:
job.deep_analysis = None
for finding in stream.regressions:
finding.deep_analysis = None
targets = build_targets(output.report)

def save_report(partial: AnalysisResult, *, in_progress: bool = False) -> None:
merge_analysis_data(output.report, partial.data)
current_warnings = partial.dashboard_warnings
if in_progress and partial.completed < partial.requested:
current_warnings.append(
f"Chai analysis is in progress ({partial.completed}/{partial.requested} targets completed). "
"Validated results have been saved; remaining requests may still be running."
)
generate_html(output.report, output.html_path, ai_warnings=current_warnings)
if options.get("export_json"):
generate_json(output.report, output.html_path.with_suffix(".json"))

if settings is None:
analysis = AnalysisResult(
warnings=warnings, reasons=warnings.copy(),
requested=len(targets["blocking_jobs"]) + len(targets["sippy_jobs"]),
)
else:
analysis = asyncio.run(analyze_targets(
targets, settings, on_update=lambda partial: save_report(partial, in_progress=True),
))

for warning in analysis.warnings:
logger.warning("Chai AI analysis: %s", warning)
save_report(analysis)
reasons = "; ".join(f"{reason} (x{count})" for reason, count in analysis.reason_counts.items())
logger.info("Chai analysis: %s (%d/%d targets)%s", analysis.status, analysis.completed,
analysis.requested, f". Reason(s): {reasons}" if reasons else "")
logger.info("Report: %s", output.html_path.resolve())
if open_browser:
webbrowser.open(output.html_path.resolve().as_uri())


if __name__ == "__main__":
main()
Loading
Loading