Skip to content

test(memory): assert owner gating blocks relay through foreign memories - #73

Merged
rdasilveiracabral merged 1 commit into
NVIDIA-NeMo:mainfrom
Yeriahz:test-memory-owner-relay-1
Aug 1, 2026
Merged

test(memory): assert owner gating blocks relay through foreign memories#73
rdasilveiracabral merged 1 commit into
NVIDIA-NeMo:mainfrom
Yeriahz:test-memory-owner-relay-1

Conversation

@Yeriahz

@Yeriahz Yeriahz commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a regression test for a property that the code delivers but nothing asserts. Test-only; no production code touched.

Background

_spread() in packages/nooa-memory/src/nooa_memory/retrieval.py gates spreading activation by owner. Its docstring claims an edge "must not leak — or amplify through — another agent's memory in an owner-scoped recall."

Both halves hold, because the continue on the visibility check fires before nxt[e.target_id] is written and not only before the spread write. An invisible memory therefore never enters the next hop's frontier and cannot relay activation between two visible ones.

Existing coverage is test_spread_does_not_leak_foreign_memories here and test_spread_confined_to_role in test_memory_owner_roles.py. Both build a single edge across an owner boundary, so they pin the leak half. Neither builds the three-node own -> foreign -> own case, which means the position of the continue is load-bearing but asserted nowhere. Moving the visibility check to just before the spread write looks harmless and quietly reopens the path.

This gap was identified by @neoneye while reviewing NOOA's memory system for the Agent Memory Atlas: https://neoneye.github.io/agent-memory-atlas/systems/nooa-memory/

Why it asserts on _spread rather than recall

The property is not observable at the public API. A relay target owned by a third party is gated on its own merits; one owned by the reader is retrieved directly regardless of the graph. What a relay changes is activation, and therefore ranking, which only exists inside _spread.

The test includes an unscoped positive control asserting the two-hop path is live, so the scoped assertion cannot pass merely because nothing was reachable.

Related issues

None.

Validation

uv run pytest packages/nooa-memory/ -q          # 265 passed, 13 skipped
uv run ruff format --check / ruff check         # clean

Run against main at e505bb9.

Checklist

  • Code follows the project style (uv run ruff check . and uv run ruff format --check . pass)
  • Tests added/updated and passing (uv run pytest)
  • Docs updated if behavior or public APIs changed — no behavior change
  • New source files carry an SPDX license header — no new files

Signed-off-by: Jeriah Keith <jeriahkeithit@gmail.com>
@rdasilveiracabral
rdasilveiracabral merged commit 194335d into NVIDIA-NeMo:main Aug 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants