Skip to content

Refactor/cli telemetry and metrics#6

Merged
416rehman merged 20 commits intomainfrom
refactor/cli-telemetry-and-metrics
Apr 16, 2026
Merged

Refactor/cli telemetry and metrics#6
416rehman merged 20 commits intomainfrom
refactor/cli-telemetry-and-metrics

Conversation

@416rehman
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 23:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors CLI logging/stats output and improves run interruption persistence, aiming to make telemetry/metrics and state reporting more robust during CLI usage and forced shutdowns.

Changes:

  • Updates CLI log formatting to use Rich markup and consistent short-name prefixes.
  • Expands CLI commands to load .env (when available) and improves pipeline-load error handling in status.
  • Persists run/manifest state on forced shutdown (second Ctrl+C) and enhances status stage stats rendering.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
src/deepzero/engine/runner.py Tracks active run/sample state and attempts to persist state during forced shutdown.
src/deepzero/cli.py Reworks logging formatter/handler setup, adds env loading for more commands, and adjusts status stats rendering.
README.md Restructures Quickstart steps and removes the dedicated Installation section.
.env.example Adds Vertex AI-related environment variable placeholders.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/deepzero/cli.py Outdated
Comment on lines +47 to +64
msg = super().format(record)
from rich.markup import escape

msg_escaped = escape(msg)

colors = [
"cyan",
"magenta",
"green",
"yellow",
"bright_cyan",
"bright_magenta",
"bright_green",
"bright_yellow",
]
import zlib

color = colors[zlib.crc32(short.encode("utf-8")) % len(colors)]
Comment thread src/deepzero/cli.py
Comment on lines 233 to +240
if work_dir:
work_path = Path(work_dir)
elif pipeline:
import deepzero.stages # noqa: F401
from deepzero.engine.pipeline import load_pipeline

_setup_logging(False)
pipeline_def = load_pipeline(pipeline)
_load_env()
Comment thread src/deepzero/cli.py Outdated
Comment on lines +469 to +493
per_stage: dict[str, dict[str, int]] = {}

if manifest:
for entry in manifest:
history = entry.get("history", {})
for stage_name, stage_data in history.items():
if stage_name not in per_stage:
per_stage[stage_name] = {"completed": 0, "filtered": 0, "failed": 0}

st = stage_data.get("status")
vd = stage_data.get("verdict")

if st == "failed":
per_stage[stage_name]["failed"] += 1
elif st == "filtered" or (st == "completed" and vd == "filter"):
per_stage[stage_name]["filtered"] += 1
elif st == "completed":
per_stage[stage_name]["completed"] += 1

# merge active stats with disk cache for accuracy
cached_stats = run_state.stats.get("per_stage", {})
for sn, sdata in cached_stats.items():
if sn not in per_stage:
per_stage[sn] = sdata

Comment thread src/deepzero/engine/runner.py Outdated
Comment on lines +842 to +844
from deepzero.engine.types import RunStatus

self._active_run_state.status = RunStatus.INTERRUPTED
Comment on lines +841 to +849
if hasattr(self, "_active_run_state") and getattr(self, "_active_run_state", None):
from deepzero.engine.types import RunStatus

self._active_run_state.status = RunStatus.INTERRUPTED
self.state_store.save_run(self._active_run_state)
if hasattr(self, "_active_sample_states") and getattr(
self, "_active_sample_states", None
):
self.state_store.save_manifest(list(self._active_sample_states.values()))
Comment thread README.md
Comment on lines +57 to +61
If you intend to use the AI analysis stages, configure your API keys by creating a `.env` file from the provided layout:
```bash
cp .env.example .env
```

416rehman added 4 commits April 16, 2026 19:13
…hman/DeepZero-Agentic-Vulnerability-Research-Pipeline into refactor/cli-telemetry-and-metrics

# Conflicts:
#	README.md
@416rehman 416rehman merged commit e8ad253 into main Apr 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants