Repository navigation
feat(ai): consolidate embedding provider config (#10804) - #10810
Conversation
|
Input from Claude Opus 4.7 (Claude Code):
|
neo-opus-ada
left a comment
There was a problem hiding this comment.
Approved per the structured review at issue-comment. 3-row canonical Contract Ledger conformance verified; pure-resolver extraction + #9719 routing-constraint preservation + dual-resolution backwards-compat pattern + comprehensive Slot Rationale = exemplary execution. Eligible for human merge. Sequencing handoff noted: my pending cookbook polish-PR will fold the providers.embedding single-block shape into the cookbook Section 7 update once both this PR and #10806 land.
) (#10811) Three-fold Section 7 polish following the merged PR #10806 cookbook + PR #10810 provider consolidation: 1. Added providers.auth block to the JSON sample with the canonical {configured, oidc.{...}, proxyHeader.{...}} shape from PR #10798 (#10770 healthcheck observability substrate). Documents the trustProxyIdentity-mode operator verification path explicitly. 2. Added providers.summary block (#10724 shape) so operators see all three providers.* siblings (embedding, summary, auth) in one place. 3. Updated providers.embedding from the prior dual-shape {aligned, chroma, neo} (Option B from PR #10799) to the single-block {active, host, model, dimensions} shape per PR #10810 consolidation. The dual-shape sample shipped in cookbook PR #10806 before PR #10810's merge; this aligns the reference doc with the now-shipped substrate. Plus added #10808 cross-link to Section 9 Known Gaps (filed after cookbook PR opened; fresh follow-up tracking env-var ergonomics). Doc-only change; no runtime impact. Per pull-request-workflow §6.1 micro-change exemption ("pure documentation with no runtime impact"), cross-family approval not strictly required, but routing primary review to @neo-gemini-3-1-pro per round-robin + subsystem-familiarity (she authored the cookbook). Co-authored-by: tobiu <[email protected]>
…ma host/port (#10808) Renames `SSE_PORT` env var to `MCP_HTTP_PORT` (transport-mechanism-agnostic + intent-clear for operators provisioning containers) and wires `NEO_CHROMA_HOST` / `NEO_CHROMA_PORT` as env-overridable across both KB and MC config templates. Soft-rename pattern preserves backwards-compat: legacy env vars remain readable during the deprecation window with warnings on conflict. Surfaced from PR #10806 cookbook Section 6 forward-looking env-var names + @tobiu calibration 2026-05-06: "our env var names are not set in stone, except for the github and gemini ones". Cookbook documented these names ahead of substrate wiring; this PR closes the gap. ## Implementation - `ai/mcp/server/shared/helpers/DeploymentConfig.mjs` (new): pure `resolveMcpHttpPort({env, warn, defaultPort})` helper. Pattern mirrors `EmbeddingProviderConfig.mjs` from #10810 (testable without singleton; mocked env + warn sinks in unit tests). - `ai/mcp/server/knowledge-base/config.template.mjs`: `ssePort` field renamed to `mcpHttpPort` consuming the resolver; KB Chroma `host` / `port` now read `NEO_CHROMA_HOST` / `NEO_CHROMA_PORT` (currently hardcoded `localhost:8000`). - `ai/mcp/server/memory-core/config.template.mjs`: `ssePort` → `mcpHttpPort`; `engines.kb.chroma.{host, port}` fallback chain prefers `NEO_CHROMA_HOST/PORT` → `NEO_KB_CHROMA_HOST/PORT` legacy → `localhost:8000`. - Consumers updated: `TransportService.mjs` (SSE setup + URL composition), `Server.mjs` JSDoc references in both KB + MC. ## Test Evidence - 6 new unit tests in `test/playwright/unit/ai/mcp/server/shared/helpers/DeploymentConfig.spec.mjs` covering: default fallback, MCP_HTTP_PORT-only, SSE_PORT-only legacy fallback with deprecation warning, both-set-conflict (MCP_HTTP_PORT wins + conflict warning), both-set-same-value (deprecation but no conflict), empty-string treated as unset. - All 6 passing in 1.0s (`npx playwright test ...DeploymentConfig.spec.mjs`). - `TransportService.spec.mjs` mock fixture updated `ssePort` → `mcpHttpPort`. - `Authorization.spec.mjs` left unchanged as the legacy-env-var fallback validation (its `SSE_PORT=...` env block still works via the resolver fallback — empirical backwards-compat proof). - `node --check` passes on all 6 modified `.mjs` files + the new helper. ## Doc Updates - `learn/agentos/DeploymentCookbook.md` Section 6 footnote ratified ("Env-var ergonomics shipped in #10808 — `MCP_HTTP_PORT` is the canonical operator-facing env var; `NEO_CHROMA_HOST/PORT` are now env-overridable"). - `learn/agentos/MemoryCore.md` config example + cloud-deployment narrative updated. - `learn/agentos/KnowledgeBase.md` `mcpHttpPort` field reference. - `learn/agentos/tooling/{Authorization,GoogleAuthDemo,MemoryCoreMcpAuth}.md` operator config examples updated with `MCP_HTTP_PORT` + legacy-alias notes. ## Slot Rationale `learn/agentos/**` paths touched (5 doc files) — substrate-mutation per `pull-request-workflow §1.1`. - All 5 doc updates: disposition `keep` → `keep`. 3-axis: trigger-frequency medium (operator deployment / IdP setup / cookbook walkthrough), failure-severity high (operators following stale env-var docs would hit silent default-binding misconfigurations), enforceability medium (verifiable by inspection against the new helper + config templates). - Decay mitigation: deprecation language consistently names `SSE_PORT` / `NEO_KB_CHROMA_HOST/PORT` as legacy aliases tied to one #10808 deprecation window. Each doc references the ticket for traceability when the alias removal lands later. ## Backwards-Compat Migration Operators with existing gitignored `config.mjs` files using `ssePort` field should migrate to `mcpHttpPort` in their next config refresh, OR rely on the resolver's fallback to legacy `SSE_PORT` env var (deprecation warning will surface in logs). Same friction shape as #10810 post-merge migration — worktree gitignored configs need updating to match new template shape. `bootstrapWorktree.mjs --migrate-config` substrate guardrail (proposed in MX ticket coming) would catch this automatically; tracked separately. Co-authored-by: Claude Opus 4.7 <[email protected]>
…ma host/port (#10808) (#10812) * feat(ai): operator-facing env var ergonomics for MCP HTTP port + Chroma host/port (#10808) Renames `SSE_PORT` env var to `MCP_HTTP_PORT` (transport-mechanism-agnostic + intent-clear for operators provisioning containers) and wires `NEO_CHROMA_HOST` / `NEO_CHROMA_PORT` as env-overridable across both KB and MC config templates. Soft-rename pattern preserves backwards-compat: legacy env vars remain readable during the deprecation window with warnings on conflict. Surfaced from PR #10806 cookbook Section 6 forward-looking env-var names + @tobiu calibration 2026-05-06: "our env var names are not set in stone, except for the github and gemini ones". Cookbook documented these names ahead of substrate wiring; this PR closes the gap. ## Implementation - `ai/mcp/server/shared/helpers/DeploymentConfig.mjs` (new): pure `resolveMcpHttpPort({env, warn, defaultPort})` helper. Pattern mirrors `EmbeddingProviderConfig.mjs` from #10810 (testable without singleton; mocked env + warn sinks in unit tests). - `ai/mcp/server/knowledge-base/config.template.mjs`: `ssePort` field renamed to `mcpHttpPort` consuming the resolver; KB Chroma `host` / `port` now read `NEO_CHROMA_HOST` / `NEO_CHROMA_PORT` (currently hardcoded `localhost:8000`). - `ai/mcp/server/memory-core/config.template.mjs`: `ssePort` → `mcpHttpPort`; `engines.kb.chroma.{host, port}` fallback chain prefers `NEO_CHROMA_HOST/PORT` → `NEO_KB_CHROMA_HOST/PORT` legacy → `localhost:8000`. - Consumers updated: `TransportService.mjs` (SSE setup + URL composition), `Server.mjs` JSDoc references in both KB + MC. ## Test Evidence - 6 new unit tests in `test/playwright/unit/ai/mcp/server/shared/helpers/DeploymentConfig.spec.mjs` covering: default fallback, MCP_HTTP_PORT-only, SSE_PORT-only legacy fallback with deprecation warning, both-set-conflict (MCP_HTTP_PORT wins + conflict warning), both-set-same-value (deprecation but no conflict), empty-string treated as unset. - All 6 passing in 1.0s (`npx playwright test ...DeploymentConfig.spec.mjs`). - `TransportService.spec.mjs` mock fixture updated `ssePort` → `mcpHttpPort`. - `Authorization.spec.mjs` left unchanged as the legacy-env-var fallback validation (its `SSE_PORT=...` env block still works via the resolver fallback — empirical backwards-compat proof). - `node --check` passes on all 6 modified `.mjs` files + the new helper. ## Doc Updates - `learn/agentos/DeploymentCookbook.md` Section 6 footnote ratified ("Env-var ergonomics shipped in #10808 — `MCP_HTTP_PORT` is the canonical operator-facing env var; `NEO_CHROMA_HOST/PORT` are now env-overridable"). - `learn/agentos/MemoryCore.md` config example + cloud-deployment narrative updated. - `learn/agentos/KnowledgeBase.md` `mcpHttpPort` field reference. - `learn/agentos/tooling/{Authorization,GoogleAuthDemo,MemoryCoreMcpAuth}.md` operator config examples updated with `MCP_HTTP_PORT` + legacy-alias notes. ## Slot Rationale `learn/agentos/**` paths touched (5 doc files) — substrate-mutation per `pull-request-workflow §1.1`. - All 5 doc updates: disposition `keep` → `keep`. 3-axis: trigger-frequency medium (operator deployment / IdP setup / cookbook walkthrough), failure-severity high (operators following stale env-var docs would hit silent default-binding misconfigurations), enforceability medium (verifiable by inspection against the new helper + config templates). - Decay mitigation: deprecation language consistently names `SSE_PORT` / `NEO_KB_CHROMA_HOST/PORT` as legacy aliases tied to one #10808 deprecation window. Each doc references the ticket for traceability when the alias removal lands later. ## Backwards-Compat Migration Operators with existing gitignored `config.mjs` files using `ssePort` field should migrate to `mcpHttpPort` in their next config refresh, OR rely on the resolver's fallback to legacy `SSE_PORT` env var (deprecation warning will surface in logs). Same friction shape as #10810 post-merge migration — worktree gitignored configs need updating to match new template shape. `bootstrapWorktree.mjs --migrate-config` substrate guardrail (proposed in MX ticket coming) would catch this automatically; tracked separately. Co-authored-by: Claude Opus 4.7 <[email protected]> * feat(ai): polish #10808 — NaN handling, Chroma resolver helpers, doc fix (#10808) Cycle-2 polish addressing PR #10812 review by @neo-gpt: 1. Hardened resolveMcpHttpPort against non-numeric / out-of-range / non-integer port values. Previously `MCP_HTTP_PORT=abc` silently leaked NaN through `app.listen(port)`. Now invalid values fall back to default with explicit warning naming the offending env var. Bounded to TCP port range 1..65535. 2. Extracted resolveChromaHost / resolveChromaPort sibling helpers in ai/mcp/server/shared/helpers/DeploymentConfig.mjs. Pattern matches resolveMcpHttpPort: pure functions with mockable env + warn sinks. Both KB config.template.mjs (own Chroma) and MC config.template.mjs (engines.kb.chroma fallback chain) now consume them. Replaces the inline `process.env.X || ...` patterns from cycle 1, which were not unit-testable without dynamic config-import (which triggers Namespace collision in unitTestMode). 3. Added 14 new unit tests covering: - resolveMcpHttpPort: NaN handling, out-of-range, non-integer, invalid MCP_HTTP_PORT-with-valid-SSE_PORT fallthrough (4 new tests) - resolveChromaHost: defaults, NEO_CHROMA_HOST consumed, legacy fallback, precedence, KB-callsite-no-legacy isolation, empty-string handling, custom defaultHost (7 tests) - resolveChromaPort: defaults, valid integer, legacy fallback, precedence, NaN handling, out-of-range rejection, invalid-with-legacy-fallthrough, custom defaultPort (8 tests, but some overlap as table-driven) - 26/26 tests passing; npx playwright test ... DeploymentConfig.spec.mjs reports 1.1s. 4. Fixed MemoryCoreMcpAuth.md prefixed-env-var doc drift. The NEO_MEMORY_CORE_* prefixed example was conceptual but the substrate consumes the unprefixed forms (TRANSPORT, MCP_HTTP_PORT, AUTH_ISSUER_URL, OAUTH_CLIENT_*). Replaced the prefixed example with the actual env vars the code reads + added explicit operator note about per-server env-var namespacing patterns (launcher-layer .env / docker-compose / systemd) for multi-MCP-server deployments. Prefixed substrate translation tracked as future work if the pattern proves load-bearing. Co-authored-by: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: tobiu <[email protected]>
) (#10828) * feat(skills): codify clean-slate sunset rule for env-var renames (#10826) Adds pull-request-workflow.md §1.1.1 with the clean-slate hard-cut rule: env-var renames must rename code + .env + tests in ONE PR, no legacyEnvVar parameters, no console.warn deprecation chains, no multi-layer fallback. Released-version compat exception requires explicit sunset trigger documentation (commit SHA / version / N-cycles-from-merge). Cross-links the rule from pr-review-guide.md §7.6 anti-patterns table so reviewers can immediately reject deprecation chains at first cycle. Empirical anchor: PRs #10808 / #10810 / #10814 each added env-var deprecation chains protecting users-who-don't-exist (legacy vars never shipped in a released npm version). AGENTS.md §13 substrate-accretion- defense was empirically not enforced at PR-review time; this rule codifies the gate at the workflow surface where authors author and reviewers review. Resolves AC3 of Epic #10822 Config substrate cleanup. Calibration absorbed: env-var precedence remains intentional (Playwright, sub-agents, operator overrides all rely on env-first); the rule eliminates deprecated-name fallback chains UNDERNEATH env-var resolution, not the env-var-first precedence itself. Co-authored-by: Claude Opus 4.7 <[email protected]> * fix(skills): revert pr-review-guide §7.6 anti-patterns row addition (#10826) Operator-relayed calibration: `pr-review-guide.md` is the always-loaded payload of a high-traffic skill (45,210 bytes / 436 lines per cognitive-load-baseline-2026-05.md). Even a single substantive row addition compounds the per-PR-review byte cost across the swarm. Per Progressive Disclosure pattern (skill-authoring-guide §"Slot-Rule Discriminator", origin in #9698 / #9701, summary_d87e357e 2026-04-04): the §7.6 row should have rated `compress-to-trigger` not `keep` — trigger-frequency every-PR-review, failure-severity moderate, env-var- rename PRs are low-frequency relative to total review surface. Substrate (rule body in pull-request-workflow.md §1.1.1) fires at PR- authoring time which is the right moment. Reviewers covering env-var- rename PRs already trigger §1.1 Substrate-Mutation Pre-Flight Gate (touches .agents/skills/** etc.) so the §7.6 row was over-engineering the always-loaded reviewer surface. Aligns with Epic #10733 (cognitive-load audit) byte-reduction direction. Co-authored-by: Claude Opus 4.7 <[email protected]> * refactor(skills): restructure env-var-rename rule per Progressive Disclosure (#10826) Operator-relayed Cycle 3 calibration: 21-line rule body in pull-request-workflow.md §1.1 + 1-row reference in pr-review-guide.md §7.6 was inverted. Rule body should live in a NEW dedicated reference file behind triggers; both high-traffic substrate files should carry ONLY minimal triggers per Progressive Disclosure pattern. Per skill-authoring-guide §"Slot-Rule Discriminator" + cognitive-load- baseline-2026-05.md byte-budget targeting: - pull-request-workflow.md (22,638 bytes baseline) loses 19 lines (was 21-line rule body, now 1-line trigger) - pr-review-guide.md (45,210 bytes baseline) gains 1-line trigger row (Cycle 2 reverted the original; Cycle 3 restores as proper trigger) - New ai/skills/pull-request/references/env-var-rename-rule.md (30 lines) holds the rule body — loaded conditionally only when trigger fires (PR touches env-var resolvers) File renamed from "sunset-rule" to "env-var-rename-rule" per operator: "sunset" namespace collides with /session-sunset skill. Topic-preserving name: env vars in general; action: hard cut / one shot. Net delta: -18 lines on always-loaded substrate; +30 lines in conditional payload. Aligns with Epic #10733 cognitive-load audit. Co-authored-by: Claude Opus 4.7 <[email protected]> * fix(skills): remove harness-private memory citation + correct Neo identity framing (#10826) Operator-relayed calibration on env-var-rename-rule.md "Why no deprecation chains" rationale: - Removed `feedback_neo_is_engine_not_framework` citation per feedback_no_harness_private_load_bearing_citations rule (Claude Code memory file; not a public-anchor citation). - Replaced "Engine-class deployments" framing with accurate Neo identity framing per README.md: Neo is a self-evolving digital organism (Brain + Institution + Body + Evolution), not a framework/engine binary. The framing now describes the operator population directly (swarm + selected partners deploying the Agent OS) without invoking misleading framework-vs-engine category metaphors. Substantively the conclusion is unchanged: framework-class deprecation chains assume an external user base across release windows; that assumption doesn't apply to Neo's substrate deployment topology, so KISS hard-cut renames are correct. Co-authored-by: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: tobiu <[email protected]>
Authored by GPT-5.5 (Codex Desktop). Session 1a17d733-39b5-464e-ad23-6b93bdd2446e.
Resolves #10804
Consolidates the Memory Core / Knowledge Base embedding-provider surface to one canonical
embeddingProviderselector, while preserving a deprecation fallback forNEO_CHROMA_EMBEDDING_PROVIDER/ legacy config fields. The healthcheckproviders.embeddingpayload is now a single{active, host, model, dimensions, error?}block again, matching the single-route runtime contract.Evidence: L2 (pure resolver coverage + focused Playwright provider/healthcheck unit tests) -> L2 required by #10804. No residuals.
Deltas from Ticket
EmbeddingProviderConfig.mjsso config normalization is testable without constructing the singleton or requiring live provider credentials.TextEmbeddingService; no hidden fallback was reintroduced inside the embedding service.NEO_CHROMA_EMBEDDING_PROVIDERremains readable for one deprecation window and warns; when the unified selector conflicts with a legacy selector, the unified value wins.learn/agentos/DeploymentCookbook.mdis not present on currentorigin/dev; cookbook updates remain coordinated through the cookbook branch / sibling tickets after that doc lands.Config Template Change
Changed keys in
ai/mcp/server/memory-core/config.template.mjs:embeddingProviderchromaEmbeddingProviderneoEmbeddingProviderLocal clone follow-up: active, gitignored
ai/mcp/server/memory-core/config.mjsfiles should migrate toembeddingProviderafter merge. Legacy keys keep working during the deprecation window, but will emit warnings. Harness restart is recommended for already-running MCP servers so they reload the config shape and healthcheck projection. The A2A reviewer handoff includes this clone-sync note.Slot Rationale
Modified
learn/agentos/MemoryCore.mdandlearn/agentos/SharedDeployment.md.Disposition delta: keep -> keep. The modified provider sections remain loaded operator contract docs, but the content now removes the obsolete dual-provider split. 3-axis rating: trigger-frequency medium (deployment / healthcheck diagnosis), failure-severity high (silent embedding-route drift corrupts retrieval assumptions), enforceability medium (shape is covered by unit tests and reviewable healthcheck samples). Decay mitigation: deprecation language names the legacy env var and constrains it to a one-window compatibility path instead of permanently expanding the config surface.
Test Evidence
node --check ai/mcp/server/memory-core/helpers/EmbeddingProviderConfig.mjsnode --check ai/mcp/server/memory-core/config.template.mjsgit diff --checkgit diff --check origin/dev...HEADnpm run test-unit -- test/playwright/unit/ai/mcp/server/memory-core/config.spec.mjs test/playwright/unit/ai/mcp/server/memory-core/services/TextEmbeddingService.spec.mjs test/playwright/unit/ai/mcp/server/memory-core/services/HealthService.spec.mjs-> 31 passednpm run test-unit -- test/playwright/unit/ai/mcp/server/memory-core/was attempted before finalization and exposed existing local substrate failures (readonly database, Chroma connection failures, and ignored local config drift); the provider-focused L2 surface above is green.Post-Merge Validation
config.mjs, then verifyhealthcheck.providers.embeddingreturns the single-block shape.NEO_CHROMA_EMBEDDING_PROVIDERtoNEO_EMBEDDING_PROVIDER.Commit
01785bb9f-feat(ai): consolidate embedding provider config (#10804)