Repository navigation
feat(service-knowledge): register EMBEDDER_SERVICE from the ai.embedder_* settings when the knowledge service is mounted - #37265
objectstack-fleet[bot] wants to merge 10 commits into
Conversation
…r_* settings Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
… a real boot Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
…s for a restart Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
…olds a saved batch size to the model's documented cap Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
…ed cap; changeset names the export Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin c284f53c0dbc17abdc182268d6ac461aeb12631a && git checkout c284f53c0dbc17abdc182268d6ac461aeb12631a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8032d958f2f2892d02e7e4b3cb13da2242f747bb 8e8243da69d7103fcb461c37b131dfe737d77ba6 && git checkout -B drift-repro 8032d958f2f2892d02e7e4b3cb13da2242f747bb && git merge --no-ff 8e8243da69d7103fcb461c37b131dfe737d77ba6
node scripts/docs-audit/affected-docs.mjs --json 8032d958f2f2892d02e7e4b3cb13da2242f747bb
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: FAIL |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
… Azure; number keys read from text; boot line names the endpoint host Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
…r keys from text; changeset Claude-Session: https://claude.ai/code/session_01QSeKYofJfCPWsxaVYkmaVF Co-authored-by: Claude <noreply@anthropic.com>
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Fixes #37094
Clause-②: yes (widening) —
@objectstack/embedder-openaigains one export,documentedMaxBatchSize(model): number | undefinedMetadata-protocol: none
维护者速读
What changes
KnowledgeServicePluginregistersEMBEDDER_SERVICEfrom theai.embedder_*settings (packages/services/service-knowledge/src/knowledge-service-plugin.ts). Read once, atkernel:bootstrapped:infoline, settings not applied. A registration the sync accessor cannot hand out (an async factory) counts as registered too.@objectstack/embedder-openaiembedder for the saved provider: its preset endpoint, or the saved Base URL (custom / Azure). "Saved" = any layer but the manifest default (source !== 'default', the same readingplugin-emailuses forbranding.workspace_name); anOS_*override counts as saved. "Complete" = the settings page's own Test embedder check (aiTestEmbedderActionHandler), handed only the saved values: reused, not forked.Math.min(saved, documentedMaxBatchSize(model))when the saved model has a documented cap, the saved size as saved otherwise (no saved model, or a model the table does not know).nonesaved, incomplete, settings service absent, or theainamespace without the embedder keys) → anUnconfiguredEmbedderis registered:embed()(non-empty) anddimensionsrefuse with a message naming the missing settings, where to save them and that a restart is needed. Boot succeeds; nothing is sent. Boot line isinfowhen nothing asked for an embedder,warnwhen saved settings do not build one.descriptiononembedder_providerinai.manifest.ts("Read when the server starts: a saved change to any embedder setting takes effect after the next restart."), and itshelpcopy in all 11 locale bundles. The translations are required by the gate:settings-translation-coverage.test.tsreds a described field with nokeys.KEY.helpin any locale.@objectstack/embedder-openaiexportsdocumentedMaxBatchSize(model): number | undefined(seat direction, issue comment 7156326561): the documented per-request cap, read from the SAME module tableOpenAIEmbedderbatches by. No copy, and the constructor now reads the table through the same function.OpenAIEmbedderis unchanged: an explicitmaxBatchSizeis still used as given, above the cap included (pinned).content/docs/ai/knowledge-rag.mdxgains "Configuring the embedder from Settings".@objectstack/service-knowledge→@objectstack/embedder-openai. Why this side: service-knowledge already depends oncore(plugin contract) andservice-settings(the settings reader and the reused completeness check), so the knowledge plugin needs exactly one new edge; a plugin inembedder-openaiwould needcoreandservice-settings(two edges, a crypto library among the transitive ones) and a host would have to mount it by hand, which is the gap the card is about. Services depending on plugins has precedent (service-storage,service-print,service-automation).embedder-openaidepends only onspec: no cycle.Why
kernel:bootstrapped(the phase measurement)ObjectKernel.bootstrap()/LiteKernel.bootstrap()run everyinit(), then everystart(), thenkernel:readyhandlers in plugin order, thenkernel:bootstrappedonce everykernel:readyhandler has settled (plugin-lifecycle-events.ts). An embedder registered ininit(),start()or anykernel:readyhandler (where a settings-reading provider would register, since the settings engine binds inkernel:ready) is therefore visible atkernel:bootstrapped, regardless of plugin order. Pinned both ways: a host embedder registered atinitand one registered in akernel:readyhandler are each kept. Only a registration inkernel:bootstrapped/kernel:listeningor after boot would collide; the changeset says so. Settings are read afterkernel:readyfor the same reason the settings plugin documents: a read in the pre-bind window answers the default without consulting the store.Tests
New top-level
describein the knowledge+settings harness file (src/__tests__/knowledge-settings-contribution.test.ts), through the real registration path: settings SAVED viaSettingsService.setManyin akernel:readyhandler, provider reached through a stubbed globalfetch, and an adapter that looks upEMBEDDER_SERVICEwhere it embeds. No hand-built embedder.indexDocumentsends onePOST https://api.openai.com/v1/embeddingswith the saved key and model; nothing sent at boot; key in no log lineinit/ atkernel:ready→ same instance kept, zero requests, oneinfolinetext-embedding-v3→ requests of 10, 10, 5 (not one of 25: the default 64 is not a saved value)text-embedding-v3(documented 10) → requests of 10, 10, 5, and the boot line names the saved 64embedder-openai:documentedMaxBatchSizeanswers 10 / 2048 /undefined(unknown, and a prototype key); the embedder with nomaxBatchSizebatches at exactly that value; an explicitmaxBatchSize: 25on a cap-10 model still sends 25indexDocumentand the adapter'ssearchreject namingai.embedder_providerand the restart;KnowledgeService.searchanswers[]and logs that error per source;dimensionsrefuses; zero requests; boot lineinfononesaved → refusal says so; incomplete (provider without key) → the page check's own message, boot linewarnAblations (one-shot,
scripts/ablation-replace.mjs, each mutation landed and restored to blob == HEAD,git diff HEADempty):if (!entry) return undefined;) → 1 failed / 8 passed: exactly "an unsaved batch size leaves the model its own cap".Math.minline →savedBatch) → 1 failed / 10 passed: exactly pin (a). The first attempt at this one was a no-op: the replacement text already occurred in the anchor, the tool refused before running, and it was re-run with a distinct replacement.Acceptance notes
embedder-openai. With no saved model the embedder uses its own default model; no cap is looked up for a model the plugin does not name, so the saved size passes as saved. The field's maximum (2048) equals that default model's documented cap.packages/services/service-knowledge/vitest.config.tsgains one alias for@objectstack/embedder-openai(without itcheck:test-source-aliasreds: the tests would read the embedder'sdist/);pnpm-lock.yamlrecords the new workspace edge.KnowledgeService.searchalready catches a per-source adapter failure, logs it aterrorand answers no hits from that source; with no embedder that logged error is the named reason. Indexing throws it. That catch lives inknowledge-service.ts, outside this card.EMBEDDER_SERVICEyet (knowledge-memoryuses its own sparse vectors;knowledge-ragflowembeds server-side), so in the open edition today the registered embedder is used by custom adapters and by the coming pgvector adapter. TheEMBEDDER_SERVICEdoc comment inpackages/spec/src/contracts/embedder.tsstill says it is "Registered by@objectstack/service-ai"; spec prose was not touched here.Verification
Two-minute check:
pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/knowledge-settings-contribution.test.ts -t 37094→ 11 passed.Read first, by risk:
knowledge-service-plugin.tsprovideEmbedder()andembedderFromSettings(): the phase, the registered check, the saved-vs-default reading, the clamp.UnconfiguredEmbedder: a registered placeholder meansEMBEDDER_SERVICEis never absent once the knowledge service is mounted.embedder-openai/src/index.tsdocumentedMaxBatchSizeand the constructor's use of it.Local readings, head
f329965b, all in this worktree:Package tests, typecheck, derived gates
pnpm --filter @objectstack/embedder-openai test→ 31/31; build +typecheck(tsc +check:test-typecheck) exit 0.pnpm --filter @objectstack/service-knowledge test→ Test Files 8/8, Tests 181/181;typecheckexit 0, 0 errors.pnpm --filter @objectstack/service-settings test→ Test Files 77/77, Tests 1523/1523;typecheckexit 0 (head35c742d2; the later commits do not touch service-settings).node scripts/pm/dispatch-gates.mjs --commands(21 paths): 115 commands, each exit captured before any pipe: 114 exit 0, among themcheck:startup-registry-verdict,check:test-source-alias,check:undeclared-dep-imports,check:workspace-manifest-cycles,check:published-readme-links,check:dual-build-cjs-loads,check:settings-bind-window,check:doc-authoring,check:issue-citations,check:nul-bytes,check:changeset-fixed,check-empty-changeset,check-changeset-no-major,check-adr-0087-registration,check:type-check-coverage.check-plugin-teardown-shape --self-test(shallow clone cannot read its pinned fixture).dispatch-gates --ran: 115 derived, 115 run, 0 unrun.pnpm lint) and dogfood are CI's (no!in the title, no narrowing arm).Signed: repo:objectstack#4 · os-justin · session_01QSeKYofJfCPWsxaVYkmaVF
Provenance
Opened by seat repo:objectstack#4 on the maintainer's authorization in the seat session (「#37094 开 PR 被拦:放行」). The developer's own
pr_createin zone a4-K's dev session was refused twice by a permission check; the dev stopped without retrying and handed the material over. Branchclaude/issue-37094-open-embedder-settings@f329965bd6888bfae8e6901e1ca230c8f37e81f9.Human Minimum
packages/specholds no runtime logic. (spec untouched)pnpm lintpasses. (No formatter ran;pnpm lintwas not run locally — CI's run decides.)main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ