From 369b6ed52f46a4131461ad623a90a71c64e964ff Mon Sep 17 00:00:00 2001 From: Don Garrett Date: Sun, 18 Oct 2026 14:01:15 +0000 Subject: [PATCH] test_expert: a declined consult hands back the clients' real wording The fake client raises _refused() from llm.py, and the test checks the whole handback, so a change to the real message fails it (review on #165). Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk --- nisse-core/tests/test_expert.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nisse-core/tests/test_expert.py b/nisse-core/tests/test_expert.py index c0ca455..ca46309 100644 --- a/nisse-core/tests/test_expert.py +++ b/nisse-core/tests/test_expert.py @@ -18,7 +18,7 @@ from nisse_core.loop.expert import ( ExpertDesk, parse_answer, ) -from nisse_core.models.llm import LLMError, ModelRefused, RoleMap +from nisse_core.models.llm import LLMError, RoleMap, _refused from nisse_core.oplog import OpLog from nisse_core.state.store import Transcript from nisse_dev.state import StateStore @@ -147,7 +147,7 @@ class DecliningClient(ScriptedClient): def complete(self, events: Any, tools: Any, model: str, system: Any = None) -> Any: self.calls.append({"model": model, "system": system}) - raise ModelRefused(f"{model} declined to answer: its provider's safety filter") + raise _refused(model) # the clients' own wording def test_a_declined_question_is_not_asked_again_and_says_why( @@ -162,7 +162,11 @@ def test_a_declined_question_is_not_asked_again_and_says_why( e.event for e in log(store).read() if isinstance(e.event, DelegationCompleted) ] assert completed.exit_status == "failed" - assert "safety filter" in completed.handback + assert completed.handback == ( + "claude-haiku-4-5 declined to answer: its provider's safety filter stopped the " + "reply. That says nothing about the subject itself. Ask it " + "differently, or work from the repository" + ) def test_retry_succeeds_after_a_bad_first_reply(store: StateStore) -> None: