evoloop-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- evoloop_cli/__init__.py +3 -0
- evoloop_cli/__main__.py +10 -0
- evoloop_cli/_skills/evoloop-constitution/SKILL.md +59 -0
- evoloop_cli/_skills/evoloop-constitution/references/writing-guide.md +89 -0
- evoloop_cli/_skills/evoloop-constitution/templates/config.yaml +52 -0
- evoloop_cli/_skills/evoloop-constitution/templates/constitution.md +39 -0
- evoloop_cli/_skills/evoloop-evaluate/SKILL.md +85 -0
- evoloop_cli/_skills/evoloop-evaluate/schemas/parsed_report.schema.json +170 -0
- evoloop_cli/_skills/evoloop-evaluate/scripts/parse_junit_report.py +311 -0
- evoloop_cli/_skills/evoloop-evaluate/scripts/parse_pytest_report.py +276 -0
- evoloop_cli/_skills/evoloop-evaluate/scripts/parse_report.py +101 -0
- evoloop_cli/_skills/evoloop-evaluate/scripts/update_eval_index.py +111 -0
- evoloop_cli/_skills/evoloop-evaluate/scripts/validate_parsed_report.py +178 -0
- evoloop_cli/_skills/evoloop-evaluate/templates/analysis.md +51 -0
- evoloop_cli/_skills/evoloop-evaluate/templates/progress.md +42 -0
- evoloop_cli/_skills/evoloop-evaluate/templates/tasks.md +34 -0
- evoloop_cli/_skills/evoloop-evolve/SKILL.md +76 -0
- evoloop_cli/_skills/evoloop-evolve/scripts/evolve_state.py +333 -0
- evoloop_cli/_skills/evoloop-implement/SKILL.md +57 -0
- evoloop_cli/_skills/evoloop-implement/scripts/check_scope.py +154 -0
- evoloop_cli/_skills/evoloop-implement/scripts/commit_section.py +78 -0
- evoloop_cli/_skills/evoloop-init/SKILL.md +95 -0
- evoloop_cli/_skills/evoloop-init/scripts/scaffold_evals.py +546 -0
- evoloop_cli/_skills/evoloop-init/templates/common/evals/datasets/domain_flows.yaml +33 -0
- evoloop_cli/_skills/evoloop-init/templates/common/evaluations/README.md +9 -0
- evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/AgentAdapter.java +13 -0
- evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/AgenticFlowEvalTest.java +71 -0
- evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/DeterministicEvaluators.java +174 -0
- evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/EvalFrameworkTest.java +45 -0
- evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/FlowRunResult.java +25 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/__init__.py +1 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/adapter.py +63 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/deepagents_adapter.py +223 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/evaluators/__init__.py +1 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/evaluators/deterministic.py +234 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/evaluators/llm_judge.py +189 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/fakes.py +26 -0
- evoloop_cli/_skills/evoloop-init/templates/python/evals/harness.py +100 -0
- evoloop_cli/_skills/evoloop-init/templates/python/tests/conftest.py +38 -0
- evoloop_cli/_skills/evoloop-init/templates/python/tests/test_agentic_flows.py +36 -0
- evoloop_cli/_skills/evoloop-init/templates/python/tests/test_eval_framework.py +175 -0
- evoloop_cli/_skills/evoloop-new/SKILL.md +125 -0
- evoloop_cli/_skills/evoloop-new/scripts/scaffold_agent.py +911 -0
- evoloop_cli/_skills/evoloop-new/templates/common/.evoloop/constitution.md +34 -0
- evoloop_cli/_skills/evoloop-new/templates/common/.gitignore +22 -0
- evoloop_cli/_skills/evoloop-new/templates/common/AGENTS.md +17 -0
- evoloop_cli/_skills/evoloop-new/templates/common/README.md +83 -0
- evoloop_cli/_skills/evoloop-new/templates/common/skills/__DOMAIN__/SKILL.md +21 -0
- evoloop_cli/_skills/evoloop-new/templates/java/eval_wiring/src/test/java/__PACKAGE_PATH__/evals/AgenticFlowEvalTest.java +113 -0
- evoloop_cli/_skills/evoloop-new/templates/java/eval_wiring/src/test/java/__PACKAGE_PATH__/evals/EvalFrameworkTest.java +85 -0
- evoloop_cli/_skills/evoloop-new/templates/java/eval_wiring/src/test/java/__PACKAGE_PATH__/evals/Fake__DOMAIN_PASCAL__Client.java +37 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/custom/src/main/java/__PACKAGE_PATH__/Application.java +46 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/custom/src/main/java/__PACKAGE_PATH__/OpenAiCompatibleRunner.java +433 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/custom/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +125 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/langchain4j/src/main/java/__PACKAGE_PATH__/Application.java +46 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/langchain4j/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +163 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/langchain4j/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Tools.java +18 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/Application.java +15 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +167 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Controller.java +41 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Factory.java +32 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Tools.java +20 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/resources/application.yml +17 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/Application.java +17 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +159 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Config.java +32 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Controller.java +40 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Tools.java +25 -0
- evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/resources/application.yml +19 -0
- evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_custom.gradle +33 -0
- evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_langchain4j.gradle +40 -0
- evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_micronaut.gradle +52 -0
- evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_spring-ai.gradle +45 -0
- evoloop_cli/_skills/evoloop-new/templates/java/gradle/settings.gradle +1 -0
- evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_custom.xml +57 -0
- evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_langchain4j.xml +87 -0
- evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_micronaut.xml +101 -0
- evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_spring-ai.xml +61 -0
- evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/ConversationMemory.java +36 -0
- evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/Default__DOMAIN_PASCAL__Client.java +9 -0
- evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/DomainRecord.java +10 -0
- evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/TurnOutcome.java +15 -0
- evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Client.java +8 -0
- evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/evals/fakes.py +22 -0
- evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/evals/harness_custom.py +186 -0
- evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/evals/harness_deepagents.py +100 -0
- evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/tests/test_eval_framework.py +196 -0
- evoloop_cli/_skills/evoloop-new/templates/python/pyproject.toml +18 -0
- evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/__init__.py +13 -0
- evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/__main__.py +6 -0
- evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/agent_custom.py +209 -0
- evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/agent_deepagents.py +61 -0
- evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/cli.py +71 -0
- evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/client.py +31 -0
- evoloop_cli/_skills/evoloop-scenarios/SKILL.md +49 -0
- evoloop_cli/_skills/evoloop-scenarios/scripts/validate_scenarios.py +261 -0
- evoloop_cli/_skills/evoloop-scenarios/templates/scenario_schema.md +49 -0
- evoloop_cli/cli.py +331 -0
- evoloop_cli-0.1.0.dist-info/METADATA +214 -0
- evoloop_cli-0.1.0.dist-info/RECORD +103 -0
- evoloop_cli-0.1.0.dist-info/WHEEL +4 -0
- evoloop_cli-0.1.0.dist-info/entry_points.txt +2 -0
- evoloop_cli-0.1.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --script
|
|
2
|
+
# /// script
|
|
3
|
+
# requires-python = ">=3.11"
|
|
4
|
+
# dependencies = ["pyyaml>=6.0"]
|
|
5
|
+
# ///
|
|
6
|
+
"""State machine and circuit-breaker controller for evoloop-evolve."""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import json
|
|
12
|
+
import re
|
|
13
|
+
import sys
|
|
14
|
+
from datetime import datetime, timezone
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
import yaml
|
|
19
|
+
|
|
20
|
+
ACTIVE_TASK_RE = re.compile(r"^\s*-\s+\[\s\]\s+(.+)$")
|
|
21
|
+
SECTION_HEADER_RE = re.compile(r"^##\s+(\d+)\.\s+(.+)$")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def inspect_tasks_markdown(tasks_text: str) -> dict[str, list[str]]:
|
|
25
|
+
"""Extract active (`- [ ]`) tasks grouped by section and detect evaluator-approval items."""
|
|
26
|
+
sections: dict[str, list[str]] = {
|
|
27
|
+
"code": [],
|
|
28
|
+
"skill": [],
|
|
29
|
+
"scenario": [],
|
|
30
|
+
"evaluator_approval": [],
|
|
31
|
+
}
|
|
32
|
+
current = None
|
|
33
|
+
for line in tasks_text.splitlines():
|
|
34
|
+
m_sec = SECTION_HEADER_RE.match(line.strip())
|
|
35
|
+
if m_sec:
|
|
36
|
+
num = m_sec.group(1)
|
|
37
|
+
title = m_sec.group(2).lower()
|
|
38
|
+
if num == "1" or "code" in title:
|
|
39
|
+
current = "code"
|
|
40
|
+
elif num == "2" or "skill" in title or "memory" in title:
|
|
41
|
+
current = "skill"
|
|
42
|
+
elif num == "3" or "scenario" in title:
|
|
43
|
+
current = "scenario"
|
|
44
|
+
else:
|
|
45
|
+
current = None
|
|
46
|
+
continue
|
|
47
|
+
|
|
48
|
+
m_task = ACTIVE_TASK_RE.match(line)
|
|
49
|
+
if m_task and current is not None:
|
|
50
|
+
task_body = m_task.group(1).strip()
|
|
51
|
+
sections[current].append(task_body)
|
|
52
|
+
lower = task_body.lower()
|
|
53
|
+
if (
|
|
54
|
+
"requires approval: evaluator" in lower
|
|
55
|
+
or "evals/evaluators" in lower
|
|
56
|
+
or "llm_judge.py" in lower
|
|
57
|
+
or "deterministic.py" in lower
|
|
58
|
+
):
|
|
59
|
+
sections["evaluator_approval"].append(task_body)
|
|
60
|
+
|
|
61
|
+
return sections
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _detect_oscillation(history: list[dict[str, Any]]) -> list[str]:
|
|
65
|
+
"""Return case IDs that flipped PASS/FAIL 3 times across the last 4 runs."""
|
|
66
|
+
if len(history) < 4:
|
|
67
|
+
return []
|
|
68
|
+
window = history[-4:]
|
|
69
|
+
case_ids = {cid for run in window for cid in run.get("case_statuses", {})}
|
|
70
|
+
oscillating: list[str] = []
|
|
71
|
+
for cid in sorted(case_ids):
|
|
72
|
+
seq = [run.get("case_statuses", {}).get(cid) for run in window]
|
|
73
|
+
if seq in (
|
|
74
|
+
["PASS", "FAIL", "PASS", "FAIL"],
|
|
75
|
+
["FAIL", "PASS", "FAIL", "PASS"],
|
|
76
|
+
):
|
|
77
|
+
oscillating.append(cid)
|
|
78
|
+
return oscillating
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _detect_file_thrash(
|
|
82
|
+
history: list[dict[str, Any]],
|
|
83
|
+
max_edits: int,
|
|
84
|
+
) -> list[str]:
|
|
85
|
+
"""Detect if the same file was edited >= max_edits times while the same case kept failing."""
|
|
86
|
+
counts: dict[tuple[str, str], int] = {}
|
|
87
|
+
for run in history:
|
|
88
|
+
failed_cases = [
|
|
89
|
+
cid for cid, st in run.get("case_statuses", {}).items() if st == "FAIL"
|
|
90
|
+
]
|
|
91
|
+
for fpath in run.get("edited_files", []):
|
|
92
|
+
for cid in failed_cases:
|
|
93
|
+
key = (fpath, cid)
|
|
94
|
+
counts[key] = counts.get(key, 0) + 1
|
|
95
|
+
return [
|
|
96
|
+
f"{fpath} (edited {cnt}x while '{cid}' failed)"
|
|
97
|
+
for (fpath, cid), cnt in sorted(counts.items())
|
|
98
|
+
if cnt >= max_edits
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def evaluate_state(
|
|
103
|
+
state: dict[str, Any],
|
|
104
|
+
*,
|
|
105
|
+
report: dict[str, Any],
|
|
106
|
+
tasks_info: dict[str, list[str]],
|
|
107
|
+
timestamp: str,
|
|
108
|
+
git_head: str,
|
|
109
|
+
edited_files: list[str] | None = None,
|
|
110
|
+
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
111
|
+
"""Record an iteration and return (updated_state, decision_payload)."""
|
|
112
|
+
cfg = state["config"]
|
|
113
|
+
history: list[dict[str, Any]] = list(state.get("history", []))
|
|
114
|
+
iteration = len(history) + 1
|
|
115
|
+
|
|
116
|
+
sc_passed = int(report["scenarios_passed"])
|
|
117
|
+
sc_total = int(report["scenarios_total"])
|
|
118
|
+
ch_passed = int(report["checks_passed"])
|
|
119
|
+
ch_total = int(report["checks_total"])
|
|
120
|
+
case_statuses = {c["id"]: c["status"] for c in report.get("cases", [])}
|
|
121
|
+
|
|
122
|
+
entry = {
|
|
123
|
+
"iteration": iteration,
|
|
124
|
+
"timestamp": timestamp,
|
|
125
|
+
"git_head": git_head,
|
|
126
|
+
"scenarios_passed": sc_passed,
|
|
127
|
+
"scenarios_total": sc_total,
|
|
128
|
+
"checks_passed": ch_passed,
|
|
129
|
+
"checks_total": ch_total,
|
|
130
|
+
"case_statuses": case_statuses,
|
|
131
|
+
"edited_files": list(edited_files or []),
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
best = state.get("best")
|
|
135
|
+
prev_regressed = bool(state.get("last_iteration_regressed", False))
|
|
136
|
+
current_score = (sc_passed, ch_passed)
|
|
137
|
+
|
|
138
|
+
regressed_now = False
|
|
139
|
+
unrecovered_regression = False
|
|
140
|
+
if best is None:
|
|
141
|
+
best = {
|
|
142
|
+
"scenarios_passed": sc_passed,
|
|
143
|
+
"checks_passed": ch_passed,
|
|
144
|
+
"git_head": git_head,
|
|
145
|
+
"timestamp": timestamp,
|
|
146
|
+
"iteration": iteration,
|
|
147
|
+
}
|
|
148
|
+
else:
|
|
149
|
+
best_score = (int(best["scenarios_passed"]), int(best["checks_passed"]))
|
|
150
|
+
if current_score >= best_score:
|
|
151
|
+
best = {
|
|
152
|
+
"scenarios_passed": sc_passed,
|
|
153
|
+
"checks_passed": ch_passed,
|
|
154
|
+
"git_head": git_head,
|
|
155
|
+
"timestamp": timestamp,
|
|
156
|
+
"iteration": iteration,
|
|
157
|
+
}
|
|
158
|
+
regressed_now = False
|
|
159
|
+
else:
|
|
160
|
+
regressed_now = True
|
|
161
|
+
if prev_regressed and cfg.get("stop_on_unrecovered_regression", True):
|
|
162
|
+
unrecovered_regression = True
|
|
163
|
+
|
|
164
|
+
history.append(entry)
|
|
165
|
+
oscillating_cases = _detect_oscillation(history)
|
|
166
|
+
thrash_hits = _detect_file_thrash(
|
|
167
|
+
history, int(cfg.get("max_file_edits_same_failure", 3))
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
advisories: list[str] = []
|
|
171
|
+
if (
|
|
172
|
+
int(report.get("deterministic_checks_passed", 0))
|
|
173
|
+
== int(report.get("deterministic_checks_total", 0))
|
|
174
|
+
and report.get("judge_only_failures")
|
|
175
|
+
):
|
|
176
|
+
advisories.append("JUDGE_ONLY_AUDIT")
|
|
177
|
+
|
|
178
|
+
decision = "CONTINUE"
|
|
179
|
+
reasons: list[str] = []
|
|
180
|
+
|
|
181
|
+
if sc_total > 0 and sc_passed == sc_total and ch_passed == ch_total:
|
|
182
|
+
decision = "GOAL_REACHED"
|
|
183
|
+
reasons.append(f"All {sc_passed}/{sc_total} scenarios and {ch_passed}/{ch_total} checks passed.")
|
|
184
|
+
elif unrecovered_regression:
|
|
185
|
+
decision = "UNRECOVERED_REGRESSION"
|
|
186
|
+
reasons.append(
|
|
187
|
+
f"Two consecutive iterations below best ({best['scenarios_passed']}/{sc_total}, "
|
|
188
|
+
f"{best['checks_passed']}/{ch_total} at {best['git_head']})."
|
|
189
|
+
)
|
|
190
|
+
elif oscillating_cases or thrash_hits:
|
|
191
|
+
decision = "OSCILLATION_DETECTED"
|
|
192
|
+
if oscillating_cases:
|
|
193
|
+
reasons.append(f"Oscillating scenario(s): {oscillating_cases}")
|
|
194
|
+
if thrash_hits:
|
|
195
|
+
reasons.append(f"Repeated edits without resolution: {thrash_hits}")
|
|
196
|
+
elif iteration >= int(cfg.get("max_iterations", 4)):
|
|
197
|
+
decision = "MAX_ITERATIONS_REACHED"
|
|
198
|
+
reasons.append(f"Reached max_iterations={cfg.get('max_iterations', 4)}.")
|
|
199
|
+
elif cfg.get("require_approval_for_scenarios", True) and tasks_info["scenario"]:
|
|
200
|
+
decision = "APPROVAL_REQUIRED_SCENARIO"
|
|
201
|
+
reasons.append(
|
|
202
|
+
f"Section 3 (Scenario Updates) has {len(tasks_info['scenario'])} active task(s) requiring human approval."
|
|
203
|
+
)
|
|
204
|
+
elif cfg.get("require_approval_for_evaluators", True) and tasks_info["evaluator_approval"]:
|
|
205
|
+
decision = "APPROVAL_REQUIRED_EVALUATOR"
|
|
206
|
+
reasons.append(
|
|
207
|
+
f"Evaluator/Judge changes detected ({len(tasks_info['evaluator_approval'])} task(s)) requiring human approval."
|
|
208
|
+
)
|
|
209
|
+
else:
|
|
210
|
+
reasons.append("Safe to execute Code/Skill tasks and proceed to next iteration.")
|
|
211
|
+
|
|
212
|
+
new_state = {
|
|
213
|
+
**state,
|
|
214
|
+
"best": best,
|
|
215
|
+
"last_iteration_regressed": regressed_now,
|
|
216
|
+
"history": history,
|
|
217
|
+
"last_decision": decision,
|
|
218
|
+
}
|
|
219
|
+
payload = {
|
|
220
|
+
"decision": decision,
|
|
221
|
+
"iteration": iteration,
|
|
222
|
+
"max_iterations": int(cfg.get("max_iterations", 4)),
|
|
223
|
+
"reasons": reasons,
|
|
224
|
+
"advisories": advisories,
|
|
225
|
+
"best": best,
|
|
226
|
+
"active_tasks": tasks_info,
|
|
227
|
+
}
|
|
228
|
+
return new_state, payload
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def _state_paths(repo: Path) -> tuple[Path, Path]:
|
|
232
|
+
base = repo / ".evoloop"
|
|
233
|
+
return base / ".evolve-lock", base / ".evolve-state.json"
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def _load_evolve_config(config_path: Path) -> dict[str, Any]:
|
|
237
|
+
defaults = {
|
|
238
|
+
"max_iterations": 4,
|
|
239
|
+
"require_approval_for_scenarios": True,
|
|
240
|
+
"require_approval_for_evaluators": True,
|
|
241
|
+
"stop_on_unrecovered_regression": True,
|
|
242
|
+
"max_file_edits_same_failure": 3,
|
|
243
|
+
}
|
|
244
|
+
if config_path.is_file():
|
|
245
|
+
raw = yaml.safe_load(config_path.read_text(encoding="utf-8")) or {}
|
|
246
|
+
defaults.update(raw.get("evolve") or raw.get("heal") or {})
|
|
247
|
+
return defaults
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def main(argv: list[str] | None = None) -> int:
|
|
251
|
+
parser = argparse.ArgumentParser(description="Manage evoloop-evolve lock and circuit-breaker state.")
|
|
252
|
+
sub = parser.add_subparsers(dest="cmd", required=True)
|
|
253
|
+
|
|
254
|
+
p_start = sub.add_parser("start", help="Initialize evolve state and create .evolve-lock.")
|
|
255
|
+
p_start.add_argument("--repo", type=Path, default=Path("."))
|
|
256
|
+
p_start.add_argument("--config", type=Path, default=Path(".evoloop/config.yaml"))
|
|
257
|
+
p_start.add_argument("--max-iterations", type=int, default=None)
|
|
258
|
+
|
|
259
|
+
p_rec = sub.add_parser("record", help="Record an evaluation run and evaluate circuit breakers.")
|
|
260
|
+
p_rec.add_argument("--repo", type=Path, default=Path("."))
|
|
261
|
+
p_rec.add_argument("--config", type=Path, default=Path(".evoloop/config.yaml"))
|
|
262
|
+
p_rec.add_argument("--timestamp", required=True)
|
|
263
|
+
p_rec.add_argument("--head", required=True)
|
|
264
|
+
p_rec.add_argument("--report-json", type=Path, required=True)
|
|
265
|
+
p_rec.add_argument("--tasks", type=Path, required=True)
|
|
266
|
+
p_rec.add_argument("--edited-files", nargs="*", default=[])
|
|
267
|
+
|
|
268
|
+
p_status = sub.add_parser("status", help="Show current evolve state.")
|
|
269
|
+
p_status.add_argument("--repo", type=Path, default=Path("."))
|
|
270
|
+
|
|
271
|
+
p_stop = sub.add_parser("stop", help="Remove .evolve-lock and close evolve session.")
|
|
272
|
+
p_stop.add_argument("--repo", type=Path, default=Path("."))
|
|
273
|
+
|
|
274
|
+
args = parser.parse_args(argv)
|
|
275
|
+
lock_path, state_path = _state_paths(args.repo)
|
|
276
|
+
|
|
277
|
+
if args.cmd == "start":
|
|
278
|
+
evolve_cfg = _load_evolve_config(args.config)
|
|
279
|
+
if args.max_iterations is not None:
|
|
280
|
+
evolve_cfg["max_iterations"] = args.max_iterations
|
|
281
|
+
lock_path.parent.mkdir(parents=True, exist_ok=True)
|
|
282
|
+
now = datetime.now(timezone.utc).isoformat()
|
|
283
|
+
lock_path.write_text(f"started_at={now}\n", encoding="utf-8")
|
|
284
|
+
state = {
|
|
285
|
+
"started_at": now,
|
|
286
|
+
"config": evolve_cfg,
|
|
287
|
+
"best": None,
|
|
288
|
+
"last_iteration_regressed": False,
|
|
289
|
+
"history": [],
|
|
290
|
+
"last_decision": None,
|
|
291
|
+
}
|
|
292
|
+
state_path.write_text(json.dumps(state, indent=2) + "\n", encoding="utf-8")
|
|
293
|
+
print(json.dumps({"status": "started", "lock": str(lock_path), "config": evolve_cfg}, indent=2))
|
|
294
|
+
return 0
|
|
295
|
+
|
|
296
|
+
if args.cmd == "record":
|
|
297
|
+
if not state_path.is_file():
|
|
298
|
+
print("ERROR: No active evolve state. Run `evolve_state.py start` first.", file=sys.stderr)
|
|
299
|
+
return 2
|
|
300
|
+
state = json.loads(state_path.read_text(encoding="utf-8"))
|
|
301
|
+
report = json.loads(args.report_json.read_text(encoding="utf-8"))
|
|
302
|
+
tasks_info = inspect_tasks_markdown(args.tasks.read_text(encoding="utf-8"))
|
|
303
|
+
new_state, payload = evaluate_state(
|
|
304
|
+
state,
|
|
305
|
+
report=report,
|
|
306
|
+
tasks_info=tasks_info,
|
|
307
|
+
timestamp=args.timestamp,
|
|
308
|
+
git_head=args.head,
|
|
309
|
+
edited_files=args.edited_files,
|
|
310
|
+
)
|
|
311
|
+
state_path.write_text(json.dumps(new_state, indent=2) + "\n", encoding="utf-8")
|
|
312
|
+
print(json.dumps(payload, indent=2))
|
|
313
|
+
return 0
|
|
314
|
+
|
|
315
|
+
if args.cmd == "status":
|
|
316
|
+
if not state_path.is_file():
|
|
317
|
+
print(json.dumps({"active": lock_path.exists(), "state": None}, indent=2))
|
|
318
|
+
return 0
|
|
319
|
+
state = json.loads(state_path.read_text(encoding="utf-8"))
|
|
320
|
+
print(json.dumps({"active": lock_path.exists(), "state": state}, indent=2))
|
|
321
|
+
return 0
|
|
322
|
+
|
|
323
|
+
if args.cmd == "stop":
|
|
324
|
+
if lock_path.exists():
|
|
325
|
+
lock_path.unlink()
|
|
326
|
+
print(json.dumps({"status": "stopped", "lock_removed": True}, indent=2))
|
|
327
|
+
return 0
|
|
328
|
+
|
|
329
|
+
return 1
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
if __name__ == "__main__":
|
|
333
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evoloop-implement
|
|
3
|
+
description: Execute `evaluations/<timestamp>/tasks.md` section-by-section, enforce protected-path and evaluator-approval guards, add offline unit tests, run the offline pytest gate, make atomic commits with `Eval:` trailers, and check off completed items.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Evoloop Implement
|
|
7
|
+
|
|
8
|
+
Apply tasks from the latest (or specified) `evaluations/<timestamp>/tasks.md` safely and atomically, with mechanical anti-reward-hacking guards and full git traceability.
|
|
9
|
+
|
|
10
|
+
## Writing Style Requirement
|
|
11
|
+
|
|
12
|
+
Before modifying any document or code file, read [`../evoloop-constitution/references/writing-guide.md`](../evoloop-constitution/references/writing-guide.md) (`.agents/skills/evoloop-constitution/references/writing-guide.md`). Apply its Simplified Technical English rules to every document (`README.md`, `AGENTS.md`, `skills/**/SKILL.md`, `evaluations/<ts>/tasks.md`), YAML comment, code comment, docstring, Javadoc, and commit description you write or edit.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
### Step 1: Load Context & Verify Governance
|
|
17
|
+
1. Read `.evoloop/constitution.md`, `.evoloop/config.yaml`, and the target `evaluations/<ts>/tasks.md`.
|
|
18
|
+
2. Check whether `.evoloop/.evolve-lock` exists (indicating automated self-evolving mode).
|
|
19
|
+
3. Identify active (`- [ ]`) tasks in each section:
|
|
20
|
+
- **Section 1: Code Fixes** (note any `[REQUIRES APPROVAL: EVALUATOR]` items targeting `evals/evaluators/**`)
|
|
21
|
+
- **Section 2: Skill & Agent Memory Updates** (`AGENTS.md`, `skills/**`)
|
|
22
|
+
- **Section 3: Scenario Updates** (`evals/datasets/**`)
|
|
23
|
+
4. **Hard Approval Gate:**
|
|
24
|
+
- Never apply Section 3 (`Scenario Updates`) unless explicit human approval has been granted for this exact diff.
|
|
25
|
+
- When `require_approval_for_evaluators: true` (default), never modify `evals/evaluators/**` without explicit human approval and a regression unit test in `tests/test_eval_framework.py`.
|
|
26
|
+
|
|
27
|
+
### Step 2: Apply Changes Group-by-Group
|
|
28
|
+
Process one section at a time so each group gets its own clean, traceable commit:
|
|
29
|
+
|
|
30
|
+
1. **Code Fixes:**
|
|
31
|
+
- Respect `budgets.max_system_prompt_words` from `.evoloop/config.yaml` (refactor/consolidate instead of appending duplicate `NEVER` clauses).
|
|
32
|
+
- Add or update offline unit tests in `tests/test_eval_framework.py` for any harness, adapter, or evaluator fix.
|
|
33
|
+
- Stage only the files for this section.
|
|
34
|
+
2. **Skill & Agent Memory Updates:**
|
|
35
|
+
- Keep `AGENTS.md` and `skills/**/SKILL.md` consistent and unambiguous (one concrete action per edge case).
|
|
36
|
+
- Stage only the files for this section.
|
|
37
|
+
3. **Scenario Updates (only after explicit approval):**
|
|
38
|
+
- Apply the approved YAML diff and re-run `validate_scenarios.py`.
|
|
39
|
+
- Stage only the files for this section.
|
|
40
|
+
|
|
41
|
+
### Step 3: Run Scope Guard, Offline Test Gate, and Atomic Commit
|
|
42
|
+
For **each** section with staged changes, run `commit_section.py`, which automatically:
|
|
43
|
+
1. Invokes `check_scope.py` against `.evoloop/config.yaml` (blocking unauthorized edits to `protected_paths` or `evaluator_paths`).
|
|
44
|
+
2. Runs the offline test gate (`uv run pytest`).
|
|
45
|
+
3. Commits staged files with the mandatory `Eval: evaluations/<ts>/analysis.md` trailer.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv run .agents/skills/evoloop-implement/scripts/commit_section.py \
|
|
49
|
+
--config .evoloop/config.yaml \
|
|
50
|
+
--eval-ref "evaluations/<ts>/analysis.md" \
|
|
51
|
+
--message "fix: <concise description of section changes>"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Pass `--allow-evaluator-edits` or `--allow-scenario-edits` **ONLY** after explicit user approval.
|
|
55
|
+
|
|
56
|
+
### Step 4: Mark Completed Tasks
|
|
57
|
+
Update `evaluations/<ts>/tasks.md` by checking off `- [x]` for every completed task (and commit or include the checklist update cleanly).
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --script
|
|
2
|
+
# /// script
|
|
3
|
+
# requires-python = ">=3.11"
|
|
4
|
+
# dependencies = ["pyyaml>=6.0"]
|
|
5
|
+
# ///
|
|
6
|
+
"""Deterministic scope guard preventing unauthorized edits to protected or evaluator paths."""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import fnmatch
|
|
12
|
+
import json
|
|
13
|
+
import subprocess
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
import yaml
|
|
19
|
+
|
|
20
|
+
DEFAULT_PROTECTED = ["evals/datasets/**", "tests/test_agentic_flows.py"]
|
|
21
|
+
DEFAULT_EVALUATORS = ["evals/evaluators/**"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _matches_any(rel_path: str, patterns: list[str]) -> bool:
|
|
25
|
+
normalized = rel_path.replace("\\", "/").lstrip("./")
|
|
26
|
+
for pat in patterns:
|
|
27
|
+
pat_norm = pat.replace("\\", "/").lstrip("./")
|
|
28
|
+
if fnmatch.fnmatch(normalized, pat_norm):
|
|
29
|
+
return True
|
|
30
|
+
if pat_norm.endswith("/**"):
|
|
31
|
+
prefix = pat_norm[:-3].rstrip("/")
|
|
32
|
+
if normalized == prefix or normalized.startswith(prefix + "/"):
|
|
33
|
+
return True
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _git_changed_files(repo_root: Path, *, include_working_tree: bool) -> list[str]:
|
|
38
|
+
cmd = ["git", "diff", "--cached", "--name-only"]
|
|
39
|
+
res = subprocess.run(cmd, cwd=repo_root, capture_output=True, text=True, check=False)
|
|
40
|
+
if res.returncode != 0:
|
|
41
|
+
raise RuntimeError(f"git diff failed: {res.stderr.strip()}")
|
|
42
|
+
files = [line.strip() for line in res.stdout.splitlines() if line.strip()]
|
|
43
|
+
|
|
44
|
+
if include_working_tree:
|
|
45
|
+
res_wt = subprocess.run(
|
|
46
|
+
["git", "diff", "--name-only"],
|
|
47
|
+
cwd=repo_root,
|
|
48
|
+
capture_output=True,
|
|
49
|
+
text=True,
|
|
50
|
+
check=False,
|
|
51
|
+
)
|
|
52
|
+
if res_wt.returncode == 0:
|
|
53
|
+
for line in res_wt.stdout.splitlines():
|
|
54
|
+
line = line.strip()
|
|
55
|
+
if line and line not in files:
|
|
56
|
+
files.append(line)
|
|
57
|
+
return files
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def check_scope(
|
|
61
|
+
changed_files: list[str],
|
|
62
|
+
*,
|
|
63
|
+
config: dict[str, Any] | None = None,
|
|
64
|
+
evolve_lock_active: bool = False,
|
|
65
|
+
allow_scenario_edits: bool = False,
|
|
66
|
+
allow_evaluator_edits: bool = False,
|
|
67
|
+
) -> dict[str, Any]:
|
|
68
|
+
"""Validate changed file paths against protected_paths and evaluator_paths."""
|
|
69
|
+
cfg = config or {}
|
|
70
|
+
gov = cfg.get("governance") or {}
|
|
71
|
+
evolve_cfg = cfg.get("evolve") or cfg.get("heal") or {}
|
|
72
|
+
|
|
73
|
+
protected_patterns = list(gov.get("protected_paths") or DEFAULT_PROTECTED)
|
|
74
|
+
evaluator_patterns = list(gov.get("evaluator_paths") or DEFAULT_EVALUATORS)
|
|
75
|
+
|
|
76
|
+
require_scenario_approval = bool(evolve_cfg.get("require_approval_for_scenarios", True))
|
|
77
|
+
require_evaluator_approval = bool(evolve_cfg.get("require_approval_for_evaluators", True))
|
|
78
|
+
|
|
79
|
+
blocked_scenarios: list[str] = []
|
|
80
|
+
blocked_evaluators: list[str] = []
|
|
81
|
+
|
|
82
|
+
for f in changed_files:
|
|
83
|
+
if _matches_any(f, protected_patterns):
|
|
84
|
+
if (require_scenario_approval or evolve_lock_active) and not allow_scenario_edits:
|
|
85
|
+
blocked_scenarios.append(f)
|
|
86
|
+
if _matches_any(f, evaluator_patterns):
|
|
87
|
+
if (require_evaluator_approval or evolve_lock_active) and not allow_evaluator_edits:
|
|
88
|
+
blocked_evaluators.append(f)
|
|
89
|
+
|
|
90
|
+
violations: list[str] = []
|
|
91
|
+
if blocked_scenarios:
|
|
92
|
+
violations.append(
|
|
93
|
+
f"Protected scenario/test path(s) modified without --allow-scenario-edits: {blocked_scenarios}"
|
|
94
|
+
)
|
|
95
|
+
if blocked_evaluators:
|
|
96
|
+
violations.append(
|
|
97
|
+
f"Evaluator/judge path(s) modified without --allow-evaluator-edits: {blocked_evaluators}"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
"allowed": len(violations) == 0,
|
|
102
|
+
"evolve_lock_active": evolve_lock_active,
|
|
103
|
+
"changed_files": changed_files,
|
|
104
|
+
"blocked_scenarios": blocked_scenarios,
|
|
105
|
+
"blocked_evaluators": blocked_evaluators,
|
|
106
|
+
"violations": violations,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def main(argv: list[str] | None = None) -> int:
|
|
111
|
+
parser = argparse.ArgumentParser(description="Check staged/modified files against evoloop scope rules.")
|
|
112
|
+
parser.add_argument("--config", type=Path, default=Path(".evoloop/config.yaml"))
|
|
113
|
+
parser.add_argument("--repo", type=Path, default=Path("."))
|
|
114
|
+
parser.add_argument("--files", nargs="*", default=None, help="Explicit file list (skips git diff).")
|
|
115
|
+
parser.add_argument("--include-working-tree", action="store_true", help="Also inspect unstaged git changes.")
|
|
116
|
+
parser.add_argument("--allow-scenario-edits", action="store_true", help="Permit protected_paths edits after explicit user approval.")
|
|
117
|
+
parser.add_argument("--allow-evaluator-edits", action="store_true", help="Permit evaluator_paths edits after explicit user approval.")
|
|
118
|
+
parser.add_argument("--json", action="store_true", dest="as_json")
|
|
119
|
+
args = parser.parse_args(argv)
|
|
120
|
+
|
|
121
|
+
cfg = yaml.safe_load(args.config.read_text(encoding="utf-8")) if args.config.is_file() else {}
|
|
122
|
+
evolve_lock = (args.repo / ".evoloop" / ".evolve-lock").exists()
|
|
123
|
+
|
|
124
|
+
if args.files is not None:
|
|
125
|
+
changed = list(args.files)
|
|
126
|
+
else:
|
|
127
|
+
try:
|
|
128
|
+
changed = _git_changed_files(args.repo, include_working_tree=args.include_working_tree)
|
|
129
|
+
except RuntimeError as exc:
|
|
130
|
+
print(f"ERROR: {exc}", file=sys.stderr)
|
|
131
|
+
return 2
|
|
132
|
+
|
|
133
|
+
result = check_scope(
|
|
134
|
+
changed,
|
|
135
|
+
config=cfg,
|
|
136
|
+
evolve_lock_active=evolve_lock,
|
|
137
|
+
allow_scenario_edits=args.allow_scenario_edits,
|
|
138
|
+
allow_evaluator_edits=args.allow_evaluator_edits,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
if args.as_json:
|
|
142
|
+
print(json.dumps(result, indent=2))
|
|
143
|
+
else:
|
|
144
|
+
if result["allowed"]:
|
|
145
|
+
print(f"OK: Scope check passed ({len(changed)} file(s)).")
|
|
146
|
+
else:
|
|
147
|
+
for v in result["violations"]:
|
|
148
|
+
print(f"BLOCKED: {v}", file=sys.stderr)
|
|
149
|
+
|
|
150
|
+
return 0 if result["allowed"] else 1
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
if __name__ == "__main__":
|
|
154
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --script
|
|
2
|
+
# /// script
|
|
3
|
+
# requires-python = ">=3.11"
|
|
4
|
+
# dependencies = ["pyyaml>=6.0"]
|
|
5
|
+
# ///
|
|
6
|
+
"""Commit staged changes for a single evoloop task section with scope guard, offline test gate, and Eval trailer."""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import shlex
|
|
12
|
+
import subprocess
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
import yaml
|
|
17
|
+
|
|
18
|
+
# Import sibling check_scope helper
|
|
19
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
20
|
+
from check_scope import _git_changed_files, check_scope # noqa: E402
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main(argv: list[str] | None = None) -> int:
|
|
24
|
+
parser = argparse.ArgumentParser(description="Atomic evoloop section commit with scope guard and Eval trailer.")
|
|
25
|
+
parser.add_argument("--message", "-m", required=True, help="Commit subject line.")
|
|
26
|
+
parser.add_argument("--eval-ref", required=True, help="Relative path to analysis.md, e.g. evaluations/<ts>/analysis.md.")
|
|
27
|
+
parser.add_argument("--config", type=Path, default=Path(".evoloop/config.yaml"))
|
|
28
|
+
parser.add_argument("--repo", type=Path, default=Path("."))
|
|
29
|
+
parser.add_argument("--allow-scenario-edits", action="store_true")
|
|
30
|
+
parser.add_argument("--allow-evaluator-edits", action="store_true")
|
|
31
|
+
parser.add_argument("--skip-offline-tests", action="store_true", help="Skip offline pytest gate (use only when no code/tests changed).")
|
|
32
|
+
args = parser.parse_args(argv)
|
|
33
|
+
|
|
34
|
+
repo = args.repo.resolve()
|
|
35
|
+
cfg = yaml.safe_load(args.config.read_text(encoding="utf-8")) if args.config.is_file() else {}
|
|
36
|
+
evolve_lock = (repo / ".evoloop" / ".evolve-lock").exists()
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
staged = _git_changed_files(repo, include_working_tree=False)
|
|
40
|
+
except RuntimeError as exc:
|
|
41
|
+
print(f"ERROR: {exc}", file=sys.stderr)
|
|
42
|
+
return 2
|
|
43
|
+
|
|
44
|
+
if not staged:
|
|
45
|
+
print("ERROR: No staged changes to commit. Stage the section's files first.", file=sys.stderr)
|
|
46
|
+
return 1
|
|
47
|
+
|
|
48
|
+
scope = check_scope(
|
|
49
|
+
staged,
|
|
50
|
+
config=cfg,
|
|
51
|
+
evolve_lock_active=evolve_lock,
|
|
52
|
+
allow_scenario_edits=args.allow_scenario_edits,
|
|
53
|
+
allow_evaluator_edits=args.allow_evaluator_edits,
|
|
54
|
+
)
|
|
55
|
+
if not scope["allowed"]:
|
|
56
|
+
for v in scope["violations"]:
|
|
57
|
+
print(f"BLOCKED: {v}", file=sys.stderr)
|
|
58
|
+
return 1
|
|
59
|
+
|
|
60
|
+
if not args.skip_offline_tests:
|
|
61
|
+
offline_cmd = ((cfg.get("commands") or {}).get("offline_test")) or "uv run pytest"
|
|
62
|
+
print(f"Running offline test gate: {offline_cmd}")
|
|
63
|
+
test_res = subprocess.run(shlex.split(offline_cmd), cwd=repo, check=False)
|
|
64
|
+
if test_res.returncode != 0:
|
|
65
|
+
print("BLOCKED: Offline test gate failed. Fix tests before committing.", file=sys.stderr)
|
|
66
|
+
return 1
|
|
67
|
+
|
|
68
|
+
trailer = f"Eval: {args.eval_ref}"
|
|
69
|
+
commit_res = subprocess.run(
|
|
70
|
+
["git", "commit", "-m", args.message, "-m", trailer],
|
|
71
|
+
cwd=repo,
|
|
72
|
+
check=False,
|
|
73
|
+
)
|
|
74
|
+
return commit_res.returncode
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if __name__ == "__main__":
|
|
78
|
+
raise SystemExit(main())
|