test(memory): assert owner gating blocks relay through foreign memories - #73
Merged
rdasilveiracabral merged 1 commit intoAug 1, 2026
Merged
Conversation
Signed-off-by: Jeriah Keith <jeriahkeithit@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()inpackages/nooa-memory/src/nooa_memory/retrieval.pygates 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
continueon the visibility check fires beforenxt[e.target_id]is written and not only before thespreadwrite. 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_memorieshere andtest_spread_confined_to_roleintest_memory_owner_roles.py. Both build a single edge across an owner boundary, so they pin the leak half. Neither builds the three-nodeown -> foreign -> owncase, which means the position of thecontinueis 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
_spreadrather thanrecallThe 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
Run against
mainat e505bb9.Checklist
uv run ruff check .anduv run ruff format --check .pass)uv run pytest)