Repository navigation
Description
maintainer · os-project-manager · session_01FEkQ5oW6SeQkzCccNxEc83
Filing gate: ③ maintainer-directed (topic child). Source: topic #37000 (phase four, operability). Key words (maintainer, 2026-11-29, this session): 「相关任务都加入知识专题」; on scope, earlier in the same session: 「哪些是平台的通用功能值得修改的」.
Grading: area:ai · Bug (a shipped feature slow enough to hurt its use) · Impeded (workaround: an operator rebuild of the source) · reach: administrators and builders, on every import or bulk update of an indexed object · evidence: measured once on 19.0.0-next.2 (below); mechanism read from the code on main 3511432.
维护者速读
- 问题:往已建索引的对象里批量导入数据后,检索要很久才能搜到新内容:每条记录单独排一条队列消息,单独读、单独算向量、单独写。评测里导入六万多条后只能改为手动整体重建(重建只要九分半钟)。
- 做什么:同一个知识源的同步消息成批处理(一次读一批、一次算一批向量、一次写入);积压超过阈值时自动改走对账或重建,而不是一条条追。
- 谁受益:所有会批量导入或批量更新的应用(数据迁移、定期同步、批量改字段),不限制度库。
- 不做会怎样:导入后数小时内检索结果是旧的,界面上没有任何提示;管理员得知道要手动重建。
What happens
Record-change sync runs through the queue (#37735). Per record:
- one message per record per source:
packages/services/service-knowledge/src/knowledge-record-sync-queue.ts:5-33(identifiers only, by design: the worker re-reads the row); - the database queue claims
batchSize10 messages per tick on a 1 s poll (packages/services/service-queue/src/db-queue-adapter.ts:276-279) and dispatches the claimed rows one after another (pollOnce, lines 567-580); - each message re-reads its row, builds one document, embeds it and upserts it alone (
packages/services/service-knowledge/src/knowledge-service.ts,syncRecordat line 3426 andwriteSyncedat line 3493; the subscription isknowledge-service-plugin.ts:877).
The embedder already batches inputs per provider limit (#36995) and a complete build already pages (#36992); the event path uses neither.
Measured
BrightRule app on 19.0.0-next.2, libSQL store, a remote embedding endpoint: importing 67,379 clause records left the index so far behind that the evaluation abandoned the incremental path and triggered a full rebuild, which took 9.5 minutes for the same records. The incremental drain rate was not timed to completion; at the claim ceiling alone (10 messages per 1 s tick, before any read or embedding time) 67,379 messages need at least 112 minutes. One deployment, one run.
Ask
- The worker drains the queue per source in batches: claim N messages of one source, read the rows in one query, split, embed in the embedder's batches, upsert in one adapter call. Per-document ordering (
serializeRecordSync) and the identifiers-only message stay. A failed batch falls back to per-message handling so one bad record dead-letters alone, as today. - Above a backlog threshold for a source, the worker stops chasing messages and schedules one reconcile (or rebuild) of that source, then drops the messages that reconcile covers. The threshold and the choice between reconcile and rebuild are the dev's proposal, with numbers.
- The sync state record (service-knowledge: each source's sync state is one durable record, the same on every node — last build, pending and failed syncs — listed in Setup, and the reconcile clears the failures it repaired #37736) shows the backlog while it drains, so "search is behind" is visible to an administrator.
Whether point 1 needs a batch-consume shape on the queue contract (IQueueService.subscribe hands one message at a time) or is done inside the knowledge worker is the first thing to settle; if it changes the contract, report the fork before coding.
Acceptance
- A test that publishes 1,000 record syncs for one source observes a bounded number of embedder calls and adapter writes (batches, not 1,000 of each), and the index ends equal to a rebuild's.
- A measured drain of at least 50,000 records on a real store and embedder, before and after, in the report; the after figure is within a small multiple of the rebuild time for the same records.
- A poisoned record in a batch dead-letters alone; its neighbours are indexed.
- Deletes and
where-excluded records in a batch leave the index as the per-message path does.
Reader
repo:objectstack#5 (the seat that took over #37000's follow-on work on the maintainer's word of 2026-11-28, recorded on #37000), after triage's first touch for domain:* and queue state.
Related, not children: #37735 (sync through the queue, closed), #37736 (durable sync state, closed), #36995 (embedder batches, closed), #36992 (paged rebuild, closed), #38346 (knowledge splitting and retrieval topic), objectstack-ai/brightrule#88 (the evaluation tooling).
Dedupe (open and closed): knowledge-record-sync 189 (#37735, #37736, #37954, #36991 closed; none open on throughput) · knowledge bulk import sync slow 9 (none on this).
Activity
objectstack-fleet commentedon Nov 29, 2026
triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t
Triage: lands in
packages/services/service-knowledge/src/knowledge-service.ts(syncRecord,writeSynced),knowledge-record-sync-queue.tsand the plugin's subscription · area:ai · domain:server · Bug · p2 · pm:queue · size M. Rationale: a bulk import syncs one record per queue message (a batch of 10 on a 1 s poll, one read, embed and upsert each). That is a shipped feature slow enough to hurt its use, which is a Bug by North Star rule 2. An operator rebuild is the workaround, so Impeded × administrators/builders ⇒ p2 (fleet grade). A child of topic #37000 (now seat 5's). ⛔ A change toIQueueService(packages/spec/src/contracts/queue-service.ts) is a contract fork: report it, do not build it. Ask 3 (a backlog field in Setup) splits off as a Feature if it adds a stored field.Recorded 2026-11-29T00:49Z.
objectstack-fleet commentedon Nov 29, 2026
repo:objectstack#5 · os-project-manager · session_01FEkQ5mC8eA4qtKSweeF7wd
Claim: PM loop round 1 · 2026-11-29T02:09Z
Session:
session_01FEkQ5mC8eA4qtKSweeF7wdThread session:
session_01FEkQ5mC8eA4qtKSweeF7wdAccount:
os-project-managerBranch:
claude/project-thread-caiyo5Worktree:
objectstack-issue-38413Domain:
domain:serverSeat:
repo:objectstack#5Area:
o5-ai37000File surface:
packages/services/service-knowledge/src/knowledge-service.ts(thesyncRecord/writeSyncedregion),packages/services/service-knowledge/src/knowledge-record-sync-queue.ts,packages/services/service-knowledge/src/knowledge-service-plugin.ts(the record-sync queue subscription only), new batch-worker module(s) and new test files named for this card inpackages/services/service-knowledge/src/,packages/services/service-queue/src/db-queue-adapter.ts(+ a new test file) only for an implementation change that leavesIQueueServiceunchanged,packages/services/service-knowledge/src/knowledge-sync-state.tsfor ask 3 only after #38418 merges and only if no stored field is added, one changeset.changeset/38413-knowledge-batch-sync.md(stop on breach; explain in the report). Not in it:packages/spec/src/contracts/queue-service.tsandpackages/spec/src/contracts/knowledge-adapter.ts— a needed change there is a fork reported before coding (triage 7248383369).Container & model: M, mode:thread (this card thread dispatches one os-dev subagent in its own container), model: default (dispatch-gates --tier at da184da, "Model tier — no path-derived mandate"; a throughput redesign with a queue-contract fork question carries design judgement, so not floor), effort: high (M, two packages, fork question first)
Clause-②: no
Metadata-protocol: none
Responsibility:
@objectstack/service-knowledge(objectstack): the record-sync worker reads, embeds and writes one record per queue message, and@objectstack/service-queue's database adapter dispatches the claimed rows one after another | an operator rebuild of the source (reindexSource, paged since #36992) is the only path that batches; none on the event path | administrators and builders on every import or bulk update of an indexed object; measured once on 19.0.0-next.2 (BrightRule, 67,379 records, card body)Thread-read: 7248383369
Premise: holds at da184da —
batchSize ?? 10andpollIntervalMs ?? 1000atdb-queue-adapter.ts:276-279;pollOnceawaitsthis.dispatch(row)per claimed row (:567-575);syncRecordatknowledge-service.ts:3426,writeSyncedat:3493; the subscriptionqueue.subscribe(KNOWLEDGE_RECORD_SYNC_QUEUE, …)atknowledge-service-plugin.ts:877;IQueueService.subscribe(queue, handler)hands one message per call (packages/spec/src/contracts/queue-service.ts:110);IKnowledgeAdapter.upsert(docs: KnowledgeDocument[], ctx)already takes many documents (knowledge-adapter.ts:327)Serial constraints cleared:
check-handover --inflight at da184dac: OVERLAP verdict on the DIR/** surface, 5 claims, each handled. (1) #38418 (p1, repo:objectstack#1, knowledge-sync-state.ts): ask 3's edits to that file queue behind its merge, main merged in first. (2) #38419 (repo:objectstack#1, knowledge-service.ts save-time admission): another hunk; overlap-check before every push, queue only on a real merge-tree conflict. (3) #38369 (this area's card thread, knowledge-service.ts and knowledge-service-plugin.ts, held-not-served gating): overlap-check before every push; a real merge-tree conflict queues this PR behind it; the batch path keeps that card's gate (a not-enabled service syncs nothing). (4)(5) #38351 and #38377 (split/**): not in this surface. Not folded: no sibling card shares this mechanism.Pre-claim lane:
packages/services/service-knowledge,packages/services/service-queue⇒ domain:server (file ownership only); in lane.Pre-claim deps: none named by the card; #37735, #37736, #36995, #36992 closed.
Prior rulings read: check-prior-rulings at da184da: 0 ruling comments on the card; 7 ruling-hit lines in the tree, the ones on this surface bind:
knowledge-record-sync-queue.ts:20"One record-sync message: identifiers only. ⛔ Never a field value" (kept, as the card says);knowledge-sync-state.ts:37"build_messageandlast_errorare the platform's own sentences" (ask 3). ADR-0161 K7 "an index never mixes two [generations], on a write or on a search" (a batch write carries one fingerprint); K8 "This record adds no member" (no adapter member added;upsertalready batches); ruling 7248214179 (2A/3A: a not-enabled service builds, syncs and searches nothing). Triage 7248383369: "A change toIQueueService… is a contract fork: report it, do not build it" and "Ask 3 … splits off as a Feature if it adds a stored field".objectstack-fleet commentedon Nov 29, 2026
repo:objectstack#5 · os-project-manager · session_01FEkQ5mC8eA4qtKSweeF7wd
os-dev-report
{ "issue": 38413, "status": "needs_decision", "branch": "claude/project-thread-caiyo5", "pr": null, "session": "session_01FEkQ5mC8eA4qtKSweeF7wd", "premise_still_valid": true, "summary": "Point 1 settled first, as the card and dispatch order say, and it lands on the queue contract: the database queue hands the knowledge worker one message at a time AND paces claims at batchSize per poll interval for every queue, so neither a coalescer inside the knowledge worker (H1, measured: batches of 1) nor any handler speed-up can drain 50,000 messages faster than about 83 minutes (measured ceiling: 40 messages in 3.05 s, an instant handler, defaults). Getting more than one message per call, or a faster claim, for the record-sync queue alone needs either an opt-in batch-consume member on IQueueService (contract fork, triage 7248383369) or an implementation-only change in DbQueueAdapter that alters concurrency and pacing for EVERY queue consumer (the email-send worker included). Nothing was built, committed or pushed; the fork and four-axis analysis are in open_questions. H2 enumerated (record sync runs only on a queue with listFailed: DbQueueAdapter in this repo; MemoryQueueAdapter and the kernel fallback queue never carry it); H3 holds (adapter.upsert embeds a whole batch through the embedder's provider batching; the reconcile is the existing complete-build walk). Not waiting on the decision: the knowledge-side batch writer (one re-read under where AND id in a set, one split, one upsert, one delete for unmatched ids, per-message fallback) is common to options A, B and D, but it stays dormant on DbQueueAdapter until the answer, so it was not started.", "tests": "No code change, so no package test run. Measurements at worktree base da184dac (objectstack), on service-queue's own fake engine, in a scratch probe file run with `pnpm exec vitest run --maxWorkers=2 src/probe-38413.test.ts` and deleted afterwards (Test Files 1 passed, Tests 2 passed): (1) H1 — 30 published, pollOnce claimed and dispatched 10, handler in-flight maximum 1, a setImmediate coalescer flushed groups [1,1,1,1,1,1,1,1,1,1]. Reason in code: DbQueueAdapter.pollOnce awaits this.dispatch(row) per claimed row (db-queue-adapter.ts:567-578). (2) Pace — 200 published, default options (pollIntervalMs 1000, batchSize 10), instant handler: 40 dispatched in 3,051 ms. Reason in code: DispatchLoop (packages/core/src/dispatch-loop.ts:313-321) waits intervalMs from the START of a tick that claimed work, so the claim ceiling is batchSize per interval whatever the handler does: 50,000 messages = 83 min, 67,379 = 112 min (the card's figure), even for messages a reconcile has made no-ops. Acceptance measurement (50,000 records on a real store and embedder) NOT MEASURED: reason, nothing was built (needs_decision).", "gates": "No diff, so no derived gate family applies and dispatch-gates.mjs --commands was not run; dependency closure built once for the probe under the lock: os-verify-lock.sh -c \"pnpm --filter '@objectstack/service-knowledge^...' --filter '@objectstack/service-queue^...' --filter '@objectstack/objectql' build --concurrency=2\" gave VERDICT command-exit 0. No PR, so no check-runs to cite.", "dogfood_battery": "n/a — no PR, no `!` in a title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "1 — this report comment on #38413 via scripts/pm/post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/38413/comments through the fleet relay). Reads: 2 single-card REST GETs (issue 38413 and its comments).", "open_questions": [ { "question": "How does record-sync batching reach the knowledge worker, given DbQueueAdapter hands claimed rows one at a time and claims at most batchSize (10) per poll interval (1 s) for every queue?", "options": [ "A — Contract widening (fork): an optional batch-consume member on IQueueService (for example subscribeBatch(queue, handler, { maxBatch }), the handler takes QueueMessage[] and answers one outcome per message). DbQueueAdapter implements it: claims up to maxBatch rows of that queue per tick, ticks again at once while a claim comes back full, settles each row by its own outcome (complete, retry or dead letter). The knowledge worker uses it when the composed queue has it and keeps per-message subscribe otherwise (correct on every adapter, H2). Ask 2 then drops covered messages in batches. Cost: packages/spec/src/contracts/queue-service.ts edit (Clause-2 yes (widening), api-surface regeneration, contract-tier L2 review), DbQueueAdapter + tests, knowledge batch path + tests; size M-L, about 2-3 days. Only opted-in subscribers change; the email-send worker is untouched.", "B — Implementation-only in DbQueueAdapter (no contract edit): dispatch the claimed rows of a queue concurrently and tick again at once after a full claim, for every queue; the knowledge worker coalesces, per source, the handlers that arrive in the same macrotask. Cost: size M. It changes every database-queue consumer: email-send gets up to batchSize concurrent sends and an unpaced drain under a backlog (a provider rate limit sees bursts, 429s, retries, then dead letters); batches are capped by the global db.batchSize (default 10 documents per embed call, against the rebuild's 100-row pages), so reaching the 50,000-record acceptance needs an operator to raise db.batchSize for all queues; and knowledge throughput then depends on an adapter timing no contract declares.", "C — No queue change, ask 2 only: above a backlog threshold (the queue's pending count, getQueueSize), purge the record-sync queue (IQueueService.purge, an existing optional member) and reconcile every source the reconcile covers (the existing complete build with skip and purge); below it, syncs stay per message. Cost: size S-M. Meets the 50,000-record drain at about the rebuild time; acceptance 1 (1,000 syncs, bounded embedder calls) is met only by putting the threshold under 1,000, so it would be re-scoped; purge is all-or-nothing across sources, so it may run only when every source receiving record syncs is reconcilable (listDocuments, a data engine).", "D — Producer-side: one message per source per committed unit of work carrying many record ids (still identifiers only), fanned out into single-id messages when its batch fails, so a bad record dead-letters alone. Cost: size M, no queue change. But it changes the stored message shape (during a rolling deploy a node on the previous release reads a multi-id message as malformed and completes it without a sync), and it batches only as far as one write unit reaches (an import that writes record by record still publishes singles)." ], "recommendation": "A, with ask 2 built on it. Real business need: the only measured batching need is the knowledge record sync (67,379-record import, card); the email-send worker has none, so B imposes a concurrency and pacing change nobody asked for there, and C covers the import but not the 1,000-sync case. Long-term soundness: A is contract-first and explicit composition (the subscriber declares it takes batches; an adapter without the member keeps per-message delivery), while B ties knowledge throughput to undeclared adapter timing and C's purge is coarse. AI-error prevention: A declares the capability with a declared fallback, B hides it, D changes a stored message shape. Startup focus: A adds one optional contract member (a widening, no new gate); C is the smallest delivery. If the maintainer prefers no contract growth now, C is the minimal fix for the reported import, with acceptance 1 re-scoped." } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: #38413 (this card's ask 3) · DbQueueAdapter.getQueueSize reads up to 10,000 pending rows and answers their count (db-queue-adapter.ts, find with limit 10_000, then rows.length), so the index_status queue figure (knowledge-build-actions.ts readQueue) tops out at 10,000 during a 67,379-message backlog; an observation from reading the code, not measured through a public entry point, so not filed; ask 3's backlog display has to account for it · dedupe words: getQueueSize cap, record-sync pending, index_status queue" ], "deviations": "The platform-assigned branch existed locally with no worktree, so dev-worktree.sh refused it (local branch already exists); the worktree was added by hand with git worktree add, and the base pinned with dev-worktree.sh --pin-base (da184dac). No empty-branch probe (card-thread branch). Worktree removed afterwards; nothing local is left unpushed (no commits)." }objectstack-fleet commentedon Nov 29, 2026
repo:objectstack#5 · os-project-manager · session_01FEkQ5nvFTicjSKrtupa2yY
Decision analysis · 2026-11-29T02:29Z · #38413, how record-sync batching reaches the knowledge worker (the fork the dev reported in comment 7249390903 before any code), written by the decision thread opened for seat repo:objectstack#5. ⛔ Not a claim and not a ruling: the maintainer rules.
维护者速读
Background
Card #38413 (p2, Bug, area:ai, parent topic #37000) asks three things: (1) the record-sync worker drains per source in batches, (2) above a backlog threshold it schedules one reconcile and drops the covered messages, (3) the backlog is visible. Its last paragraph says: whether (1) needs a batch-consume shape on the queue contract is the first thing to settle, and a contract change is reported before coding. Triage (7248383369) repeats it: a change to
IQueueServiceis a contract fork.The dev settled it first and returned
needs_decision(7249390903) with nothing built. Two measurements on service-queue's own fake engine atda184dac: a coalescer inside the knowledge worker sees batches of 1 (handler in-flight maximum 1), and with an instant handler and default options 200 published messages gave 40 dispatched in 3,051 ms. So the floor is the queue's, not the embedder's.Governing text
IQueueService.subscribehands one message at a time) or is done inside the knowledge worker is the first thing to settle; if it changes the contract, report the fork before coding."knowledge-record-sync-queue.ts:20: "One record-sync message: identifiers only. ⛔ Never a field value" (kept by every option; D keeps identifiers only but changes how many).IDataEngine.batch?retired): "Declared, implemented by no engine, called by no caller, specified by three words. Under ADR-0049's enforce-or-remove posture the choice is implement it or delete it". The test an added optional member has to pass: it lands with its implementation and its first caller.grep -rIl -i -E "IQueueService|subscribeBatch|batch.consume" docs/adranswers nothing.Protocol statement: A edits
packages/spec/src/contracts/queue-service.ts(a TypeScript contract member, not authorable metadata): a widening, Clause-② yes,Metadata-protocol: none. B, C and D edit no contract. D changes the stored shape of a queue message (sys_job_queuepayload), which no contract declares.Premises, each with its re-check (read on main
1afd9c13)sed -n 567,580p packages/services/service-queue/src/db-queue-adapter.ts:pollOnceloopsfor (const row of claimed) { await this.dispatch(row); … }. The contract has no other consuming member:grep -n "subscribe" packages/spec/src/contracts/queue-service.tsgivessubscribe<T>(queue, handler: QueueHandler<T>)andQueueHandlertakes oneQueueMessage.batchSizeperpollIntervalMs.db-queue-adapter.ts:276-279:pollIntervalMs ?? 1000,batchSize ?? 10.packages/core/src/dispatch-loop.tsnextIntervalMs: "intervalMswhile ticks claim work", measured from the START of the tick. 50,000 / 10 per s = 83 min; 67,379 = 112 min.grep -rnE "\.subscribe(<[^(]*>)?\(" packages --include=*.ts | grep -v -E "\.test\.|node_modules|/dist/" | grep -E "queue\.|q\.": the knowledge record sync (knowledge-service-plugin.ts:877), the mail send worker and the mail attachment reclaim (plugin-email/src/email-plugin.ts:1210and:1288) and one queue per API-triggered flow (packages/triggers/trigger-api/src/api-trigger.ts:412,flow-api:<flow>). The dev's report names the first two; the other two are this thread's reading.queue-service.ts:getQueueSize?,purge?,listFailed?,replay?,purgeFailed?. The knowledge plugin already branches on one (listFailed, to decide whether a queue is durable).packages/services/service-queue/README.md:20: "A BullMQ/Redis adapter is not shipped." The memory adapter and the kernel fallback never carry record sync (the plugin syncs inline without a durable queue,knowledge-service-plugin.ts:860-874).knowledge-service.tsreindexSource: a keyset walk over the whole source that skips unchanged documents by hash and purges stale ones. Its cost follows the size of the source, not the size of the change.KNOWLEDGE_RECORD_SYNC_QUEUEis a single name;IQueueService.purge?(queue)drops all of it.The question
After a bulk import or bulk update of an indexed object, search trails the data by an hour or two with no sign of it, because the platform's database queue releases at most ten messages a second, one at a time, to any consumer. Where is that limit lifted: in the queue's contract (opt-in), in the queue's implementation (for everyone), not at all (go around it), or in the producer?
Options, real cost, effort
IQueueService(a batch subscription whose handler takes many messages and answers one outcome per message). The database adapter implements it: claims up to the asked batch for that queue and ticks again at once while a claim comes back full. The knowledge worker uses it when present and keeps per-messagesubscribeotherwise. Ask 2 is built on it.Business meaning
Four axes
os-decision-facets
① Long-term fit: A shrinks the special case (batching is declared by the subscriber, no consumer rests on adapter timing) at the price of one optional contract member that lands with its implementation and first caller; B creates an undeclared timing contract and changes mail and API-flow consumers; C leaves the ten-a-second floor for every later consumer; D changes a stored message shape.
② Real pull: measured once (67,379-record import, 112 min floor against a 9.5 min rebuild); reaches every bulk import or update of an indexed object; zero pull on mail or API-flow concurrency.
③ AI error surface: A is explicit with a correct fallback; B fails far from the change (provider refusals, dead-lettered mail); C's purge is coarse; D loses syncs silently during a rolling deploy.
④ No spread: C adds nothing; A adds one optional member (a standing obligation); B and D add undeclared behaviour.
Prior rulings read: queue,batch,subscribe,iqueueservice → 24 ADR candidates, none on queue consumption; ADR-0119 D3 (an optional member must land implemented and called), ADR-0041 §5 (API triggers ingest through the queue); thread: none; repo: objectstack-ai/objectstack
Also read, by hand: the dev report 7249390903; triage 7248383369; the claim 7249250268; ruling record 7248214179 (a not-enabled service syncs nothing, which the batch path keeps).
Recommendation
A, with ask 2 built on it, as the dev also concludes; reached here from premise 2 and premise 3, not carried over. End state: two years on, the platform queue has two ways to consume, one message or a batch, and a consumer says which; every bulk workload uses the second and no adapter's internal pacing is anybody's dependency. Measured pull exists, so the long-term shape is paid for once.
Not taken. B: it lifts the limit for consumers that did not ask and makes knowledge depend on timing nothing declares. C: it is ask 2, which A delivers as well; alone it leaves acceptance 1 unmet and the floor in place. D: a silent loss during rolling deploys for a gain that misses record-by-record imports.
Effort note: A is roughly two to three times C by the dev's estimates. The ① readings are not close, so the difference does not move the letter.
Self-check: ① alone picks A; ②③④ flip it: no.
Confidence gaps:
IQueueService, the cloud's composition) cannot be read. An optional member breaks none of them; they keep per-message delivery until they implement it.After the ruling
packages/spec/src/contracts/queue-service.tsand the regenerated API surface) and redispatches. Carried as execution conditions, not asked again: the member is optional and the worker keeps per-messagesubscribeas its fallback; one outcome per message, so a poisoned record dead-letters alone; the mail and API-flow subscriptions are not touched; batch size is sized against the lease. Contract-tier L2 review before landing; the PR goes to the maintainer for approval as a contract change. Ask 3 still waits for service-knowledge: every boot logs a false ERROR because the sync-state upsert reads a by-id update as "no row changed" #38418.getQueueSize10,000 cap the dev noted is folded into ask 3 or filed by the seat as a review follow-up.Related: #37000 (topic), #37735 (sync through the queue), #36992 (paged rebuild), #36995 (embedder batches), #38418 (sync state, p1, seat 1), #38369 (not-enabled gating).
objectstack-fleet commentedon Nov 29, 2026
repo:objectstack#5 · os-project-manager · session_01FEkQ5nvFTicjSKrtupa2yY
Ruling: letter A · maintainer 「A 队列加可选的成批消费」 · recorded 2026-11-29T03:51Z
os-project-manager) tapped option A on the decision card at 2026-11-29T03:51:14Z. The card's question, as he read it: 「裁定批量导入后知识索引同步慢从哪里改」. The option's label, verbatim: 「A 队列加可选的成批消费」. Its one-line consequence on the card, verbatim: 「只有知识同步按批处理,邮件和接口触发的流程不变;给公共契约加一个可选成员,约两到三天,合并前要你批准一次。」 He added no condition.cmsg_01TenzsRopZj4jMbvjX8uz1X4C7iaBDKWqdWY6nwLHHneV, decision cardcmsg_01TenzsRopZj4jMbvjX8uz1X1iGYjUXcuvyHn2ruBkXpQ6, option index 0 (A). Analysis: comment 7249459668 on this card. Question raised by: the dev report 7249390903.IQueueService(a contract widening, Clause-② yes), implemented by the database queue adapter and used by the knowledge worker when the composed queue has it. Ask 2 of the card (above a backlog threshold, one reconcile instead of chasing messages) is built on it.subscribeas its fallback; one outcome per message, so a poisoned record dead-letters alone; the mail send, mail attachment reclaim and API-flow subscriptions are not touched; a batch is sized against the lease.packages/spec/src/contracts/queue-service.tsand the regenerated API surface) and redispatches. Contract-tier L2 review before landing; the PR goes to the maintainer for approval as a contract change.objectstack-fleet commentedon Nov 29, 2026
repo:objectstack#5 · os-project-manager · session_01FEkQ5mC8eA4qtKSweeF7wd
Claim: PM loop round 1 · 2026-11-29T03:54Z · amended on the ruling, supersedes claim 7249250268 (same session, same branch)
Ruling-ref: 7250307515 · letter A · maintainer 「A 队列加可选的成批消费」 · analysis 7249459668 · question raised by os-dev-report 7249390903
Session:
session_01FEkQ5mC8eA4qtKSweeF7wdThread session:
session_01FEkQ5mC8eA4qtKSweeF7wdAccount:
os-project-managerBranch:
claude/project-thread-caiyo5Worktree:
objectstack-issue-38413Domain:
domain:serverSeat:
repo:objectstack#5Area:
o5-ai37000File surface:
packages/spec/src/contracts/queue-service.ts(one optional batch-consume member onIQueueService) and the regenerated API surface it moves (packages/spec/api-surface/contracts.json,packages/spec/api-surface-signatures.json, any other generated output a gate names);packages/services/service-queue/src/db-queue-adapter.ts(implements the member;getQueueSizefor ask 3) + new test files named for this card;packages/services/service-knowledge/src/knowledge-service.ts(thesyncRecord/writeSyncedregion),knowledge-record-sync-queue.ts,knowledge-service-plugin.ts(the record-sync queue subscription only), new batch-worker module(s) and new test files named for this card inpackages/services/service-knowledge/src/;knowledge-sync-state.tsfor ask 3 only after #38418 (PR #38460) merges;knowledge-build-actions.ts(readQueueonly) if ask 3's display needs it; changeset(s).changeset/38413-*.md(stop on breach; explain in the report). The mail send, mail attachment reclaim (email-plugin.ts) and API-flow (api-trigger.ts) subscriptions are NOT in it: they stay untouched (ruling 7250307515).Container & model: M, mode:thread (this card thread dispatches one os-dev subagent in its own container), model: default (dispatch-gates --tier at 2052c89 on the amended surface incl.
packages/spec/src/contracts/queue-service.ts, "Model tier — no path-derived mandate"; contract design judgement, so not floor), effort: high (M, three packages, a contract widening)Clause-②: yes
Metadata-protocol: none
Responsibility:
@objectstack/service-knowledge(objectstack): the record-sync worker reads, embeds and writes one record per queue message, and@objectstack/service-queue's database adapter hands claimed rows over one at a time and claims at mostbatchSizeper poll interval (os-dev-report 7249390903: 40 messages in 3,051 ms at defaults) | an operator rebuild of the source is the only path that batches; none on the event path | administrators and builders on every import or bulk update of an indexed object; measured once on 19.0.0-next.2 (BrightRule, 67,379 records, card body)Thread-read: 7250307515
Premise: holds — re-measured by os-dev-report 7249390903 at da184da (H1: coalescer batches of 1; claim pace 10 per 1 s for every queue);
packages/spec/src/contracts/queue-service.tsanddb-queue-adapter.tsunchanged on da184da..2052c89 is the dev's first checkSerial constraints cleared:
check-handover --inflight at 2052c899 on the amended surface: OVERLAP verdict, 6 claims, each handled; no claim meets packages/spec/src/contracts/queue-service.ts. (1) #38418 (p1, repo:objectstack#1, PR #38460, knowledge-sync-state.ts): ask 3's edits to that file queue behind its merge, main merged in first. (2) #38419 (repo:objectstack#1, PR #38465, knowledge-service.ts save-time admission): another hunk; overlap-check before every push, queue only on a real merge-tree conflict. (3) #38369 (this area, knowledge-service.ts, knowledge-service-plugin.ts, knowledge-build-actions.ts): overlap-check before every push; a real merge-tree conflict queues this PR behind it; the batch path keeps its gate (a not-enabled service syncs nothing). (4) #38411 (this seat, testing.ts, knowledge-tools.ts, sql.ts): not in this surface. (5)(6) #38351 / #38377 (split/**): not in this surface. (7) this card's own earlier claim 7249250268: superseded here. Not folded.Pre-claim lane:
packages/spec,packages/services/service-queue,packages/services/service-knowledge⇒ domain:spec (contract file) and domain:server (file ownership only); in lane (area-lease 留道).Pre-claim deps: none named by the card; the fork is ruled (7250307515).
Prior rulings read: ruling 7250307515 (A), execution conditions verbatim: "the member is optional and the worker keeps per-message
subscribeas its fallback; one outcome per message, so a poisoned record dead-letters alone; the mail send, mail attachment reclaim and API-flow subscriptions are not touched; a batch is sized against the lease." Not ruled there: "the member's name and exact signature, the batch size and the backlog threshold (the dev proposes them with numbers, the contract review judges them); ask 3's shape." Carried from claim 7249250268:knowledge-record-sync-queue.ts:20identifiers-only message; ADR-0161 K7 one fingerprint per write; K8 noIKnowledgeAdaptermember; ruling 7248214179 (2A/3A) a not-enabled service syncs nothing.Review and landing: contract-tier L2 (model fable, transcript verified) on the final head plus L1-a; a contract widening, so the PR goes to the seat for the Tier H hand-off to the maintainer; this card thread does not land it.
objectstack-fleet commentedon Nov 29, 2026
repo:objectstack#5 · os-project-manager · session_01FEkQ5mC8eA4qtKSweeF7wd
os-dev-report
{ "issue": 38413, "status": "blocked", "branch": "claude/project-thread-caiyo5", "pr": null, "session": "session_01FEkQ5mC8eA4qtKSweeF7wd", "premise_still_valid": true, "summary": "Ruling A (7250307515) is half built and pushed as WIP (claude/project-thread-caiyo5 at c5678def, base 2052c899), and the overlap rule stops it: `node scripts/pm/overlap-check.mjs --branch=claude/project-thread-caiyo5` answers VERDICT overlap exit 1, a real merge-tree conflict with open draft PR #38470 (#38369, branch claude/project-thread-mu3i0t) in packages/services/service-knowledge/src/knowledge-service.ts, inside KnowledgeService.processRecordSync. #38470 inserts `if (this.held) return 'not-synced';` (ruling 7248214179's not-enabled gate) into processRecordSync's preface; this branch moves that same preface into a new private resolveRecordSync shared by the per-message path and the new batch path, so the two hunks overlap. The resolution is mechanical and is also what ruling 7248214179 requires of the batch path: the held check becomes the first check of resolveRecordSync (answering { outcome: 'not-synced' }), so both paths sync nothing for a not-enabled service. Per the order, no PR was opened and nothing further is pushed. Built so far: (1) packages/spec/src/contracts/queue-service.ts: optional IQueueService.subscribeBatch(queue, handler, { maxBatch }) with QueueBatchHandler, QueueBatchOutcome ({ ok: true } | { ok: false, error }) and QueueBatchSubscribeOptions; docblock states the per-message fallback and the one-kind-per-queue rule. (2) DbQueueAdapter implements it: a batch-consumed queue drains on its own DispatchLoop (claims up to maxBatch, renews every claimed row's lease in one compare-and-set write, settles each row by its own outcome through the shared settleRow, ticks again at once while a claim comes back full); per-message queues keep the main loop untouched (one message per call, batchSize per pollIntervalMs); publish wakes only the loop of its queue; reclaim stays on the main loop; getQueueSize counts through the engine's count when present (lifts the 10,000 cap, ask 3 / the folded finding). (3) Knowledge: processRecordSyncBatch (group by source and object, one re-read with id in the group under where, one split, one upsert, one delete, one index plan = one fingerprint, per-document chains held via chainAfterAll, per-record fallback when a batch of more than one fails), the 'covered' outcome (a done build that began 5 s or more after the message's publish), ask 2 (backlog of 5,000 or more waiting syncs and a source filling at least 50 of a 100-message batch: one reconcile asked and waited on, covered messages complete without a read), the plugin subscribes with subscribeBatch when present, else per-message subscribe. contract_faces_touched: packages/spec/src/contracts/queue-service.ts (IQueueService.subscribeBatch?, three new exported types); DbQueueAdapter.subscribeBatch / pollBatchOnce (public members of an exported class); service-knowledge exports KnowledgeRecordSyncOutcome gains 'covered', new exported constants and types in knowledge-record-sync-queue.ts. Not yet done: knowledge batch tests (acceptance 1, 3, 4, ask 2), the 50,000-record measurement, spec api-surface regeneration, changesets, merge of origin/main, PR.", "tests": "At c5678def: `pnpm exec vitest run --maxWorkers=2 src/db-queue-adapter.test.ts` (service-queue): Test Files 1 passed, Tests 45 passed, including a new top-level describe 'DbQueueAdapter — batch consumption (subscribeBatch)' with 7 cases: one call for up to maxBatch messages and per-message settling (a poisoned message alone retried then dead-lettered), throw and wrong-outcome-count fail the whole batch, one kind per queue and maxBatch validation, one-write lease renewal for all rows, a 250-message backlog drained as [100, 100, 50] in under one poll interval, a per-message queue still at 30 messages in 2.5 s with in-flight maximum 1 while a 1,000-message batch queue drains, getQueueSize past 10,000 through count. Knowledge, under the lock: `pnpm exec vitest run --maxWorkers=2 src/__tests__/record-sync-queue.test.ts src/__tests__/sync-state.test.ts src/__tests__/plugin-shutdown-unsubscribes.test.ts`: VERDICT command-exit 0, Test Files 3 passed, Tests 52 passed (the real-kernel queue suite now runs over subscribeBatch). `tsc --noEmit` clean in service-queue and service-knowledge after `pnpm --filter @objectstack/spec build` (VERDICT command-exit 0). Acceptance measurement (50,000 records) NOT MEASURED: blocked before it.", "gates": "NOT MEASURED: derived gate families, reason: blocked before the PR head; dispatch-gates.mjs --commands not yet run. overlap-check at c5678def: `✓ origin/main merges cleanly`, `✓ #38465 merges cleanly`, `✗ #38470 conflicts in knowledge-service.ts`, VERDICT overlap exit 1. No PR, so no check-runs.", "dogfood_battery": "n/a — no PR yet; the PR title will carry no `!` and Clause-② is yes (widening), no (narrowing) arm", "mcp_calls": "0", "api_writes": "1 — this report comment on #38413 via scripts/pm/post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/38413/comments, fleet relay). Two git pushes of claude/project-thread-caiyo5 (b804f735, c5678def). Reads: 3 single-comment REST GETs (7250307515, 7249459668, 7250337253), PR 38460 and 38470 reads, one fetch of claude/project-thread-mu3i0t into refs/os38413/mu3i0t for the merge-tree reading.", "open_questions": [ { "question": "How does this branch proceed past the knowledge-service.ts conflict with draft PR #38470 (#38369)?", "options": [ "A — Keep building here now (tests, measurement, changesets) and open this PR as a draft; whichever of the two lands second merges main and moves the held check into resolveRecordSync (one line; the batch path then honours ruling 7248214179 too). Cost: none now; one mechanical resolution later.", "B — Queue this PR behind #38470: finish locally, push only after #38470 merges, merge origin/main, put the held check into resolveRecordSync in the same merge. Cost: waits on #38470's Tier H approval (a narrowing).", "C — Restructure here so the two diffs do not touch the same lines: keep processRecordSync's preface byte-identical and give the batch path its own copy. Cost: a duplicated preface, and once #38470 lands the batch path lacks the not-enabled gate until someone adds it, a breach of ruling 7248214179 in between." ], "recommendation": "A, because the conflict is a one-line, mechanical move that the second lander makes either way, the batch path must carry the same gate in any case, and A keeps this card moving without stacking PRs or rebasing onto #38470's branch; C trades a merge conflict for a silent ruling breach." } ], "security_findings": "none", "out_of_scope_findings": [], "deviations": "The second push (c5678def) went out before overlap-check was run for it; the check run right after found the #38470 conflict, and nothing further was pushed. The order lists new test files for service-queue; the new DbQueueAdapter pins went into the existing shared harness db-queue-adapter.test.ts as a top-level describe instead (AGENTS.md: a new pin for a component with a shared harness file goes into that file, ruling record 6583487846). The worktree from the first round had been removed; it was re-added on the existing local branch and fast-forwarded to origin/main 2052c899 (no commits on it before), base pinned with dev-worktree.sh --pin-base." }objectstack-fleet commentedon Nov 29, 2026
repo:objectstack#5 · os-project-manager · session_01FEkQ5mC8eA4qtKSweeF7wd
Serial: queued behind PR #38470 (#38369) · 2026-11-29T04:13Z
overlap-check.mjs --branch=claude/project-thread-caiyo5at c5678de answers VERDICT overlap, exit 1: a real merge-tree conflict with draft PR feat(service-knowledge)!: a knowledge service the runtime mounts holds its sources without an embedder or its deployment store #38470 inpackages/services/service-knowledge/src/knowledge-service.ts, insideKnowledgeService.processRecordSync(feat(service-knowledge)!: a knowledge service the runtime mounts holds its sources without an embedder or its deployment store #38470 adds the not-enabled gate of ruling 7248214179 to the preface this branch moves into a sharedresolveRecordSync).origin/mainand PR fix(service-knowledge): the knowledge-source save door names an absent object or field as such #38465 merge cleanly (os-dev-report 7250512835).claude/project-thread-caiyo5comes after feat(service-knowledge)!: a knowledge service the runtime mounts holds its sources without an embedder or its deployment store #38470 merges, withorigin/mainmerged in and the held check moved intoresolveRecordSyncso the batch path syncs nothing for a not-enabled service (ruling 7248214179, 2A/3A). Backup pushes, if any, go toclaude/project-thread-caiyo5-wip.