Skip to content
Open
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
4 changes: 4 additions & 0 deletions skillclaw/config_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"url": "",
"model": "",
"api_key": "",
"temperature": 0.6,
},
"sharing": {
"enabled": False,
Expand Down Expand Up @@ -337,6 +338,8 @@ def to_skillclaw_config(self) -> SkillClawConfig:
prm_url = str(prm.get("url", "") or llm_api_base)
prm_model = str(prm.get("model", "") or llm_model_id or "gpt-5.2")
prm_api_key = str(prm.get("api_key", "") or llm_api_key)
_prm_temperature = prm.get("temperature")
prm_temperature = float(_prm_temperature) if _prm_temperature is not None else 0.6

skills_dir = resolve_skills_dir(
skills.get("dir", str(_DEFAULT_SKILLS_DIR)),
Expand Down Expand Up @@ -377,6 +380,7 @@ def to_skillclaw_config(self) -> SkillClawConfig:
prm_url=prm_url,
prm_model=prm_model,
prm_api_key=prm_api_key,
prm_temperature=prm_temperature,
# Model
model_name=llm.get("model_id") or "Qwen/Qwen3-4B",
# Claw
Expand Down
49 changes: 49 additions & 0 deletions tests/test_prm_temperature_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""``prm.temperature`` in config.yaml must reach ``SkillClawConfig.prm_temperature``.

Regression coverage for the config bridge: the field existed but was never
wired from YAML, and the first wiring attempt silently rewrote an explicit
``temperature: 0`` to the default via an ``or``-guard. These cases pin the
correct behavior: configured values pass through (including falsy-but-valid
0), and the default only applies when the key is absent.
"""
from __future__ import annotations

from pathlib import Path

import yaml

from skillclaw.config_store import ConfigStore


def _store(tmp_path: Path, prm: dict) -> ConfigStore:
cfg = tmp_path / "config.yaml"
cfg.write_text(
yaml.safe_dump(
{
"llm": {"provider": "openai", "model_id": "k3", "api_base": "https://example.invalid/v1"},
"prm": prm,
}
)
)
return ConfigStore(cfg)


def test_prm_temperature_from_config(tmp_path):
store = _store(tmp_path, {"enabled": True, "model": "k3", "temperature": 1})
assert store.to_skillclaw_config().prm_temperature == 1


def test_prm_temperature_fractional_value(tmp_path):
store = _store(tmp_path, {"enabled": True, "model": "gpt-5.2", "temperature": 0.2})
assert store.to_skillclaw_config().prm_temperature == 0.2


def test_prm_temperature_zero_is_honored(tmp_path):
"""An explicit 0 (deterministic scoring) must not be rewritten to 0.6."""
store = _store(tmp_path, {"enabled": True, "model": "gpt-5.2", "temperature": 0})
assert store.to_skillclaw_config().prm_temperature == 0


def test_prm_temperature_default_when_unset(tmp_path):
store = _store(tmp_path, {"enabled": True, "model": "gpt-5.2"})
assert store.to_skillclaw_config().prm_temperature == 0.6