Skip to content

Self-hosted AI workspace.

Python

fix(teacher): import _TEACHER_SYSTEM_PROMPT from its current module (#5756)

DocFurious17ee856d1c39
diff --git a/src/teacher_escalation.py b/src/teacher_escalation.py
index 49134991c..4b6206a8d 100644
--- a/src/teacher_escalation.py
+++ b/src/teacher_escalation.py
@@ -233,7 +233,8 @@ async def _call_teacher(teacher_model_spec: str, prompt: str,
owner: Optional[str] = None) -> Optional[str]:
"""Call the configured teacher endpoint with the escalation prompt."""
from src.llm_core import llm_call_async
- from src.ai_interaction import _resolve_model, _TEACHER_SYSTEM_PROMPT
+ from src.ai_interaction import _resolve_model
+ from src.agent_tools.model_interaction_tools import _TEACHER_SYSTEM_PROMPT
try:
url, model, headers = await asyncio.to_thread(_resolve_model, teacher_model_spec, owner=owner)
except Exception as e:
diff --git a/tests/test_teacher_audit_owner_scope.py b/tests/test_teacher_audit_owner_scope.py
index 5bd6228d9..8e398d9bb 100644
--- a/tests/test_teacher_audit_owner_scope.py
+++ b/tests/test_teacher_audit_owner_scope.py
@@ -21,10 +21,17 @@ def test_call_teacher_scopes_model_resolution_to_owner(monkeypatch):
return ("http://endpoint.local/v1", "teacher-model", {})
async def fake_llm_call_async(url, model, messages, **kwargs):
+ seen["messages"] = messages
return "teacher reply"
+ from src.agent_tools import model_interaction_tools
+
monkeypatch.setattr("src.ai_interaction._resolve_model", fake_resolve_model)
- monkeypatch.setattr("src.ai_interaction._TEACHER_SYSTEM_PROMPT", "sys", raising=False)
+ monkeypatch.setattr(
+ model_interaction_tools,
+ "_TEACHER_SYSTEM_PROMPT",
+ "sys",
+ )
monkeypatch.setattr("src.llm_core.llm_call_async", fake_llm_call_async)
result = asyncio.run(
@@ -34,6 +41,7 @@ def test_call_teacher_scopes_model_resolution_to_owner(monkeypatch):
assert result == "teacher reply"
assert seen["owner"] == "alice"
assert seen["spec"] == "teacher-model"
+ assert seen["messages"][0] == {"role": "system", "content": "sys"}
def test_audit_teacher_resolution_scoped_to_owner(monkeypatch):