Skip to content

test(multi-agent): end-to-end integration coverage#462

Merged
memtomem merged 2 commits intomainfrom
test/multi-agent-integration-e2e
Apr 24, 2026
Merged

test(multi-agent): end-to-end integration coverage#462
memtomem merged 2 commits intomainfrom
test/multi-agent-integration-e2e

Conversation

@memtomem
Copy link
Copy Markdown
Owner

Summary

Adds tests/test_multi_agent_integration.py — eight end-to-end cases
that exercise the full MCP tool surface (mem_agent_register /
mem_search / mem_agent_search / mem_agent_share /
mem_session_start) and the LangGraph adapter against a real
BM25-only component stack.

The unit tests in test_multi_agent.py and test_sessions.py already
pin each helper's contract in isolation (_resolve_agent_namespace
priority table, _build_shared_tags dedup invariant,
_resolve_search_namespace 6-case matrix); this file checks that the
four pieces compose end-to-end without silently regressing.

Cases

Discovery — follow-up to track

mem_agent_share calls mem_add, which writes tags into the markdown
blockquote header (> tags: [...]) instead of YAML frontmatter. The
indexer extracts only YAML frontmatter, so the audit tag
(shared-from=<uuid>) lives in the chunk content and not in
ChunkMetadata.tags — searchable by BM25 but not by tag_filter.
Promoting the blockquote header to first-class metadata is tracked
as a follow-up RFC; the test asserts the tag in chunk.content with
a docstring noting the constraint.

Test plan

  • uv run pytest packages/memtomem/tests/test_multi_agent_integration.py -v — 8/8 pass.
  • uv run pytest -m "not ollama" — 2384 passed, 46 deselected.
  • uv run ruff check + ruff format --check — clean.

🤖 Generated with Claude Code

pandas-studio and others added 2 commits April 25, 2026 07:14
…d PRs

Adds `tests/test_multi_agent_integration.py` — eight cases that
exercise the full MCP tool surface (`mem_agent_register` /
`mem_search` / `mem_agent_search` / `mem_agent_share` /
`mem_session_start`) and the LangGraph adapter against a real
BM25-only component stack. The unit tests in `test_multi_agent.py`
and `test_sessions.py` already pin each helper's contract in
isolation; this file checks that the four pieces compose end-to-end
without silently regressing.

Cases:

* **A — namespace isolation** (PR-1, #457): `agent-runtime:alpha`
  chunks excluded from `mem_search` for an agent-blind caller;
  `mem_agent_search(agent_id="alpha")` reaches them by pinning the
  namespace explicitly.
* **B — share trail** (PR-3, #458): `mem_agent_share(target="shared")`
  lands a copy in the shared namespace with the
  `shared-from=<source-uuid>` audit trail; the receiving agent's
  `mem_agent_search(include_shared=True)` surfaces the copy and
  `include_shared=False` correctly excludes it.
* **C — session→agent_id inheritance** (PR-2, #459):
  `mem_session_start(agent_id="planner")` lets a subsequent
  `mem_agent_search(agent_id=None)` resolve to the planner's
  namespace + shared without the caller repeating the identity;
  explicit `agent_id` overrides the session binding.
* **D — LangGraph adapter** (PR-4, #460):
  `MemtomemStore.start_agent_session("planner")` defaults `add()`
  writes to `agent-runtime:planner` and gates `search(include_shared=True)`
  to planner+shared (excluding other agents' private chunks);
  `include_shared=True` without a bound agent raises `ValueError`.

Discovery during testing — a follow-up to track:

* `mem_agent_share` calls `mem_add`, which writes tags into the
  markdown blockquote header (`> tags: [...]`) instead of YAML
  frontmatter. The indexer extracts only YAML frontmatter, so the
  audit tag (`shared-from=<uuid>`) lives in the chunk *content* and
  not in `ChunkMetadata.tags` — searchable by BM25 but not by
  `tag_filter`. Promoting the blockquote header to first-class
  metadata is tracked as a follow-up RFC; the test asserts the tag
  in `chunk.content` and documents the constraint inline.

`uv run pytest -m "not ollama"` — 2384 passed, 46 deselected.

Co-Authored-By: Claude <[email protected]>
* Extract the ``MEMTOMEM_*`` env-var clear + ``load_config_overrides``
  stub into a module-level ``_isolate_memtomem_env`` helper instead of
  duplicating it across the fixture and the two LangGraph adapter
  tests. Adding a new top-level config section's env binding now means
  editing one tuple, not three.
* Drop the ``assert SHARED_NAMESPACE in share_out`` check on the
  ``mem_agent_share`` return string — the storage-side inspection that
  follows is the strong assertion, and pinning the cosmetic
  return-string format makes the test brittle for no extra coverage.
* Expand the comment on the ``store._ensure_init()`` reach-through in
  the LangGraph adapter test to spell out *why* internal access is
  necessary (no public ``namespace=`` override on ``store.add`` for
  writing outside the bound agent), so a future reader doesn't try to
  rewrite the seeding step against the public surface.

Co-Authored-By: Claude <[email protected]>
@memtomem memtomem merged commit 05eb83f into main Apr 24, 2026
7 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
@memtomem memtomem deleted the test/multi-agent-integration-e2e branch April 27, 2026 14:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants