diff --git a/src/webwright/skill_factory/route.py b/src/webwright/skill_factory/route.py index ae2cdea0..7124b6f0 100644 --- a/src/webwright/skill_factory/route.py +++ b/src/webwright/skill_factory/route.py @@ -21,6 +21,7 @@ import os import subprocess import sys +from pathlib import Path from .execute import run_skill from .gate import gate @@ -61,7 +62,7 @@ def agent_cfg(cfg: list[str]) -> list[str]: # -c REPLACES the defaults; base.yaml carries the agent's system/instance templates, so # re-add it unless a base was named — otherwise `-c model.yaml` alone yields an agent with # no template (a cryptic pydantic ValidationError, not a helpful message). - if not any("base" in c for c in cfg): + if not any(Path(c).name == "base.yaml" for c in cfg): cfg = ["base.yaml", *cfg] return cfg over = [f"model.{key}={val}" for key, val in diff --git a/tests/skill_factory/test_build_init.py b/tests/skill_factory/test_build_init.py index cf07c241..11ff1a85 100644 --- a/tests/skill_factory/test_build_init.py +++ b/tests/skill_factory/test_build_init.py @@ -364,6 +364,14 @@ def test_bare_model_config_gets_base_prepended(): ["base.yaml", "m.yaml", "model.max_output_tokens=16000"] +def test_base_is_matched_on_the_filename_not_a_substring(): + """`base` in `database.yaml` is not a base config. Prepend base.yaml so the agent + still gets system/instance templates.""" + assert agent_cfg(["database.yaml"]) == ["base.yaml", "database.yaml"] + assert agent_cfg(["my_base_model.yaml"]) == ["base.yaml", "my_base_model.yaml"] + assert agent_cfg(["configs/base.yaml", "mine.yaml"]) == ["configs/base.yaml", "mine.yaml"] + + def test_the_env_path_carries_a_usable_output_budget(monkeypatch): """The env path stands in for a model yaml, which set max_output_tokens: 16000. base.yaml's 4000 truncates the agent mid-script when it reuses a big skill, and the run loops re-emitting