Skip to content
Open
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
33 changes: 32 additions & 1 deletion rdagent/app/CI/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
Feedback,
Knowledge,
)
from rdagent.core.experiment import Task
from rdagent.core.prompts import Prompts
from rdagent.core.scenario import Scenario
from rdagent.oai.llm_utils import APIBackend

py_parser = Parser(Language(tree_sitter_python.language()))
Expand Down Expand Up @@ -428,6 +430,35 @@ def evaluate(self, evo: Repo, **kwargs: dict) -> CIFeedback:
return CIFeedback(errors=all_errors)


class CIScen(Scenario):
"""Minimal scenario for the CI linting workflow.

`EvolvingStrategy` requires a `Scenario` instance, but the CI run loop only
needs the lint-rule prompts in `CI_prompts` — it never inspects scenario
state. The descriptions below are kept short and CI-specific so the
`Scenario` API contract is honoured without dragging in unrelated config.
"""

@property
def background(self) -> str:
return "Automated code-quality repair loop driven by ruff/mypy diagnostics."

@property
def rich_style_description(self) -> str:
return "[bold]RD-Agent CI[/bold]: iteratively fix lint and type errors."

def get_scenario_all_desc(
self,
task: Task | None = None,
filtered_tag: str | None = None,
simple_background: bool | None = None,
) -> str:
return self.background

def get_runtime_environment(self) -> str:
return ""


class CIEvoStr(EvolvingStrategy):
def evolve( # noqa: C901, PLR0912, PLR0915
self,
Expand Down Expand Up @@ -726,7 +757,7 @@ def multistep_evolve(self, evo: Repo, eva: Evaluator) -> Repo:
repo = Repo(DIR, excludes=excludes)
# evaluator = MultiEvaluator(MypyEvaluator(), RuffEvaluator())
evaluator = RuffEvaluator()
estr = CIEvoStr()
estr = CIEvoStr(scen=CIScen())
ea = CIEvoAgent(estr)
ea.multistep_evolve(repo, evaluator)
while True:
Expand Down
Loading