Make indexing and per-source chunk optional so minimal RAG configs validate (#88)#124
Merged
Conversation
…lidate Fixes the three v1.13.3+ Zod-validator complaints in issue #88 that block a docs-compliant minimal RAG config (local embeddings) from booting: - IndexingConfigSchema fields (auto_reindex, reindex_hour_utc, stale_threshold_hours) now have sensible defaults (false / 3 / 24), and the top-level `indexing` block defaults to `{}`. A manual-only / minimal config no longer hard-fails for omitting a cron schedule. The now-dead `hasRag && !cfg.indexing` superRefine check is removed; the embedding presence check stays. - BaseSourceFields.chunk is now optional (defaults to `{}`). Its inner fields were already all-optional, so a source can omit `chunk` and fall back to the chunker's per-type defaults. - Local embeddings were never a schema bug — LocalEmbeddingConfigSchema is already in the embedding union. The real cause is the prod Docker image (`npm ci --omit=dev`) omitting the optional @xenova/transformers peer dep. Clarified the Dockerfile guidance and added a deploy-docs callout; kept the dep optional (not a hard dependency). Existing valid configs are preserved (defaults only fill omitted fields; explicit values pass through unchanged). Closes #88
Contributor
Author
CI note:
|
Merged
jpr5
added a commit
that referenced
this pull request
Jun 25, 2026
## Release v1.16.0 (minor) Releases the user-visible changes already merged to `main`: **#124** (config validation relaxation) and **#127** (Atlas distiller "Premature close" runtime fix). Current `1.15.4` → `1.16.0`. #128 was a CI-only vitest scoping change and is intentionally not in the changelog (does not ship). ### CHANGELOG ## 1.16.0 ### Minor Changes - Config validation accepts minimal RAG configs — `indexing` and per-source `chunk` now optional with defaults (#124) - Fixed Atlas distiller LLM client "Premature close" errors, by disabling keep-alive on the test/proxy client (#127) ### Version bumps - `package.json` `version`: 1.15.4 → 1.16.0 - `src/cli.ts` `.version(...)`: 1.15.4 → 1.16.0 - version-sync verified in agreement. ### Publishing Merging this PR triggers `publish-release.yml` to publish `@copilotkit/pathfinder@1.16.0` to npm and create the tag/GitHub Release. Do not tag or release by hand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #88 reports three problems with the Zod config validator that prevent a docs-compliant minimal RAG config (using local embeddings) from booting. This PR addresses all three, minimally and without regressing any existing valid config.
LocalEmbeddingConfigSchemais already in theEmbeddingConfigSchemadiscriminated union. The real cause: the prod Docker image is built withnpm ci --omit=dev, which omits the optional@xenova/transformerspeer dependency (left commented-out in the Dockerfile). The server boots and validates fine, then throws a clearInstall @xenova/transformers…error at runtime (src/indexing/embeddings.ts) when local embeddings first run;pathfinder validatewarns.IndexingConfigSchemarequiredauto_reindex/reindex_hour_utc/stale_threshold_hourswith no defaults, andServerConfigSchema.superRefinehard-required anindexingblock whenever search/knowledge tools were present..default()s (false/3/24) and made the top-levelindexingblock.default({}). Removed the now-deadhasRag && !cfg.indexingsuperRefine check (the block is always present). Theembeddingpresence check is unchanged.chunkmandatory per sourceBaseSourceFields.chunkhad no.optional(), even though every inner field ofChunkConfigSchemais already optional.chunkdefault to{}so a source can omit it and fall back to the chunker's per-source-type defaults.Behavior safety
src/indexing/orchestrator.tsalready readserverCfg.indexing?.…with a?? 24fallback, so promotingindexingfrom optional-to-defaulted is behavior-preserving (a config previously lackingindexinghad auto-reindex effectively off; now it's an explicitauto_reindex: false).@xenova/transformersremains an optional peer dependency — not promoted to a hard dependency.Red-Green Proof
Exercised the real parse surface:
ServerConfigSchema(the schemaconfig.ts/validate.tsrun YAML through), with the docs-compliant minimal config from the issue (local provider, a source with nochunk, a search tool, noindexingblock). New test:src/__tests__/minimal-rag-config.test.ts.RED (before the schema fix — current strict schema)
(The 4th test — "REGRESSION: a full explicit config still validates unchanged" — passed under RED, confirming the baseline.)
GREEN (after the schema fix — same test)
Regression assertion
The
REGRESSION:test parses a full explicit config (openai embedding, explicitindexing, explicit per-sourcechunk) and asserts every value passes through unchanged — defaults never override explicit input. Also updatedsrc/__tests__/tool-config.test.ts: the priorrejects search config without indexingtest (which asserted the old hard-fail) now asserts the new accept-with-defaults behavior.Pre-push quality
Ran in CI order, all green:
prettier --check(src + scripts) →tsc --noEmit -p tsconfig.scripts.json→npm run build→ fullvitestsuite (343 files / 6531 tests passed). Dockerfile edit verified syntactically sane (image not built; change is comment-only on optionalRUNlines).Files changed
src/types.ts—chunk→.default({});IndexingConfigSchemafield defaults;indexingblock.default({}); removed dead superRefine indexing check.src/__tests__/minimal-rag-config.test.ts— new red-green + regression tests.src/__tests__/tool-config.test.ts— updated the indexing-required test to the new behavior.Dockerfile— clarified optional peer-dep guidance (still optional/commented).docs/deploy/index.html— added a Docker peer-deps callout.Closes #88
🤖 Generated with Claude Code