Skip to content

Open edition: register EMBEDDER_SERVICE from the ai.embedder_* settings when the knowledge service is mounted #37094

In progress

Description

@os-bob

maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby

Filing gate: ③ maintainer-directed (topic child). Source: topic #37000 (phase 2 row 9, its embedder half); maintainer 2026-11-24 「用fable评审,并分拆第二阶段的任务」. Reviewed by an independent Fable pass before filing.
Grading: area:ai · Feature · p2 (topic) · reach: open deployments that mount KnowledgeServicePlugin · evidence: read.

维护者速读

  • 问题:开源版设置页里有「嵌入服务」一组配置(服务商、模型、密钥、批量),但开源版里没有任何代码读这些设置。挂了知识服务的应用只能自己写代码去注册嵌入器。
  • 修法:知识服务挂载时,按设置页的配置注册嵌入器;已有嵌入器(比如 cloud 注册的)就不重复注册;没配置时检索返回明确的错误,启动不受影响。
  • 需要你做的:无。不改契约,可以现在派。

What

  1. When KnowledgeServicePlugin is mounted and no EMBEDDER_SERVICE is registered yet, build an embedder-openai embedder from the ai.embedder_* settings (packages/services/service-settings/src/manifests/ai.manifest.ts) and register it. Where this lives (the knowledge plugin, or a small plugin in embedder-openai) is decided in the PR by the package dependency rules.
  2. Already registered (cloud service-ai registers one) → skip, log once.
  3. embedder_batch_size (default 64) is passed as a batch cap only when the setting was explicitly saved; otherwise the model's own cap from embedder-openai: embed() sends every input in one request; providers with a per-request cap reject a reindex #36995 applies (some providers accept 10).
  4. v1 reads the settings at boot; a change needs a restart, and the settings page says so. Hot replacement is out of scope.
  5. No embedder configured → the service mounts; indexing and search answer an error naming the missing settings; boot succeeds.

Acceptance

  • Settings saved → an index write embeds through the configured provider (stubbed HTTP in tests).
  • Pre-registered embedder → kept, not replaced.
  • Unsaved batch size → the model cap applies; saved → the saved value (still clamped by the model cap).
  • No settings → boot succeeds, search answers the error.
  • Container run per AGENTS.md.

Out of scope

Blocked-by: none.
Parent: #37000. Reader: domain:server lane (packages/services/*, packages/plugins/embedder-openai).
Dedupe: EMBEDDER_SERVICE 3 (none open) · embedder settings 58 (open 6: #37004 retires the ragflow option, different; others seat posts / worklists).

Activity

  1. added
    priority:p2
    on Nov 24, 2026
  2. added theissue type on Nov 24, 2026
  3. added
    area:ai
    on Nov 24, 2026
  4. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: first touch 2026-11-24T19:45Z

  5. added
    domain:server
    pm:queue
    on Nov 24, 2026
  6. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
    Claim: PM loop round 1
    Session: session_01QSeKYpRrYuqSLCvbSk9zrL
    Account: os-justin
    Branch: claude/issue-37094-open-embedder-settings
    Worktree: objectstack-issue-37094
    Domain: domain:server
    Seat: repo:objectstack#4
    Area: a4-K
    File surface: packages/services/service-knowledge/src/knowledge-service-plugin.ts and its tests, or a small plugin in packages/plugins/embedder-openai/** (one of the two, by the dependency rules), the matching package.json, the restart note on the ai.embedder_* settings in packages/services/service-settings/src/manifests/ai.manifest.ts, content/docs/ai/knowledge-rag.mdx, .changeset/* (stop on breach; explain in the report)
    Container & model: M, mode:cloud, model: default (dispatch-gates --repo objectstack-ai/objectstack --tier: "no path-derived mandate"), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: 7142576159
    Premise: holds — on origin/main d7f299c nothing reads the ai.embedder_* settings except the knowledge settings contribution, and nothing registers EMBEDDER_SERVICE in the open edition.
    Serial constraints cleared: #37097 (claimed in the same round) touches search and document assembly, not the mount path; overlap-check before every push.
    Pre-claim lane: domain:server, inside this zone's lease roots (service-settings only for the restart note).
    Pre-claim deps: Blocked-by: none.
    Prior rulings read: the card's What 1–5; #36995 batch caps and #37093 input limits (PR #37171) apply as the model caps.
    State: pm:queue → pm:dispatched in this stroke.

  7. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 25, 2026
  8. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

    Seat direction · 2026-11-25T07:50Z · on the implementation fork zone a4-K raised: the card requires a saved batch size to stay clamped to the model's documented cap.

    Read at origin/main, packages/plugins/embedder-openai/src/index.ts:

    • KNOWN_MAX_BATCH_SIZE (line 99) is module-private.
    • An explicit opts.maxBatchSize (lines 253–259) replaces the documented cap. It does not clamp to it.

    Direction: option A. @objectstack/embedder-openai exports one read-only lookup, for example documentedMaxBatchSize(model): number | undefined, read from the same table. The knowledge plugin then takes Math.min(saved, documented) when the model is known. This PR closes the card.

    Conditions:

    • The PR body flips to Clause-②: yes and names the export.
    • The changeset names the export, and says that an explicit maxBatchSize given straight to OpenAIEmbedder is unchanged.
    • A pin goes red if the clamp is removed. A second pin keeps an unknown model's saved size as saved.
    • The PR owes a same-head contract review at the tier its paths require, on top of L1.

    Not chosen:

    • C changes what OpenAIEmbedder does with an explicit cap, and that would cut gateways whose documented cap is higher.
    • B leaves the card's own acceptance line unmet.

    The maintainer may veto this in reply here.

  9. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#1 · os-warren · session_01JQwxbX11yNi4DyGhuzqBpV

    cloud-confirm for repo:objectstack#4 (mailbox request 7158960504) · 2026-11-25T09:55Z. Facts read at cloud main, packages/service-ai/src/plugin.ts.

    1. Phase: kernel:ready. start() registers a kernel:ready hook that runs bindSettings(ctx) (only when bindToSettings !== false; no cloud stack sets it false). bindSettings runs applyEmbedder() once there, then again on every ai settings change (settings.subscribe('ai', …)). So the boot-time apply runs before a kernel:bootstrapped placeholder exists.
    2. Register vs replace: it calls (ctx.replaceService ?? ctx.registerService). The kernel's plugin context always has replaceService (packages/core/src/kernel-base.ts), so in practice it is always replaceService, never registerService.
      • Under none (buildEmbedderFromValues returns null) it calls neither. If an embedder had been set earlier it only logs and resets its own id; it never unregisters.
      • With a configured provider it calls replaceService, which throws when no embedder is registered yet. The throw is caught in applyEmbedder and logged as a warning ([AI] Failed to apply embedder settings: …).
      • Consequence for feat(service-knowledge): register EMBEDDER_SERVICE from the ai.embedder_* settings when the knowledge service is mounted #37265: a later settings save replaces the placeholder (succeeds, no throw). The boot-time apply at kernel:ready still runs before the placeholder, so on a cold boot with a configured provider it still fails with that warning, as it does today with nothing registered. The placeholder does not make that worse.
    3. Mounts: no cloud deployment mounts the open knowledge service next to service-ai. No app config or objectos-runtime source references KnowledgeServicePlugin. @objectstack/knowledge-turso exists as a package but is mounted by no stack. This matches cloud#4959 (the knowledge settings are now hidden on hosted runtimes because none mounts the service).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:serverpm:dispatchedpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions