Files
my-pal-mcp-server/tests/test_conversation_continuation_integration.py
Fahad ece8a5ebed feat!: Full code can now be generated by an external model and shared with the AI tool (Claude Code / Codex etc)!
model definitions now support a new `allow_code_generation` flag, only to be used with higher reasoning models such as GPT-5-Pro and-Gemini 2.5-Pro

 When `true`, the `chat` tool can now request the external model to generate a full implementation / update / instructions etc and then share the implementation with the calling agent.

 This effectively allows us to utilize more powerful models such as GPT-5-Pro to generate code for us or entire implementations (which are either API-only or part of the $200 Pro plan from within the ChatGPT app)
2025-10-07 18:49:13 +04:00

37 lines
1.4 KiB
Python

"""Integration test for conversation continuation persistence."""
from tools.chat import ChatRequest, ChatTool
from utils.conversation_memory import get_thread
from utils.storage_backend import get_storage_backend
def test_first_response_persisted_in_conversation_history(tmp_path):
"""Ensure the assistant's initial reply is stored for newly created threads."""
# Clear in-memory storage to avoid cross-test contamination
storage = get_storage_backend()
storage._store.clear() # type: ignore[attr-defined]
tool = ChatTool()
request = ChatRequest(prompt="First question?", model="local-llama", working_directory=str(tmp_path))
response_text = "Here is the initial answer."
# Mimic the first tool invocation (no continuation_id supplied)
continuation_data = tool._create_continuation_offer(request, model_info={"model_name": "local-llama"})
tool._create_continuation_offer_response(
response_text,
continuation_data,
request,
{"model_name": "local-llama", "provider": "custom"},
)
thread_id = continuation_data["continuation_id"]
thread = get_thread(thread_id)
assert thread is not None
assert [turn.role for turn in thread.turns] == ["user", "assistant"]
assert thread.turns[-1].content == response_text
# Cleanup storage for subsequent tests
storage._store.clear() # type: ignore[attr-defined]