CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
fix(capability): raise on bypassed fixed-mode invariant; clamp boundary tests
xf gongcfa3a74db072
diff --git a/cubepi/providers/capability.py b/cubepi/providers/capability.pyindex 6b2fb16..6f9b629 100644--- a/cubepi/providers/capability.py+++ b/cubepi/providers/capability.py@@ -102,7 +102,11 @@ def apply_temperature(kwargs: dict[str, Any], spec: TemperatureSpec) -> None:returnif spec.mode == "fixed":- assert spec.fixed_value is not None # enforced by validator+ if spec.fixed_value is None:+ raise RuntimeError(+ "TemperatureSpec(mode='fixed') reached apply_temperature with no "+ "fixed_value — validator was bypassed"+ )kwargs["temperature"] = spec.fixed_valuereturndiff --git a/tests/test_capability.py b/tests/test_capability.pyindex 25b6bf6..af4ba69 100644--- a/tests/test_capability.py+++ b/tests/test_capability.py@@ -160,3 +160,17 @@ def test_apply_temperature_free_no_op_when_absent():kwargs: dict = {}apply_temperature(kwargs, TemperatureSpec(mode="free"))assert kwargs == {}+++def test_apply_temperature_free_clamp_inclusive_at_min():+ """Value exactly at min stays unchanged (inclusive clamp)."""+ kwargs = {"temperature": 0.0}+ apply_temperature(kwargs, TemperatureSpec(mode="free", min=0.0, max=2.0))+ assert kwargs == {"temperature": 0.0}+++def test_apply_temperature_free_clamp_inclusive_at_max():+ """Value exactly at max stays unchanged (inclusive clamp)."""+ kwargs = {"temperature": 2.0}+ apply_temperature(kwargs, TemperatureSpec(mode="free", min=0.0, max=2.0))+ assert kwargs == {"temperature": 2.0}