Skip to content
Draft
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
3 changes: 3 additions & 0 deletions hermit/agent/evolver/methods/mwm/evolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ def _notes(admission: dict | None) -> str:

# ------------------------------------------------------------------ steps
def setup(self, ctx: Context) -> None:
if ctx.params.get("backend", "codex") not in ("codex", "claude"): # its session texts, homes and sign-ins
raise ValueError("the mwm Evolver's learner is a Codex or Claude Code session: evolver.params.backend is "
f"codex or claude, not {ctx.params.get('backend')!r}")
if "network_isolation" in ctx.params:
raise ValueError("evolver.params.network_isolation was removed: the learner runs in the run's evolver "
"sandbox, whose network reaches only its models, the tool endpoint and "
Expand Down
3 changes: 3 additions & 0 deletions hermit/agent/evolver/methods/rrsi_adapter/evolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ def setup(self, ctx) -> None:
"""What every step needs, checked once: a broken hyperparameter file or domain, or an unset web_search,
stops the run here rather than failing each step."""
_require_rrsi()
if ctx.params.get("backend", "codex") not in ("codex", "claude"): # its roles' settings are those CLIs'
raise ValueError("the RRSI Adapter's proposer and roles are Codex or Claude Code sessions: "
f"evolver.params.backend is codex or claude, not {ctx.params.get('backend')!r}")
if not isinstance(ctx.params.get("web_search"), bool):
raise ValueError("evolver.params.web_search must be set, true or false")
role = ctx.params.get("roles") or {}
Expand Down
10 changes: 10 additions & 0 deletions tests/methods/mwm/test_mwm_evolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ def make(tmp: Path, monkeypatch, steps: int = 2, deployment_param: bool = False)
return path


def test_a_learner_that_is_not_codex_or_claude_code_is_refused_at_setup():
"""mwm's session is Codex's or Claude Code's (its texts, homes and sign-ins): another CLI Base Agent, which the
config takes as evolver.base (pi), is refused before any step rather than run without its model (mwm's session
settings carry no `provider`)."""
from types import SimpleNamespace
from hermit.agent.evolver.methods.mwm.evolver import MwmEvolver
with pytest.raises(ValueError, match="backend is codex or claude, not 'pi'"):
MwmEvolver().setup(SimpleNamespace(params={"backend": "pi"}))


def test_bootstrap_review_mounts_and_records(tmp_path, monkeypatch):
cfg = Config.load(make(tmp_path, monkeypatch), [])
stale = tmp_path / "taskdir" / "evidence" / "block000" # a record already in the store: hidden from the bootstrap
Expand Down
2 changes: 2 additions & 0 deletions tests/methods/rrsi_adapter/test_rrsi_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,8 @@ def test_setup_checks_what_every_step_needs(tmp_path):
ev.setup(ctx)
with pytest.raises(ValueError, match="web_search"):
ev.setup(context(ws, 1, dom, tmp_path, web_search=None))
with pytest.raises(ValueError, match="backend is codex or claude, not 'pi'"): # its roles' settings are not Pi's
ev.setup(context(ws, 1, dom, tmp_path, backend="pi"))
with pytest.raises(Exception):
ev.setup(context(ws, 1, str(tmp_path / "dom" / "missing.py") + ":ToyDomain", tmp_path))
with pytest.raises(ValueError, match="roles.model"):
Expand Down
Loading