Repository navigation
Description
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
Filing gate: ③ maintainer-directed (topic child). Source: topic #37000; maintainer 2026-11-27 00:12Z 「用 fable评审后拆卡,你只负责当前任务,后续任务通过信箱交接给 objectstack #1」. Reviewed by an independent Fable pass before filing (row 15 of the epic is split in two: this card is its reconcile half, the queue half is the sibling card).
Grading: area:ai · domain:server · Feature · p2 (topic) · reach: every deployment that holds a knowledge source whose store lists its documents (pgvector, turso) · evidence: read.
维护者速读
- 问题:索引只靠「记录变动事件」跟数据保持一致。事件丢了、向量服务宕机、批量改删、写入回滚之后,索引就一直是旧的,除非管理员手工重建。
- 做什么:平台每天自动对一遍账:缺的补上、变了的重写、该删的删掉;没变的不重新向量化,所以不额外花钱。批量改删之后几分钟内也会自动对一遍。
- 谁受益:制度库、合同库这类长期运行的知识源;向量服务故障恢复后不用人盯着去重建。
- 需要你做的:无。
What
Carries ADR-0161 (docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md) K1 ("Events keep an index fresh; a reconcile pass keeps it correct"), K3 item 3 ("Reconcile is the platform's … its trigger and its batching are row 15's"), the K2 row for content/docs/protocol/knowledge.mdx §6 ("reconcile covers application-level predicate writes"), and the Execution row "row 15, and the sync-failure counts" ("the daily reconcile … reusing #37096's purge and K8 item 1"). It adds no adapter-contract member.
What is true on main at 579b85776: a complete walk already skips unchanged documents and purges stale ones (reindexWith / purgeDocuments, packages/services/service-knowledge/src/knowledge-service.ts), under the cluster lease and the fence (rebuildSource, knowledge-build.ts). Only two things start one: the boot pass and an administrator (KnowledgeBuildTrigger = 'boot' | 'operator'). content/docs/protocol/knowledge.mdx says so: "nothing runs that reindex on a schedule yet." And refresh.cron's tombstone (PR #37676) already tells authors "keeping the index correct between events is the service's reconcile pass", which does not exist.
- The reconcile pass.
KnowledgeServicegains one entry that walks the registered sources and, for each one due a reconcile, runs the existing complete build with a third trigger,reconcile, besidebootandoperator: same lease, same fence, same skip, same purge, samecompleteBuild. No second walk and no second purge is written. Sources run one after another on a node; a build another node holds isnot-run, as today. - Which sources it walks. An
objectsource whoserefresh.onRecordChangeis notfalse, with a data engine bound, on an adapter that haslistDocuments. An adapter without it can neither skip nor purge, so a daily walk would re-embed every document and remove nothing: such a source is left alone and said once per source atwarn, naming the operator's rebuild. A source whose index state readsnothing,new-fingerprint,recipe-changedorno-recipe-hashis built as the boot pass would build it (the samereadIndexStaterule), so a split or embedder setting saved while the server runs is picked up within a day instead of at the next restart. The PR states that this is a third moment the service reads the index state, beside K7's boot and source reload, and that the cost line every build prints is printed here too. - The schedule. The plugin schedules one job on the platform's job service (
IJobService.schedule; the precedent isMAILBOX_SYNC_JOB,packages/services/service-mailbox/src/mailbox-service-plugin.ts), cron, once a day by default, at an hour the PR states. One plugin option besidebuildAtBootturns it off or moves it (reconcile?: false | { cron?, timezone? }); the option lands with this reader and no settings key is added. The handler answers aJobRunOutcome:degradedwith a reason when a source's walk failed, lost its lease or timed out, so the job's run history shows it. With no job service the plugin says once at boot that nothing reconciles on a schedule, and the operator's rebuild stays the way. - After a predicate write. Today the
data.records.updated/data.records.deletedbranch of the event bridge (knowledge-service-plugin.ts) only warns that the index "cannot be repaired from the event stream". It now asks for a reconcile of every source over that object: one request per source however many bulk events arrive, started after a quiet period the PR states (minutes, not a day), through the same entry as item 1. The warning is rewritten to say what will happen and when. An adapter withoutlistDocumentskeeps today's sentence. - What the reconcile repairs, stated in the docs and each pinned once: a document whose row was deleted or left
whereby a predicate write; a document built from an insert that rolled back (service-knowledge: event sync re-reads inside the uncommitted write, so a rollback leaves the index stale until the next event or a reindex #37110, outcome 1); a row whose event was lost or whose sync failed; a row changed while the embedder was down. Each is one case in the service's tests overknowledge-memory, and the PostgreSQL job runs the purge case onknowledge-pgvector. - Texts (K2).
content/docs/protocol/knowledge.mdx§6 ("that surface stays unbuilt…", "nothing runs that reindex on a schedule yet"),content/docs/ai/knowledge-rag.mdx, the README ofservice-knowledge, the deferral comment above the bulk-event branch, and the note onrepairStale("Moves to the scheduled reconcile's queue when that lands": it moves in the queue card, and the note says so).
Rulings carried (ADR-0161 K10): a key lands with its first reader in the same PR (the plugin option and the reconcile trigger); no adapter-contract member; the index copy is for ranking and snippets only (the walk reads under the system context and writes only what assembly builds).
Acceptance
- With event sync disabled for the test, rows are inserted, changed, deleted by a
multi: truedelete and moved out ofwhere; one reconcile leaves the index listing exactly the documents of the rows that match, and its result countsindexed,skippedandpurgedaccordingly. A second reconcile right after it indexes 0 and calls the embedder 0 times. - The epic's finish line "a reindex after an outage converges": the embedder fails during N record writes, is restored, and the next reconcile indexes those N rows with no operator action.
- A
multi: trueupdate on an indexed object starts one reconcile of each of its sources within the stated quiet period; ten such writes in a row start one. - A source on an adapter without
listDocumentsis not walked and is named once atwarn; a source withrefresh.onRecordChange: falseis not walked. - A source whose fingerprint moved since boot is built as a new generation by the reconcile, and its searches answer again without a restart.
- Two nodes: one reconcile of a source runs, the other node records
not-run; a reconcile that loses its lease stops as service-knowledge: a build that loses its lease stops at the next page, and a build has a time bound #37465 pins. - The job's run history shows
degradedwith the source named when a walk failed, andsuccessotherwise;reconcile: falseschedules nothing; no job service is said once at boot. - Container run per AGENTS.md.
Out of scope
- Moving record-change sync onto the queue, and the rollback defect on the event path (service-knowledge: event sync re-reads inside the uncommitted write, so a rollback leaves the index stale until the next event or a reindex #37110): the queue card.
- A durable, cluster-wide record of the last reconcile and the per-source failure counts: the sync-state card. This card keeps the build record as it is (in memory on the node that ran it).
- The fence before
beginBuildand on each purge deletion (service-knowledge: check the build fence before beginBuild and on each purge deletion #37644) and the purge's id-text confirmation (service-knowledge: the purge re-read confirms by id text only, so a caller-supplied numeric id restored mid-walk on driver-mongodb / driver-memory loses its document until its next event #37221): their own cards; this card calls the walk as it stands. - A settings-page key for the schedule: returns with a reader that needs it (a hosted administrator), not here.
Blocked-by: #37304 (PR #37676 rewrites the registry and both files this card edits; the reconcile enumerates sources through it and keys each by its index key).
Coordinates with #37644 and #37221 (same walk and purge), #37104 (same settings contribution file, no key added here).
Parent: #37000. Reader: domain:server lane (packages/services/service-knowledge; the PostgreSQL case in packages/plugins/knowledge-pgvector).
Dedupe: knowledge reconcile 174 (open: #37000 and seat posts only; closed: #37096 — the purge this reuses, #37099 — the boot and operator triggers) · "knowledge" "daily reconcile" 2 (open: #37000, a seat post) · knowledge "predicate write" 42 (open: #37304, #37636 — neither schedules a reconcile) · knowledge rollback index 33 (open: #37110 — the event-path half, fixed by the queue card).
Activity
objectstack-fleet commentedon Nov 27, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in area:ai · domain:server · Feature · priority:p2 ·
pm:blocked· size M; rationale: a scheduled reconcile keeps every knowledge index equal to its source, daily and soon after a predicate write. Topic #37000; p2. It keeps its named blocker.objectstack-fleet commentedon Nov 27, 2026
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Claim: PM loop round 4 · area o1-C (epic #37000 phase 4, hand-off 7206523866; #37304 closed by PR #37676) · 2026-11-27T11:17Z
Session:
session_016WV4cwPhGV4g9p1BGQaZbPAccount:
os-elon-muskBranch:
claude/area-o1C-37734Worktree:
objectstack-issue-37734Domain:
domain:serverArea: o1-C
Seat:
repo:objectstack#1File surface:
packages/services/service-knowledge/src/knowledge-service.ts(one reconcile entry over the existing complete build),packages/services/service-knowledge/src/knowledge-build.ts(thereconciletrigger),packages/services/service-knowledge/src/knowledge-service-plugin.ts(the job schedule, thereconcileplugin option, the bulk-event branch), their tests, the PostgreSQL purge case inpackages/plugins/knowledge-pgvector/src/__tests__/,content/docs/protocol/knowledge.mdx§6,content/docs/ai/knowledge-rag.mdx,packages/services/service-knowledge/README.md, a changeset. ⛔ No adapter-contract member, no settings key, no second walk or purge (card item 1); the queue half (#37735) and the durable sync record (#37736) stay out.Container & model: M,
mode:subagent, model: default tier (dispatch-gates --tier: "no path-derived mandate"), effort: high (reason: M; a scheduled job and a debounced reconcile over the leased, fenced build, two-node and outage cases pinned)Clause-②: no
Metadata-protocol: none
Responsibility: objectstack's own code,
packages/services/service-knowledge/src/knowledge-build.ts| onlyboot,reloadandoperatorstart a complete build (:126), so a lost event, an embedder outage or a predicate write leaves the index stale until an administrator rebuilds | every deployment holding a knowledge source whose store lists its documentsThread-read: 7207196423
Premise: holds, read not yet measured — on origin/main c3da753
KnowledgeBuildTrigger = 'boot' | 'reload' | 'operator'(knowledge-build.ts:126; the card names two, #37676 addedreload); the bulk-event branch warns "cannot be repaired from the event stream" (knowledge-service-plugin.ts:681); knowledge.mdx:1059 says "nothing runs that reindex on a schedule yet".Serial constraints cleared:
overlap-check --branch=probeagainst origin/main c3da753: VERDICT clean exit 0, 0 PR heads share the files. #37306 (claimed in this area, no PR yet) also edits knowledge-service.ts in another region (registerAdapterand the adapter resolution) and content/docs; the dev re-runs overlap-check before every push, merges main if #37306 lands first, and on exit 1 against it reports to the area. #37735 and #37736 are Blocked-by this card.Pre-claim lane:
packages/services/service-knowledge/**⇒domain:server, built in o1-C, L1-read by L1-a.Pre-claim deps: Blocked-by #37304 (closed, PR #37676 merged);
pm:blocked→pm:dispatchedin this stroke.Prior rulings read: card thread 0 rulings (triage 7207196423 only); governing text ADR-0161 K1, K2, K3 item 3, K10; epic #37000 "Rulings that bound every child" apply.
Fold-or-serial: not folded — #37735 and #37736 are its serial successors (same two files); #37644 is merged; #37221 stays out (triage: not dispatched alone).
objectstack-fleet commentedon Nov 27, 2026
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
os-dev-report
{ "issue": 37734, "status": "done", "branch": "claude/area-o1C-37734", "pr": "https://github.com/objectstack-ai/objectstack/pull/37979", "head": "e239d4b1ba", "session": "session_016WV4cwPhGV4g9p1BGQaZbP", "container_and_model": "M, mode:subagent, model: default tier (dispatch-gates --tier: \"no path-derived mandate\"), effort: high (reason: M; a scheduled job and a debounced reconcile over the leased, fenced build, two-node and outage cases pinned)", "premise_still_valid": true, "summary": "KnowledgeService.reconcileSources() walks every source whose adapter has listDocuments (refresh.onRecordChange not false, data engine bound) through the existing complete build with a new trigger 'reconcile' (same lease, fence, skip, purge, completeBuild; rebuildOf's post-lock due-gate now applies to boot/reload only), reading the index state as a third moment so new-fingerprint/recipe-changed sources build as at boot; an adapter without listDocuments is left and named once at warn. KnowledgeServicePlugin schedules job 'knowledge:reconcile' on IJobService at kernel:bootstrapped, daily 03:00 UTC by default, with the new option reconcile?: false | { cron?, timezone? }; the handler answers degraded naming each failed/lease-lost/timed-out source; no job service is said once at warn; destroy cancels. The bulk-event branch calls requestReconcile(object): one reconcile per source after a 2-minute quiet period, at most 10 minutes after the first; warning rewritten, old sentence kept for unreconcilable sources and reconcile:false. Docs (knowledge.mdx section 6 new 'Reconcile' subsection, knowledge-rag.mdx, README), repairStale and purgeDocuments notes, patch changeset.", "tests": "Pre-merge head c771dc877a, under the verify lock: service-knowledge test 17/17 files, 541/541 tests; typecheck OK (tsc + check:test-typecheck 0 errors). knowledge-memory test 3/3 files, 65/65; typecheck OK. knowledge-pgvector typecheck exit 0; knowledge-pgvector test against a local PostgreSQL 16 + pgvector 0.6.0 with OS_TEST_POSTGRES_URL and OS_EXPECT_LIVE_DIALECT_MATRIX=1: 7/7 live-postgres files, 77/77 tests, none skipped. Final head e239d4b1ba (after merging origin/main, which changed knowledge-pgvector's adapter): narrowed, unlocked re-run (declared in deviations): knowledge-pgvector all 10 files 97/97 on live PG; knowledge-memory reconcile.test.ts 6/6; service-knowledge knowledge-build + event-sync-data-events + knowledge-build-fence 3 files 76/76. Ablations (on-disk mutation of committed source, targeted suites re-run, restored by git checkout HEAD --): rebuildOf gate reverted -> 4 red knowledge-build, 5/6 red memory reconcile, 2/3 red live-PG; listDocuments exclusion dropped -> 1 red; debounce clearTimeout dropped -> 2 red; reconcileJobOutcome always completed -> 2 red; reconcile:false ignored in schedule -> 1 red; max-wait widened -> 1 red; reconcile:false ignored on predicate write -> 1 red; warn-once bypassed -> 1 red; no-source write at warn -> 1 red. Container run: showcase booted --fresh on a random port (OS_LOG_LEVEL=info): 'reconcile scheduled ('0 3 * * *' UTC, job 'knowledge:reconcile')', boot build of showcase-showcase_task_notes finished 8 rows, no knowledge ERROR line; killed by recorded PID.", "gates": "dispatch-gates --commands (tree c771dc877a) derived 103 families; all run locally, exits captured before any pipe; --ran: '103 derived famil(ies) accounted for - 100 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3)'; all 100 exit 0. NOT MEASURED (exit 3 prerequisite): spec check:skill-examples (client-react dist absent), check:dual-build-cjs-loads (62 packages without dist), check:type-check-debt (its build missed the shared lock). eslint --no-inline-config on the 6 touched source/test files exit 0. CI read once at e239d4b1ba: Lint & Repo Gates success, TypeScript Type Check success (incl. Type Check debt ledger success), Build Core success, Governed Surface Queue Guard success, Dogfood Regression Gate success, Test UI success, Live E2E UI success, Check Changeset success, Check Documentation Links success, PR-body guards success, Test Core 9/10 success and (5/10) in_progress; Lint UI, Type Check UI, Build & E2E UI skipped by selector; Temporal Conformance (live PG + MySQL), the job that runs knowledge-pgvector live-postgres files, skipped on this PR, so the PostgreSQL purge case has the local live-PG reading only.", "ci_read_once": "e239d4b1ba: every non-skipped check success except Test Core (5/10) in_progress; Temporal Conformance (live PG + MySQL) skipped on the PR.", "dogfood_battery": "n/a - no ! in the PR title and Clause-② no (no narrowing arm)", "mcp_calls": "0", "api_writes": "2 - fleet-write relay: pr_create (POST /repos/objectstack-ai/objectstack/pulls + POST /issues/37979/assignees, one stroke, run 46012162318); post-stamped report comment on #37734 (POST /repos/objectstack-ai/objectstack/issues/37734/comments). Plus git push of the branch.", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: none - noted, not filed: the root `pnpm dev` prerequisite check refuses unless every workspace package has dist (38 outside the showcase closure missing here), so a container run after a closure build goes through `pnpm --filter @objectstack/example-showcase dev`.", "carrier: none - noted, not filed: Temporal Conformance (live PG + MySQL) is skipped on this PR although the diff adds a knowledge-pgvector live-postgres file, so the new PostgreSQL purge case first runs in CI outside the PR run." ], "deviations": [ "File surface: added packages/plugins/knowledge-memory/src/__tests__/reconcile.test.ts, not in the claim's listing; the card asks for the cases over knowledge-memory and a devDependency from service-knowledge would be a workspace cycle.", "Container run booted via `pnpm --filter @objectstack/example-showcase dev -- --fresh -p PORT` instead of `pnpm dev`, because the root prerequisite check needs a full workspace build; the showcase closure was built (74/74 turbo tasks under the lock).", "Post-merge re-run at e239d4b1ba was narrowed and run without the verify lock after three queue-timeouts behind full dogfood runs (about 30 minutes): knowledge-pgvector all files on live PG, knowledge-memory reconcile.test.ts, and three service-knowledge files; full package suites and typechecks are from c771dc877a.", "The predicate-write warning for an object no source indexes is now debug-only (was warn); reconcile:false keeps the old warning verbatim.", "Commits carry the model-free trailer pair; the merge commit e239d4b1ba carries none." ] }objectstack-fleet commentedon Nov 27, 2026
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Close-out · area o1-C · 2026-11-27T14:49Z
Delivered by PR #37979 (merged 724d6f3):
KnowledgeService.reconcileSources()re-runs the existing leased, fenced complete build under areconciletrigger; a dailyknowledge:reconcilejob onIJobService(03:00 UTC by default, plugin optionreconcile?: false | { cron, timezone }); bulk predicate writes debounced into one reconcile per object (2 min quiet, 10 min cap). L1-a ACCEPT 7220761955. The serial successors #37735 → #37736 are now claimable. Nothing remains on this card;pm:dispatchedremoved with this comment.