wren node: untrained targets left out of the prompt, a read beside a held-back set goes on whole

This commit is contained in:
Melvin Strobl
2026-10-25 12:09:37 +01:00
parent e9941b770d
commit 96ba512d40
3 changed files with 31 additions and 4 deletions
+20
View File
@@ -295,6 +295,8 @@ def test_a_target_the_model_was_not_trained_on_is_never_applied(fake_wren):
fake_wren.answer = [fake_wren.Call("canopy", "DOWN")]
out = node.execute({"house.command": "close the awning"})
# The model is not shown the targets it never learnt.
assert [t.name for t in fake_wren.targets[0]] == ["living_room_heating"]
assert out is not None
assert [a["applied"] for a in out["house.actions"]] == [False]
assert out["house.unhandled"] == "close the awning"
@@ -325,6 +327,24 @@ def test_a_read_is_answered_from_the_target_value(fake_wren):
assert out["house.unhandled"] == command
def test_a_read_beside_a_set_not_written_goes_on_whole(fake_wren):
node = _node(
fake_wren, ("kitchen_light", DType.BOOL), inputs=[OUTDOOR], saying=True
)
fake_wren.answer = [
fake_wren.Call("outdoor_temperature"),
fake_wren.Call("kitchen_light", True),
]
command = "how warm is it outside and turn on the kitchen light"
out = node.execute({"house.command": command, "house.outdoor": 6.2})
assert out is not None
assert [a["applied"] for a in out["house.actions"]] == [False, False]
assert out["house.unhandled"] == command
assert "house.reply" not in out or out["house.reply"] == CANT
def test_a_delayed_call_is_held_by_the_work_queue(fake_wren, monkeypatch):
node = _node(fake_wren, ("kitchen_light", DType.BOOL), saying=True, apply=True)
deferred: list[tuple[dict[str, Any], float]] = []