LearnNewsExamplesServices
Frontmatter
id12529
titleRemove KB daemon B3 knowledgeBase fallbacks
stateClosed
labels
enhancementairefactoringarchitecture
assigneesneo-gpt
createdAtJun 4, 2026, 8:15 PM
updatedAtJun 4, 2026, 9:37 PM
githubUrlhttps://github.com/neomjs/neo/issues/12529
authorneo-gpt
commentsCount0
parentIssue12461
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 4, 2026, 9:37 PM

Remove KB daemon B3 knowledgeBase fallbacks

Closed v13.0.0/archive-v13-0-0-chunk-16 enhancementairefactoringarchitecture
neo-gpt
neo-gpt commented on Jun 4, 2026, 8:15 PM

Context

This is a narrow child leaf under the B3 production-read cleanup tracked by #12461 and parent Epic #12456. The broad #12461 workstream intentionally wants cluster-sized PRs; current open PR duplicate checks found GitLab (#12526 / PR #12528), ProtoSource (#12504 / PR #12505), and orchestrator (#12515 / PR #12516), but no leaf for the three Knowledge Base daemon helpers.

Current-source evidence on origin/dev:

  • ai/daemons/kb-alerting/KbAlertingService.mjs:225-235 documents and returns aiConfig.knowledgeBase || {}.
  • ai/daemons/kb-gc/KbGarbageCollectionService.mjs:264-274 documents and returns aiConfig.knowledgeBase || {}.
  • ai/daemons/kb-reconciliation/KbReconciliationService.mjs:248-258 documents and returns aiConfig.knowledgeBase || {}.
  • ai/config.template.mjs:582 declares the knowledgeBase config subtree as the owning source.

Duplicate sweep:

  • KB ticket search for KB daemon knowledgeBase || {} AiConfig B3 defensive reads kb-alerting kb-gc kb-reconciliation found historical KB daemon/config tickets, but no equivalent current B3 cleanup leaf.
  • Exact local/GitHub searches for knowledgeBase || {}, kb-alerting, kb-gc, and kb-reconciliation found #12461 as the parent cluster plus older daemon-location work, but no open leaf covering these three fallbacks.

The Problem

These helpers preserve a stale defensive seam: they convert a missing aiConfig.knowledgeBase subtree into {} and their JSDoc says this protects stale gitignored config.mjs overlays. ADR 0019 classifies this as B3: consumers must read the resolved Provider subtree directly and let SSOT shape failures fail loud.

The stale-overlay concern is real, but it belongs in deploy/bootstrap freshness, not a production consumer fallback. Keeping the fallback makes a broken config tree look like an intentionally-disabled daemon, which weakens the exact fail-loud behavior #12461 is removing.

The Architectural Reality

ADR 0019 is the source of authority: read resolved leaves at the use site; never defend against the AiConfig Provider SSOT. The parent #12461 explicitly calls out the kb-gc / kb-reconciliation / kb-alerting || {} guards as deploy-layer stale-config.mjs concerns, not code-side fallbacks.

The three helper methods are a coherent one-PR cluster because they share the same shape:

  • helper JSDoc says the config overlay can lack knowledgeBase;
  • helper returns aiConfig.knowledgeBase || {};
  • daemon startup behavior then treats missing config as disabled/empty rather than surfacing the malformed SSOT.

The Fix

Update the three KB daemon services to read aiConfig.knowledgeBase directly through their existing test-stubbable helper methods. Remove or rewrite JSDoc that describes stale config.mjs overlays as a supported code-side fallback. Keep each daemon's existing opt-in semantics and per-leaf fallback constants; this ticket only removes the subtree fallback.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
KbAlertingService.getKnowledgeBaseConfig() ai/daemons/kb-alerting/KbAlertingService.mjs; ai/config.template.mjs knowledgeBase subtree; ADR 0019 Return aiConfig.knowledgeBase directly. None in consumer; deploy/bootstrap must refresh stale overlays. Helper JSDoc no longer claims missing subtree is tolerated. Static guard proves no `aiConfig.knowledgeBase
KbGarbageCollectionService.getKnowledgeBaseConfig() ai/daemons/kb-gc/KbGarbageCollectionService.mjs; ai/config.template.mjs knowledgeBase subtree; ADR 0019 Return aiConfig.knowledgeBase directly. None in consumer; deploy/bootstrap must refresh stale overlays. Helper JSDoc no longer claims missing subtree is tolerated. Static guard proves no `aiConfig.knowledgeBase
KbReconciliationService.getKnowledgeBaseConfig() ai/daemons/kb-reconciliation/KbReconciliationService.mjs; ai/config.template.mjs knowledgeBase subtree; ADR 0019 Return aiConfig.knowledgeBase directly. None in consumer; deploy/bootstrap must refresh stale overlays. Helper JSDoc no longer claims missing subtree is tolerated. Static guard proves no `aiConfig.knowledgeBase

Decision Record impact

aligned-with ADR 0019 (AiConfig reactive Provider SSOT).

Acceptance Criteria

  • ai/daemons/kb-alerting/KbAlertingService.mjs contains no aiConfig.knowledgeBase || {} fallback and reads aiConfig.knowledgeBase directly.
  • ai/daemons/kb-gc/KbGarbageCollectionService.mjs contains no aiConfig.knowledgeBase || {} fallback and reads aiConfig.knowledgeBase directly.
  • ai/daemons/kb-reconciliation/KbReconciliationService.mjs contains no aiConfig.knowledgeBase || {} fallback and reads aiConfig.knowledgeBase directly.
  • JSDoc in all three helpers stops documenting stale gitignored config.mjs as a consumer-side fallback.
  • Targeted verification proves daemon opt-in behavior remains unchanged when the resolved knowledgeBase subtree exists with disabled leaves.
  • PR body cites ADR 0019 and relates back to #12461.

Out of Scope

  • Other B3 clusters under #12461, including memory-core, KB ingestion/vector, graph/ingestion, maintenance scripts, and examples.
  • Deploy/bootstrap remediation for stale gitignored config.mjs overlays; this ticket only removes the production consumer fallback.
  • Changing the daemon scheduling, alerting, garbage-collection, or reconciliation contracts beyond the subtree read.
  • Test-side B3/B4 cleanup.

Avoided Traps

  • Do not replace || {} with optional chaining or another local default object; that preserves the same B3 shape.
  • Do not move knowledgeBase defaults into the daemons; the config leaf/subtree owns defaults and environment binding.
  • Do not broaden this PR to every remaining #12461 match; the point is a small three-file daemon cluster.

Related

Parent B3 workstream: #12461 Parent Epic: #12456 Sibling leaves: #12504, #12515, #12526 Authority: ADR 0019 (learn/agentos/decisions/0019-aiconfig-reactive-provider-ssot.md)

Origin Session ID: dcdaac0b-9ae0-45b5-b4da-da39541af497

Handoff Retrieval Hint: query_raw_memories("KB daemon knowledgeBase fallback AiConfig B3 kb-alerting kb-gc kb-reconciliation") or search current source for aiConfig.knowledgeBase || {}.

tobiu referenced in commit e7e14d4 - "fix(ai): remove KB daemon B3 config defenses (#12529) (#12530) on Jun 4, 2026, 9:37 PM
tobiu closed this issue on Jun 4, 2026, 9:37 PM