LearnNewsExamplesServices
Frontmatter
id14231
titleMemoryService/SessionService AiConfig compliance: geminiApiKey leaf + miniSummary/chroma/graph-projection config constants (ADR-0019)
stateClosed
labels
enhancementaiarchitecture
assigneesneo-opus-ada
createdAtJun 27, 2026, 1:41 PM
updatedAtJun 27, 2026, 3:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/14231
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 27, 2026, 3:19 PM

MemoryService/SessionService AiConfig compliance: geminiApiKey leaf + miniSummary/chroma/graph-projection config constants (ADR-0019)

Closed v13.1.0/archive-v13-1-0-chunk-7 enhancementaiarchitecture
neo-opus-ada
neo-opus-ada commented on Jun 27, 2026, 1:41 PM

Context

@tobiu flagged (on #14207) that the MemoryService path carries ADR-0019 AiConfig violations — "AiConfig. no exceptions." V-B-A confirmed these are pre-existing hardcoded config + a raw process.env API-key read, distinct from the #14206/#14207 de-dup single-source. This ticket is the AiConfig-compliance half.

Violations (V-B-A'd against dev)

  1. geminiApiKey: process.env.GEMINI_API_KEYMemoryService.mjs:1476 + SessionService.mjs:177. A1 (module-level env read). There is an OpenAI-compatible apiKey leaf (config.template.mjs:190 → leaf('', 'NEO_OPENAI_COMPATIBLE_API_KEY', 'string')) but no Gemini equivalent, so the Gemini key is read raw from process.env at two sites.
  2. MemoryService config constants that should be AiConfig leaves: MINI_SUMMARY_TIMEOUT_MS=30000, MINI_SUMMARY_BACKFILL_MAX_RUN_MS=600000, MINI_SUMMARY_BACKFILL_FRESH_RESERVE=10, CHROMA_FETCH_TIMEOUT_MS=10000, GRAPH_PROJECTION_MAX_ATTEMPTS=5, GRAPH_PROJECTION_RETRY_BASE_MS=250, GRAPH_PROJECTION_RETRY_MAX_MS=5000, GRAPH_PROJECTION_DRAIN_INTERVAL_MS=60000, the local TIMEOUT_MS=20000 (_generateMiniSummary), and the 280-char miniSummary cap (BOTH the prompt-text hint AND the .slice(0, 280) return cap).

Acceptance Criteria

  • Add geminiApiKey: leaf('', 'GEMINI_API_KEY', 'string') at the root model tuple (mirroring the OpenAI apiKey leaf); MemoryService + SessionService read aiConfig.geminiApiKey at the use site (no process.env.GEMINI_API_KEY).
  • The MemoryService config constants become AiConfig leaves (a memoryService subtree); the miniSummary cap is leaf-driven at BOTH the prompt hint and the .slice() return cap.
  • No process.env config reads + no hardcoded config constants remain in the MemoryService read/write/projection paths.
  • Behavior-preserving (the leaf defaults equal the current literals); existing MemoryService/SessionService specs pass.

Contract Ledger

Surface Change Consumers Compatibility
AiConfig.geminiApiKey (new leaf) NEW — Gemini API-key SSOT (mirrors OpenAI apiKey) MemoryService, SessionService, TextEmbeddingService Additive; default '' → behavior-preserving
AiConfig.memoryService.* (new section, 10 leaves: miniSummary timeout/backfill-max-run/fresh-reserve/max-chars, generate-miniSummary timeout, chroma-fetch timeout, graph-projection max-attempts/retry-base/retry-max/drain-interval) NEW — MC timeouts/retry/cadence/miniSummary-cap SSOT MemoryService Additive; defaults = the prior literals → behavior-preserving

Out of Scope

  • The #14206/#14207 de-dup single-source (that's the de-dup half) — this is the orthogonal AiConfig-compliance pass on the same files.

Related

#14207 (where @tobiu flagged it), #14193 (de-dup epic, same files), ADR-0019 (the AiConfig SSOT read-gate). PR: #14234.

Authored by Ada (@neo-opus-ada · Claude Opus 4.8, Claude Code).

tobiu referenced in commit 60de469 - "refactor(ai): read geminiApiKey from an AiConfig leaf, not process.env, across the MC services (ADR-0019) (#14231) (#14234) on Jun 27, 2026, 3:19 PM
tobiu closed this issue on Jun 27, 2026, 3:19 PM