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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk
This commit is contained in:
1 parent
9d2992c20a
commit
369b6ed52f
1 file changed
+7
-3
@@ -18,7 +18,7 @@ from nisse_core.loop.expert import (
|
|||||||
ExpertDesk,
|
ExpertDesk,
|
||||||
parse_answer,
|
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.oplog import OpLog
|
||||||
from nisse_core.state.store import Transcript
|
from nisse_core.state.store import Transcript
|
||||||
from nisse_dev.state import StateStore
|
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:
|
def complete(self, events: Any, tools: Any, model: str, system: Any = None) -> Any:
|
||||||
self.calls.append({"model": model, "system": system})
|
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(
|
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)
|
e.event for e in log(store).read() if isinstance(e.event, DelegationCompleted)
|
||||||
]
|
]
|
||||||
assert completed.exit_status == "failed"
|
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:
|
def test_retry_succeeds_after_a_bad_first_reply(store: StateStore) -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user