gitgram/aitimemachine/pal-mcp-server/tests/test_conversation_continuation_integration.py
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

41 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_absolute_path=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]