Co-authored-by: Quentin Torroba <quentin.torroba@mistral.ai>
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-03-26 10:11:34 +01:00 committed by GitHub
parent 5ea69b547b
commit 6a50d1d521
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 3726 additions and 99 deletions

View file

@ -0,0 +1,47 @@
from __future__ import annotations
from textual.pilot import Pilot
from tests.snapshots.base_snapshot_test_app import BaseSnapshotTestApp
from tests.snapshots.snap_compare import SnapCompare
from vibe.core.types import LLMMessage, Role
class SnapshotTestAppWithInjectedMessages(BaseSnapshotTestApp):
"""Simulates resuming a session that contains injected middleware messages.
The injected plan-mode reminder between the two user turns must not
appear in the rendered history.
"""
def __init__(self) -> None:
super().__init__()
self.agent_loop.messages.extend([
LLMMessage(role=Role.user, content="Hello, can you help me?"),
LLMMessage(role=Role.assistant, content="Sure! What do you need?"),
# Middleware-injected plan mode reminder — should be hidden
LLMMessage(
role=Role.user,
content="<vibe_warning>Plan mode is active. You MUST NOT make any edits.</vibe_warning>",
injected=True,
),
LLMMessage(role=Role.user, content="Please read my config file."),
LLMMessage(
role=Role.assistant, content="Here is the content of your config file."
),
])
def test_snapshot_session_resume_hides_injected_messages(
snap_compare: SnapCompare,
) -> None:
"""Injected middleware messages must not be rendered when resuming a session."""
async def run_before(pilot: Pilot) -> None:
await pilot.pause(0.5)
assert snap_compare(
"test_ui_snapshot_session_resume_injected.py:SnapshotTestAppWithInjectedMessages",
terminal_size=(120, 36),
run_before=run_before,
)