Context
This is a narrow B3 cleanup child under #12461 / #12456 for the Memory Core mailbox reply-policy read.
Current verified source on origin/dev:
const strictReplyPolicy = aiConfig.mailbox?.defaultReplyPolicy === 'blocked';
V-B-A collision sweep run before filing:
git grep -n -E "(aiConfig|AiConfig)(\.[A-Za-z0-9_]+)*\?\." origin/dev -- ai/services/memory-core/MailboxService.mjs found only the MailboxService reply-policy read for this scope.
gh issue list --state open --search "MailboxService defaultReplyPolicy AiConfig B3" returned no open issues.
gh pr list --state open --search "MailboxService defaultReplyPolicy AiConfig" returned no open PRs.
- Existing B3 lanes are disjoint: maintenance scripts (#12541/#12542), GitLab HealthService (#12526/#12528), and ConceptDiscoveryService (#12538/#12539).
Problem
MailboxService.addMessage() gates strict reply behavior using an optional-chain read of aiConfig.mailbox.defaultReplyPolicy. Under ADR 0019, resolved AiConfig leaves are the use-site source of truth and B3 defensive reads should fail loudly instead of silently degrading when a required config subtree is absent.
The current ?. masks missing mailbox configuration by treating the strict policy as false, which can weaken the configured reply-policy contract without surfacing the configuration drift.
Architectural Reality
ai/mcp/server/memory-core/config.mjs defines the mailbox subtree and defaultReplyPolicy leaf. MailboxService is a consumer of that resolved config, not an owner or fallback surface.
B3 cleanup means removing defensive optional chaining on config reads while preserving the existing policy behavior:
'blocked' enables strict reply-policy enforcement.
'open' keeps reply behavior permissive.
- Missing config should fail at the read site rather than becoming an implicit open policy.
Fix
Replace the defensive read in ai/services/memory-core/MailboxService.mjs with a direct resolved-leaf read:
const strictReplyPolicy = aiConfig.mailbox.defaultReplyPolicy === 'blocked';
Do not introduce a local fallback, alias, re-export, or default in MailboxService.
Contract Ledger
| Consumed Surface |
Required Contract |
Why it matters |
MailboxService.addMessage() reply-policy gate |
Reads aiConfig.mailbox.defaultReplyPolicy directly |
A missing mailbox config subtree must fail loudly instead of silently bypassing strict reply enforcement |
ai/mcp/server/memory-core/config.mjs mailbox subtree |
Owns mailbox.defaultReplyPolicy as the resolved config leaf |
Keeps AiConfig as the single source of truth per ADR 0019 |
| Existing MailboxService policy tests |
Continue proving both blocked and open policy behavior |
Confirms this is a B3 read-shape cleanup, not a policy semantic change |
Decision Record Impact
Aligned with ADR 0019: the reactive Provider-backed AiConfig singleton remains the SSOT. This ticket removes a consumer-side defensive read and does not create new config ownership.
Acceptance Criteria
MailboxService.addMessage() no longer uses aiConfig.mailbox?.defaultReplyPolicy.
- The replacement is a direct resolved-leaf read with no fallback.
- Focused MailboxService unit coverage still passes for blocked and open reply-policy behavior.
- The change does not alter mailbox policy semantics, A2A message delivery, or permission behavior.
Out of Scope
- B4 cleanup of test-level singleton mutation patterns.
- Changing the default reply policy.
- Other #12461 B3 clusters in TransportService, MemoryService, SummaryService, SessionService, CollectionProxy, Orchestrator, BaseServer, or Logger.
Related
- Parent: #12461
- Epic: #12456
- ADR:
learn/agentos/decisions/0019-aiconfig-reactive-provider-ssot.md
Origin Session
dcdaac0b-9ae0-45b5-b4da-da39541af497
Retrieval Hint
MailboxService defaultReplyPolicy AiConfig B3 ADR 0019
Context
This is a narrow B3 cleanup child under #12461 / #12456 for the Memory Core mailbox reply-policy read.
Current verified source on
origin/dev:const strictReplyPolicy = aiConfig.mailbox?.defaultReplyPolicy === 'blocked';V-B-A collision sweep run before filing:
git grep -n -E "(aiConfig|AiConfig)(\.[A-Za-z0-9_]+)*\?\." origin/dev -- ai/services/memory-core/MailboxService.mjsfound only the MailboxService reply-policy read for this scope.gh issue list --state open --search "MailboxService defaultReplyPolicy AiConfig B3"returned no open issues.gh pr list --state open --search "MailboxService defaultReplyPolicy AiConfig"returned no open PRs.Problem
MailboxService.addMessage()gates strict reply behavior using an optional-chain read ofaiConfig.mailbox.defaultReplyPolicy. Under ADR 0019, resolved AiConfig leaves are the use-site source of truth and B3 defensive reads should fail loudly instead of silently degrading when a required config subtree is absent.The current
?.masks missingmailboxconfiguration by treating the strict policy as false, which can weaken the configured reply-policy contract without surfacing the configuration drift.Architectural Reality
ai/mcp/server/memory-core/config.mjsdefines themailboxsubtree anddefaultReplyPolicyleaf.MailboxServiceis a consumer of that resolved config, not an owner or fallback surface.B3 cleanup means removing defensive optional chaining on config reads while preserving the existing policy behavior:
'blocked'enables strict reply-policy enforcement.'open'keeps reply behavior permissive.Fix
Replace the defensive read in
ai/services/memory-core/MailboxService.mjswith a direct resolved-leaf read:const strictReplyPolicy = aiConfig.mailbox.defaultReplyPolicy === 'blocked';Do not introduce a local fallback, alias, re-export, or default in
MailboxService.Contract Ledger
MailboxService.addMessage()reply-policy gateaiConfig.mailbox.defaultReplyPolicydirectlyai/mcp/server/memory-core/config.mjsmailbox subtreemailbox.defaultReplyPolicyas the resolved config leafDecision Record Impact
Aligned with ADR 0019: the reactive Provider-backed AiConfig singleton remains the SSOT. This ticket removes a consumer-side defensive read and does not create new config ownership.
Acceptance Criteria
MailboxService.addMessage()no longer usesaiConfig.mailbox?.defaultReplyPolicy.Out of Scope
Related
learn/agentos/decisions/0019-aiconfig-reactive-provider-ssot.mdOrigin Session
dcdaac0b-9ae0-45b5-b4da-da39541af497Retrieval Hint
MailboxService defaultReplyPolicy AiConfig B3 ADR 0019