@@ -5,6 +5,7 @@ from unittest.mock import MagicMock, patch
|
||||
from tai.ai_client import DEFAULT_AI_HOST, DEFAULT_MODEL, AIClient, AIConfig
|
||||
from tai.collectors import CollectedItem, CollectionReport
|
||||
from tai.prompt_builder import build_followup_message, build_system_prompt, build_user_message
|
||||
from tai.session_store import PastSession
|
||||
from tai.ssh_client import SSHCommandResult
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -221,6 +222,24 @@ def test_build_user_message_handles_no_output() -> None:
|
||||
assert "no output" in msg
|
||||
|
||||
|
||||
def test_build_user_message_includes_prior_session_context() -> None:
|
||||
report = _make_report([("kernel", "uname -a", 0, "Linux web01", "")])
|
||||
msg = build_user_message(
|
||||
"sssd broken",
|
||||
report,
|
||||
past_sessions=[
|
||||
PastSession(
|
||||
session_id="20260506T120000Z",
|
||||
host="web01",
|
||||
issue="sssd broken",
|
||||
summary="Root cause was missing sssd package.",
|
||||
)
|
||||
],
|
||||
)
|
||||
assert "Similar prior sessions" in msg
|
||||
assert "missing sssd package" in msg
|
||||
|
||||
|
||||
def test_build_followup_message_includes_question_context() -> None:
|
||||
report = _make_report([("kernel", "uname -a", 0, "Linux web01", "")])
|
||||
msg = build_followup_message(
|
||||
|
||||
Reference in New Issue
Block a user