Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-05-11 11:44:53 +02:00 committed by GitHub
parent b23f49e5f4
commit 626f905186
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 702 additions and 183 deletions

View file

@ -329,6 +329,35 @@ class TestReadOnlyAgentMiddleware:
PLAN_REMINDER_SNIPPET = "Plan mode is active"
class TestMakePlanAgentReminder:
def test_default_includes_both_interactive_tool_instructions(self) -> None:
reminder = make_plan_agent_reminder("/tmp/test-plan.md")
assert "ask_user_question" in reminder
assert "exit_plan_mode" in reminder
def test_omits_ask_user_question_when_tool_unavailable(self) -> None:
reminder = make_plan_agent_reminder(
"/tmp/test-plan.md", has_ask_user_question=False
)
assert "ask_user_question" not in reminder
assert "exit_plan_mode" in reminder
def test_omits_exit_plan_mode_when_tool_unavailable(self) -> None:
reminder = make_plan_agent_reminder(
"/tmp/test-plan.md", has_exit_plan_mode=False
)
assert "exit_plan_mode" not in reminder
assert "tell them to switch modes" in reminder
def test_omits_both_when_neither_available(self) -> None:
reminder = make_plan_agent_reminder(
"/tmp/test-plan.md", has_ask_user_question=False, has_exit_plan_mode=False
)
assert "ask_user_question" not in reminder
assert "exit_plan_mode" not in reminder
assert "Plan mode is active" in reminder
class TestMiddlewarePipelineWithReadOnlyAgent:
@pytest.mark.asyncio
async def test_pipeline_includes_injection(self, ctx: ConversationContext) -> None: