Frontmatter
| title | fix(ai): prevent embedding context truncation (#13944) |
| author | neo-gpt |
| state | Merged |
| createdAt | Jun 24, 2026, 12:24 PM |
| updatedAt | Jun 24, 2026, 12:47 PM |
| closedAt | Jun 24, 2026, 12:47 PM |
| mergedAt | Jun 24, 2026, 12:47 PM |
| branches | dev ← codex/13944-embedding-context-truncation |
| url | https://github.com/neomjs/neo/pull/13945 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |
Merged

neo-gpt
commented on Jun 24, 2026, 12:38 PM
Red integration-unified addressed on head df8b68453e.
Root cause: the first guard keyed LM Studio context verification only on orchestrator.lms.enabled, so generic OpenAI-compatible integration fixtures without an lms CLI failed during the Memory Core embedding write canary (spawn lms ENOENT).
Fix: TextEmbeddingService now runs the lms ps loaded-context probe only when the OpenAI-compatible host is the configured LM Studio endpoint (orchestrator.lms.port) or when a test probe seam is explicitly installed. LM Studio still fails before provider-side truncation; CI/cloud/generic OpenAI-compatible endpoints no longer require lms.
Validation:
node --check ai/services/memory-core/TextEmbeddingService.mjs-> passednpm run test-unit -- test/playwright/unit/ai/services/memory-core/TextEmbeddingService.retry.spec.mjs-> 17 passednpm run test-integration-unified -- test/playwright/integration/healthcheck.spec.mjs-> 2 skipped locally by fixture gatenpm run agent-preflight -- --no-fix --pr-body /private/tmp/pr-13944.md ai/services/memory-core/TextEmbeddingService.mjs test/playwright/unit/ai/services/memory-core/TextEmbeddingService.retry.spec.mjs-> passedgit diff --cached --check-> passed before amend
CI is running again on the pushed head.

tobiu
APPROVED reviewed on Jun 24, 2026, 12:47 PM
No review body provided.
Resolves #13944
This prevents local OpenAI-compatible embedding calls from accepting vectors after LM Studio silently truncates input.
TextEmbeddingServicenow verifies the resident LM Studio embedding model context before posting to/v1/embeddings, refuses below-config or over-loaded-context requests with bounded diagnostics, and emits consumer friction when an input would overflow the observed loaded context. The guard is scoped to the configured LM Studio endpoint, so CI/cloud/generic OpenAI-compatible endpoints do not require anlmsCLI. The orchestrator supervisor now reruns a task-owned readiness hook even when a fire-and-exit service is already live, so the existing LMS preload/replacement path runs after an "endpoint is up" liveness result instead of only after a child spawn.Evidence: L2 (focused unit coverage for stale loaded context, no provider request posted, and liveness-up readiness execution) -> L2 required for #13944 code gate. Residual: L3 local LMS smoke after merge/restart.
Deltas from ticket
TextEmbeddingService, so Memory Core and KB callers share the same truncation stop.lms serveris already healthy.Test Evidence
node --check ai/services/memory-core/TextEmbeddingService.mjsnode --check ai/daemons/orchestrator/services/ProcessSupervisorService.mjsnode --check ai/daemons/orchestrator/services/ConfiguredTaskDefinitionsService.mjsnpm run test-unit -- test/playwright/unit/ai/services/memory-core/TextEmbeddingService.retry.spec.mjs— 17 passednpm run test-unit -- test/playwright/unit/ai/daemons/orchestrator/services/ProcessSupervisorService.spec.mjs— 34 passednpm run test-unit -- test/playwright/unit/ai/daemons/orchestrator/Orchestrator.spec.mjs— 55 passednpm run test-integration-unified -- test/playwright/integration/healthcheck.spec.mjs— 2 skipped locally by fixture gategit diff --cached --checkPost-Merge Validation
localModels.embedding.contextLimitTokensor higher before KB sync accepts embeddings.Authored by Euclid (GPT-5, Codex Desktop). Session cd2b88d7-8134-4ef8-a10f-0b1e80c03db4.