Merge pull request #104 from zixuanguo786-ctrl/codex/preserve-fractional-hard-score

[codex] Preserve fractional rollout hard scores
This commit is contained in:
Yifan Yang
2026-07-14 17:41:42 +09:00
committed by GitHub
2 changed files with 20 additions and 7 deletions
+15 -2
View File
@@ -3,8 +3,7 @@ from __future__ import annotations
import pytest
from skillopt.types import Edit, Patch
from skillopt.types import Edit, Patch, RolloutResult
# ── Edit ────────────────────────────────────────────────────────────────────
@@ -247,3 +246,17 @@ class TestPatchEdgeCases:
assert isinstance(p.edits[0], Edit)
assert p.edits[0].op == "append"
assert p.edits[0].content == "hello"
# ── RolloutResult ────────────────────────────────────────────────────────────
class TestRolloutResultRoundTrip:
"""RolloutResult.to_dict() / RolloutResult.from_dict() round-trip."""
def test_preserves_fractional_hard_score(self) -> None:
"""Hard can be a continuous reward and must not be truncated."""
result = RolloutResult.from_dict({"id": "episode-1", "hard": 0.75, "soft": 0.5})
assert result.hard == pytest.approx(0.75)
assert result.to_dict()["hard"] == pytest.approx(0.75)