Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai>
Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai>
Co-Authored-By: Clément Drouin <clement.drouin@mistral.ai>
Co-Authored-By: Vincent Guilloux <vincent.guilloux@mistral.ai>
Co-Authored-By: Clément Siriex <clement.sirieix@mistral.ai>
Co-Authored-By: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai>
Co-Authored-By: Thaddee Tyl <thaddee.tyl@gmail.com>
Co-Authored-By: David Brochart <david.brochart@gmail.com>
Co-Authored-By: Joseph Guhlin <joseph.guhlin@gmail.com>
Co-Authored-By: Thomas Kenbeek <thomaskenbeek@gmail.com>
Co-Authored-By: Remenby31 <baptiste.cruvellier31@gmail.com>
This commit is contained in:
Mathias Gesbert 2026-01-27 16:39:30 +01:00 committed by Mathias Gesbert
parent 79f215d91c
commit d33db9fff8
217 changed files with 16911 additions and 4305 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 FunctionCall, LLMMessage, Role, ToolCall
class SnapshotTestAppWithResumedSession(BaseSnapshotTestApp):
def __init__(self) -> None:
super().__init__()
# Simulate a previous session with messages
user_msg = LLMMessage(role=Role.user, content="Hello, how are you?")
assistant_msg = LLMMessage(
role=Role.assistant,
content="I'm doing well, thank you! Let me read that file for you.",
tool_calls=[
ToolCall(
id="tool_call_1",
index=0,
function=FunctionCall(
name="read_file", arguments='{"path": "test.txt"}'
),
)
],
)
tool_result_msg = LLMMessage(
role=Role.tool,
content="File content: This is a test file with some content.",
name="read_file",
tool_call_id="tool_call_1",
)
self.agent_loop.messages.extend([user_msg, assistant_msg, tool_result_msg])
def test_snapshot_shows_resumed_session_messages(snap_compare: SnapCompare) -> None:
async def run_before(pilot: Pilot) -> None:
# Wait for the app to initialize and rebuild history
await pilot.pause(0.5)
assert snap_compare(
"test_ui_snapshot_session_resume.py:SnapshotTestAppWithResumedSession",
terminal_size=(120, 36),
run_before=run_before,
)