Repository navigation
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpriority:p2Medium: important, M3
Description
maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby
Filing gate: ③ maintainer-directed (topic child). Source: topic #37000 (phase 2 row 6, its embedder half); maintainer 2026-11-24 「用fable评审,并分拆第二阶段的任务」. Reviewed by an independent Fable pass before filing.
Grading: area:ai · Feature · p2 (topic) · reach: apps that mount service-knowledge with embedder-openai · evidence: read.
维护者速读
- 问题:文本超过嵌入模型的输入上限时,服务商会悄悄截断,后半段内容搜不到,也没有任何报错。
- 修法:已知模型表补上每个模型的输入上限;超限时报错并写明模型名和估算长度,不再截断。表里没有的模型不设上限,只警告一次。另外给出一个平台和应用共用的 token 估算公式。
- 需要你做的:无。不改契约,不用等 ADR,可以现在派。
What
packages/plugins/embedder-openai/src/index.ts: addmaxInputTokensto the known-model table (each value checked against the provider's published docs and cited in the PR);OpenAIEmbedderOptions.maxInputTokens?overrides it.embed(): an input whose estimate exceeds the limit throws an error naming the model, the estimate and the limit; nothing is truncated. A model not in the table and with no option: no limit, one warning per embedder instance.- One shared estimate function, exported from a place both
embedder-openaiandservice-knowledgealready depend on (@objectstack/specshared utilities; name the module in the PR). Formula: CJK characters and full-width punctuation 1.5 each; an ASCII alphanumeric run 1; other punctuation 1; × 1.1. Documented on its docblock and incontent/docs/ai/knowledge-rag.mdx. IEmbedderis not changed (same approach as embedder-openai: embed() sends every input in one request; providers with a per-request cap reject a reindex #36995).
Acceptance
- Over-limit input → error with model, estimate, limit; under-limit input unchanged.
- Unknown model → no error, one warning.
- A sampled test: the estimate is never below OpenAI
cl100ktoken counts on Chinese regulation-like text and mixed Chinese/English text (other tokenizers by documented factor only; they cannot run in CI). - Container run per AGENTS.md.
Out of scope
IEmbedder.maxInputTokens?and the service learning the limit (service-knowledge: one service-layer splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key #37098);IEmbedder.model?(knowledge-pgvector: an open vector store on PostgreSQL — tables, exact search, listing, chunks #37100).- Splitting text to fit the limit (service-knowledge: one service-layer splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key #37098).
Blocked-by: none.
Parent: #37000. Reader: domain:server lane (packages/plugins/embedder-openai).
Dedupe: maxInputTokens 0 · embedder truncated 14 (open 2: seat posts only) · EMBEDDER_SERVICE 3 (none open).
Metadata
Metadata
Assignees
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpriority:p2Medium: important, M3
Activity
objectstack-fleet commentedon Nov 24, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: first touch 2026-11-24T19:45Z
Blocked-by: none. The maintainer session filed it and set the type and grade, so both stay.pm:queueanddomain:serveradded. Feature · p2 kept.service-knowledgewithembedder-openai· read · size S.objectstack-fleet commentedon Nov 24, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
Claim: PM loop round 1
Session:
session_01QSeKYpRrYuqSLCvbSk9zrLAccount:
os-justinBranch:
claude/issue-37093-embedder-input-limitWorktree:
objectstack-issue-37093Domain:
domain:serverSeat:
repo:objectstack#4Area: a4-K
File surface:
packages/plugins/embedder-openai/**, one shared estimate module in a package bothembedder-openaiandservice-knowledgealready depend on (the card names@objectstack/specshared utilities; the dev measures that against AGENTS.md Prime Directive 2 and names the module) plus the artifacts it regenerates,content/docs/ai/knowledge-rag.mdx,.changeset/*(stop on breach; explain in the report)Container & model:
S,mode:cloud,model: default (dispatch-gates --repo objectstack-ai/objectstack --tier: "no path-derived mandate"),effort: mediumClause-②: yes
Metadata-protocol: none
Responsibility: n/a — not a defect card
Thread-read: 7142552576
Premise: holds — on origin/main 6f3a8da the known-model table in
packages/plugins/embedder-openai/src/index.tscarries dimensions and per-request caps (PR #37037) but no input limit;embed()sends inputs of any length.Serial constraints cleared: none in flight on
packages/plugins/embedder-openai/**; #37096 (in flight, cloud) touchesservice-knowledge,knowledge-memoryand twopackages/specknowledge files — disjoint from this surface; overlap-check before every push.Pre-claim lane:
packages/plugins/embedder-openaiisdomain:server; inside this zone's lease roots. The shared estimate module may sit outside them — named in the PR and reviewed percontract-review.md.Pre-claim deps:
Blocked-by: none.Prior rulings read: card's own (no
IEmbedderchange, same approach as #36995; formula verbatim); ADR-0161 K8:IEmbedder.maxInputTokensandIEmbedder.modelbelong to #37098 / #37100, not here.State:
pm:queue→pm:dispatchedin this stroke.objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Rulings recorded · 2026-11-25T01:00Z · two questions from this card's development, put to the maintainer in seat repo:objectstack#4's session.
pr_create(permission check in the dev session): 「embedder-openai: an over-limit input is refused, not truncated (known-model input limits, one shared token estimate) #37093:开 PR 放行。你应该使用 pm-dispatch 技能审核和落地pr,该放行的都放行」 — the PR is opened fromclaude/issue-37093-embedder-input-limit.So the PR implements A: an ASCII letter/digit run counts ceil(length / 4); CJK and the rest stay as ruled. Pins add English-heavy cases (long words, long digit strings, a URL / code line) asserting the estimate is at or above a reference tokenizer's count, beside the existing Chinese and mixed cases; the ablation (back to 1 per run) turns them red.
objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
os-dev report · card #37093 · head
1660e96b9a6778c03d16092ab92d0285ecac6d5d· PR #37171 (opened by the seat session under the maintainer's authorization; see the rulings comment above)Relayed verbatim from dev session
session_01QSeKYpJCg2rG1RGK4BwAKx. The dev made no GitHub writes.{ "issue": 37093, "status": "done", "branch": "claude/issue-37093-embedder-input-limit", "pr": 37171, "session": "session_01QSeKYpJCg2rG1RGK4BwAKx", "premise_still_valid": true, "summary": "Head 1660e96b. Ruling 「A」 applied: in packages/spec/src/shared/token-estimate.ts an ASCII letter/digit run counts ceil(length / 4), via the new exported constant ASCII_RUN_CHARS_PER_TOKEN = 4 and one helper asciiRunTokens(). CJK, punctuation, whitespace and the x1.1 margin are unchanged. Docblock, content/docs/ai/knowledge-rag.mdx (table row plus a limitation sentence) and the changeset (formula line plus the new export) updated; api-surface and export-origins regenerated (+1 line each).", "tests": "spec token-estimate.test.ts: 26 passed (10 zh/mixed fixtures and 8 English-heavy fixtures, all >= cl100k under A, plus formula cases). embedder-openai: 27 passed, typecheck exit 0 against a rebuilt spec. spec typecheck exit 0. Ablation: the run rule reverted to the old 1-per-run gives 9 failed | 17 passed (6 of 8 English pins plus 3 formula cases); restored, blob == HEAD. Full spec suite (984 files / 29879 passed) last run at 2724c5e4, not re-run on 1660e96b (declared narrowing: only token-estimate.ts/test.ts changed under spec/src; CI runs the full suite).", "gates": "check:generated: all 14 up to date. Derived gate list identical to the 2724c5e4 derivation (112 commands); a 45-command subset re-run on 1660e96b: 45/45 exit 0; the rest from the full reconciliation at 2724c5e4: 108 exit 0, 4 NOT MEASURED (exit 3 prerequisite). overlap-check before push: clean.", "dogfood_battery": "n/a", "line_budget": "9 files; about +470 / -6 vs base", "deviations": [ "pr_create was refused by the auto-mode classifier in the dev session and was not re-sent; the seat session opened the PR", "long digit-run and URL pins: under A they hold for 8-12 digit runs and plain URLs, not for 16+ digit runs or a URL with a random hex id, so those are not pinned (open question below)", "unknown-model warning merged with the batch-size warning", "BigModel embedding-3 documented at 3072", "full spec suite not re-run on the new head (declared narrowing)" ], "open_questions": [ "Ruling A still under-counts long random alphanumerics against cl100k: 16-20 digit runs 35 vs 36; a URL with a 32-hex id 57 vs 58; sha256 hex + base64 38 vs 81; a UUID 19 vs 40. Options: A-as-landed (document the limitation); B (digits ceil(n/3), letters ceil(n/4)); C (mixed letter+digit run ceil(n/2), digit run ceil(n/3), letter run ceil(n/4)). Dev recommends C. Routed to the maintainer through the seat." ], "security_findings": "none", "out_of_scope_findings": [] }objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Ruling recorded · 2026-11-25T02:26Z · a follow-up to ruling 2 in 7149124439, put to the maintainer in seat repo:objectstack#4's session.
The question: ruling 2's formula (an ASCII letter/digit run counts ceil(length / 4)) still under-counts long identifiers. These readings were measured against the reference tokenizer during review of PR #37171:
So inputs heavy in order numbers, hashes, UUIDs or JSON can still pass the check and be truncated by the provider without a word.
The options:
The seat recommended C. The maintainer's answer, verbatim: 「C」.
What the PR now owes:
Over-estimating plain alphanumeric codes by up to about 2× is the accepted cost. Inputs near the limit may be refused early, with a message that says why.
objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Ruling recorded · 2026-11-25T02:58Z · the residual under ruling C (7150730452), put to the maintainer in seat repo:objectstack#4's session.
183346bdof PR feat(embedder-openai): an over-limit input is refused, not truncated (known-model input limits, one shared token estimate) #37171, formula C covers two of the four measured cases (the 20-digit number and the URL with a 32-hex id). Two cases are still under-counted against cl100k: a UUID (28 vs 40) and sha256 hex plus base64 (71 vs 81). cl100k splits random hex at about 1 character per token and base64 at about 1.4, which is finer than the mixed class's 2.knowledge-rag.mdx, and in the PR's Acceptance notes.objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
os-dev report · card #37093 · head
183346bd87274ce26d8d91f585562e73169c43a2· PR #37171 · ruling 「C」 (7150730452), residual ruled 「C 照现在合入」 (7151457223)Relayed from the dev session
session_01QSeKYpJCg2rG1RGK4BwAKx. The dev session made no GitHub writes: its relay command was refused by the auto-mode classifier, and it did not retry. The seat wrote the PR body instead.{ "issue": 37093, "status": "done", "branch": "claude/issue-37093-embedder-input-limit", "pr": 37171, "head": "183346bd", "summary": "Ruling C in packages/spec/src/shared/token-estimate.ts: an ASCII run is counted by class — letters only ceil(n/4), digits only ceil(n/3), letters and digits mixed ceil(n/2) — via asciiRunTokens(); ASCII_RUN_CHARS_PER_TOKEN = { letters: 4, digits: 3, mixed: 2 } (same export name, no new export). CJK, punctuation, whitespace and x1.1 unchanged. Docblock, content/docs/ai/knowledge-rag.mdx and changeset updated.", "tests": "spec token-estimate.test.ts 28 passed (10 zh/mixed + 10 English cl100k fixtures incl. en-digits-20 and en-url-hex-id); embedder-openai 27 passed, the 'Split the text below the limit' wording pinned; typecheck 0. Per-class ablation: digits 3->4 turns en-digits-20 red; mixed 2->4 turns en-url-hex-id red; letters already 4 (no-op, no own pin). Each restored, blob == HEAD.", "gates": "check:generated 14/14; api-surface, export-origins, exported-any, docs, nul-bytes, doc-authoring and the three changeset gates exit 0; overlap-check clean. CI at 183346bd: 58 success, 12 skipped, 0 failed.", "deviations": [ "pr_create and the body edit were refused in the dev session; the seat opened the PR and wrote the body on the maintainer's authorization", "UUID and sha256+base64 pins not landed: under C they estimate 28 vs 40 and 71 vs 81 (cl100k); documented, unpinned, per the maintainer's 「C 照现在合入」", "letters-class ablation is a no-op", "full spec suite not re-run since 2724c5e4 (only token-estimate.ts/test changed under spec/src; CI ran it)" ], "open_questions": [], "security_findings": "none" }objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
Delivered · PR #37171 merged as
3d4f4238a5, through the merge queue. Not Tier H.@objectstack/specnow exportsestimateTokensfromshared, with the ruling-C formula. The residual (hex, base64, UUIDs, emoji, rare ideographs) is documented and not pinned, as the maintainer accepted.embedder-openairefuses an input over the model's known input limit before anything is sent, and does not truncate it.maxInputTokensoverrides the limit. The refusal message tells the caller to split the text.content/docs/ai/knowledge-rag.mdx. Changeset:specpatch,embedder-openaipatch.8007e0bf. Landing record: comment 7153163108.pm:dispatchedremoved. Zone a4-K closes out this card.