Context
Same CI run as #12973 (PR #12971's unit job): two memory-core specs flaked (failed, then passed on retry) — surfaced by the operator from the logs.
Release classification: post-release — flaky-not-broken; costs retry minutes and erodes suite trust.
The Problem
Two distinct flake sites, one shared class — mutable shared state (graph identities / mailbox receipts) bleeding across tests:
MailboxService.spec.mjs:1155 ("#11029 broadcast markRead updates only the caller delivery receipt"): expected unread 1 for @gpt after the caller-scoped markRead, got 0 — a sibling test's receipt state (or identity binding) leaked into the assertion window (:1203).
WriteSideInvariant.spec.mjs:114 ("addMessage succeeds with a bound agent identity"): addMessage REJECTED '@neo-test-receiver' — "Expected '@' … matching a REGISTERED AgentIdentity graph node" (MailboxService.mjs:108). The test's receiver identity wasn't registered in the graph state the test observed — a registration-ordering / fixture-isolation race: the validation hardened in #10174-family work now requires graph-registered identities, and the spec's setup either registers too late or a parallel spec's teardown removes it.
Both passing on retry = state-order dependent, not logic defects.
The Architectural Reality
- The memory-core unit specs share a live test database/graph context within a worker; identity registration (
AgentIdentity nodes) and delivery receipts are cross-test-visible mutable state.
validateMailboxTarget (MailboxService.mjs:108) is strict-by-design (the #10174 anti-spoof lineage) — the fix is test-side isolation, not validation loosening.
The Fix
- Both specs get deterministic setup: register the identities they assert against IN the test's own beforeEach (idempotent upsert), and scope receipt assertions to identities no sibling spec touches (unique per-spec identities, e.g.
@neo-test-receiver-<specHash>).
- If the suite runs these files in parallel workers against one DB: serialize the memory-core project or namespace the test tenant per worker (whichever the existing harness supports cheapest).
Acceptance Criteria
Out of Scope
- #12973 (the deterministic content-fixture break, sibling).
- Unit tests performing real GitHub API calls (rate/504 weather noise observed in the same logs — separate observation, ticket only if it recurs as a failure rather than noise).
Related
#12973 (same CI run), #10174 / #11029 (the contracts the flaking tests pin), PR #12971.
Sweep note: live latest-open sweep waived under the active GitHub API rate-limit exhaustion; defects born this hour, session-fresh knowledge confirms no duplicate.
Origin Session ID: e605ce21-3668-445c-bc00-45896aa9a092
Retrieval Hint: "memory-core unit flake markRead unread count addMessage registered identity isolation"
Context
Same CI run as #12973 (PR #12971's unit job): two memory-core specs flaked (failed, then passed on retry) — surfaced by the operator from the logs.
Release classification:post-release — flaky-not-broken; costs retry minutes and erodes suite trust.The Problem
Two distinct flake sites, one shared class — mutable shared state (graph identities / mailbox receipts) bleeding across tests:
MailboxService.spec.mjs:1155("#11029 broadcast markRead updates only the caller delivery receipt"): expected unread1for@gptafter the caller-scoped markRead, got0— a sibling test's receipt state (or identity binding) leaked into the assertion window (:1203).WriteSideInvariant.spec.mjs:114("addMessage succeeds with a bound agent identity"):addMessageREJECTED'@neo-test-receiver'— "Expected '@MailboxService.mjs:108). The test's receiver identity wasn't registered in the graph state the test observed — a registration-ordering / fixture-isolation race: the validation hardened in #10174-family work now requires graph-registered identities, and the spec's setup either registers too late or a parallel spec's teardown removes it.Both passing on retry = state-order dependent, not logic defects.
The Architectural Reality
AgentIdentitynodes) and delivery receipts are cross-test-visible mutable state.validateMailboxTarget(MailboxService.mjs:108) is strict-by-design (the #10174 anti-spoof lineage) — the fix is test-side isolation, not validation loosening.The Fix
@neo-test-receiver-<specHash>).Acceptance Criteria
--repeat-each=20or loop).Out of Scope
Related
#12973 (same CI run), #10174 / #11029 (the contracts the flaking tests pin), PR #12971.
Sweep note: live latest-open sweep waived under the active GitHub API rate-limit exhaustion; defects born this hour, session-fresh knowledge confirms no duplicate.
Origin Session ID: e605ce21-3668-445c-bc00-45896aa9a092
Retrieval Hint: "memory-core unit flake markRead unread count addMessage registered identity isolation"