vibe/tests/agent_loop/test_agent_loop_refresh_system_prompt.py
Laure Hugo e607ccbb00
v2.18.0 (#843)
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Cyprien <courtot.c@gmail.com>
Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com>
Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com>
Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Nelson PROIA <144663685+Nelson-PROIA@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: josephine-delas <57808586+josephine-delas@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
2026-06-25 16:08:45 +02:00

32 lines
1.2 KiB
Python

from __future__ import annotations
import pytest
from tests.conftest import build_test_agent_loop, build_test_vibe_config
@pytest.mark.asyncio
async def test_refresh_system_prompt_preserves_scratchpad_section() -> None:
# Regression: refresh_system_prompt must pass scratchpad_dir, otherwise
# it silently drops the scratchpad instructions from the system prompt.
# This fires on every session start/resume via initialize_experiments
# and hydrate_experiments_from_session, so the LLM would lose awareness
# of the scratchpad on the very first turn for any user with telemetry
# enabled and a Mistral API key.
config = build_test_vibe_config(
include_prompt_detail=True,
include_model_info=False,
include_commit_signature=False,
)
agent = build_test_agent_loop(config=config)
initial_prompt = agent.messages[0].content or ""
assert "Scratchpad Directory" in initial_prompt
assert agent.scratchpad_dir is not None
assert str(agent.scratchpad_dir) in initial_prompt
await agent.refresh_system_prompt()
refreshed_prompt = agent.messages[0].content or ""
assert "Scratchpad Directory" in refreshed_prompt
assert str(agent.scratchpad_dir) in refreshed_prompt