fix(ci): remove stale AutomationLevel refs from benchmarks and prevent ANSI in JSON output
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 41s
CI / integration_tests (pull_request) Successful in 2m12s
CI / benchmark-regression (pull_request) Failing after 2m23s
CI / unit_tests (pull_request) Successful in 8m11s
CI / docker (pull_request) Successful in 38s
CI / coverage (pull_request) Successful in 16m56s

- Remove AutomationLevel imports from cli_robot_flow_bench.py and
  persistence_robot_bench.py (enum was removed by master's automation
  refactor); replace with AutomationProfileRef where needed.
- Use typer.echo() instead of console.print() for machine-readable
  output (JSON/YAML/plain) in config.py and session.py to prevent
  Rich from injecting ANSI escape codes that corrupt json.loads().
- Set NO_COLOR=1 in noxfile unit_tests, integration_tests, and
  coverage_report sessions as a belt-and-suspenders safeguard for
  all CLI commands that route format_output through Rich.
This commit is contained in:
2026-02-20 21:46:46 +00:00
parent cb96af7286
commit 56c38a04ce
5 changed files with 17 additions and 11 deletions
-3
View File
@@ -26,7 +26,6 @@ try:
InMemoryChangeSetStore,
)
from cleveragents.domain.models.core.plan import (
AutomationLevel,
AutomationProfileProvenance,
AutomationProfileRef,
NamespacedName,
@@ -48,7 +47,6 @@ except ModuleNotFoundError:
InMemoryChangeSetStore,
)
from cleveragents.domain.models.core.plan import (
AutomationLevel,
AutomationProfileProvenance,
AutomationProfileRef,
NamespacedName,
@@ -107,7 +105,6 @@ def _mock_plan(
action_name="local/bench-lifecycle-action",
phase=phase,
processing_state=state,
automation_level=AutomationLevel.MANUAL,
project_links=[ProjectLink(project_name="proj-bench")],
arguments={"target_coverage": 80},
arguments_order=["target_coverage"],
+6 -2
View File
@@ -22,7 +22,8 @@ from cleveragents.domain.models.core.action import (
ArgumentType,
)
from cleveragents.domain.models.core.plan import (
AutomationLevel,
AutomationProfileProvenance,
AutomationProfileRef,
NamespacedName,
Plan,
PlanIdentity,
@@ -90,7 +91,10 @@ def _make_bench_plan(
description="Robot bench plan",
phase=PlanPhase.ACTION,
processing_state=ProcessingState.QUEUED,
automation_level=AutomationLevel.MANUAL,
automation_profile=AutomationProfileRef(
profile_name="trusted",
provenance=AutomationProfileProvenance.PLAN,
),
strategy_actor="local/strat",
execution_actor="local/exec",
project_links=[ProjectLink(project_name="local/proj-bench")],
+5
View File
@@ -359,6 +359,9 @@ def unit_tests(session: nox.Session):
]
session.env["PYTHONPATH"] = str(Path("src").resolve())
# Prevent Rich from injecting ANSI escape codes into machine-readable
# CLI output (JSON/YAML) which causes json.loads() failures on CI.
session.env["NO_COLOR"] = "1"
session.run(*args)
@@ -399,6 +402,7 @@ def integration_tests(session: nox.Session):
"""
session.install("-e", ".[tests]")
session.env["CLEVERAGENTS_AUTO_APPLY_MIGRATIONS"] = "true"
session.env["NO_COLOR"] = "1"
# Override PYTHONPATH so the editable install (src/) for this project
# is used instead of any inherited PYTHONPATH from the outer environment.
session.env["PYTHONPATH"] = "src"
@@ -496,6 +500,7 @@ def coverage_report(session: nox.Session):
os.makedirs("build", exist_ok=True)
session.env["PYTHONPATH"] = str(Path("src").resolve())
session.env["NO_COLOR"] = "1"
session.env["COVERAGE_RCFILE"] = "pyproject.toml"
session.env["COVERAGE_FILE"] = "build/.coverage"
# Tell behave-parallel workers to run under coverage --parallel-mode
+3 -3
View File
@@ -259,7 +259,7 @@ def config_set(
}
if fmt != OutputFormat.RICH.value:
console.print(format_output(result, fmt))
typer.echo(format_output(result, fmt))
return
prev_display = str(previous) if previous is not None else "(unset)"
@@ -313,7 +313,7 @@ def config_get(
for entry in result["resolution_chain"]:
if hasattr(entry.get("value"), "__fspath__"):
entry["value"] = str(entry["value"])
console.print(format_output(result, fmt))
typer.echo(format_output(result, fmt))
return
console.print(
@@ -428,7 +428,7 @@ def config_list(
for entry in settings_list:
if hasattr(entry["value"], "__fspath__"):
entry["value"] = str(entry["value"])
console.print(format_output(settings_list, fmt))
typer.echo(format_output(settings_list, fmt))
return
table = Table(title=f"Configuration ({len(settings_list)} settings)")
+3 -3
View File
@@ -142,7 +142,7 @@ def create(
data = _session_summary_dict(session)
if fmt != OutputFormat.RICH.value:
console.print(format_output(dict(data), fmt))
typer.echo(format_output(dict(data), fmt))
return
details = (
@@ -186,7 +186,7 @@ def list_sessions(
data = _session_list_dict(sessions)
if fmt != OutputFormat.RICH.value:
console.print(format_output(data, fmt))
typer.echo(format_output(data, fmt))
return
# Rich table
@@ -240,7 +240,7 @@ def show(
data = session.as_cli_dict()
if fmt != OutputFormat.RICH.value:
console.print(format_output(dict(data), fmt))
typer.echo(format_output(dict(data), fmt))
return
# Session summary panel