Skip to content

fix(service-knowledge): a record write before the boot reads a runtime-composed knowledge service calls no store - #39414

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-hetgca
Dec 4, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-hetgca

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #38479

What changes

@objectstack/service-knowledge: a record sync that arrives before the boot reads a runtime-composed knowledge service as enabled or held (ADR-0161 K8, the dated note on item 12) now waits for that reading and calls no store meanwhile.

  • A new KnowledgeService field, enablementWaiters, holds the waiting syncs. settleEnablement wakes them (knowledge-service-sources.ts).
  • Queue worker paths (processRecordSync, processRecordSyncBatch) await the reading before they resolve a message.
  • Inline paths (handleRecordUpsert, handleRecordDelete) are deferred past the reading and return at once. A write the boot itself awaits, such as a seed, would otherwise wait for a reading that comes after it. A deferred sync that fails is one warn line.
  • Once the reading is taken, held completes each sync with no store call (not-synced on the queue paths), and enabled runs it as before. A host-mounted service (enabledByConfiguration unset) has no window and is unchanged.
  • The logic lives in the facets (knowledge-service-record-sync.ts, knowledge-service-sources.ts). The facade gets one field and one host getter, so check-facade-delegation-only stays green.

Why

On a held deployment (no embedder), a seed written before kernel:bootstrapped reached the store. A fresh blank-template or Starter scaffold printed WARN [knowledge] a batch of 4 record syncs of source 'blank-blank_articles' failed (knowledge-turso has no embedder …). That contradicts #38369's "no store is called" for a held service. This blocks #38374 (draft PR #39340), whose template starter.test.ts no-embedder case is red on this line alone.

Verification

  • New src/__tests__/boot-window-38479.test.ts (4 cases): the held case and the enabled case are red on main and green here. The host-mounted control is green both ways. The fourth case is the card's second pin. On an enabled runtime-composed service, the reap guard is registered at the reading, before a sweep a later plugin runs at kernel:bootstrapped, and that sweep de-indexes before it deletes.
  • @objectstack/service-knowledge: vitest 34 files / 912 tests green on origin/main 301a378 + this diff. pnpm typecheck (incl. check:test-typecheck) green. node scripts/check-facade-delegation-only.mjs green (knowledge-service.ts 1696/1758 lines). eslint on the four touched files is clean.
  • feat(examples): the Starter help articles as a knowledge source, in the blank template too #39340's blank-template starter.test.ts, run from a copy of the template against PR feat(examples): the Starter help articles as a knowledge source, in the blank template too #39340's head ca114a34 plus this diff: 6/6 green. Control: the same run with this diff's source reverted and the package rebuilt fails only the no-embedder case, on the exact WARN line above. @objectstack/example-starter tests 17/17 and the create-objectstack parity test 15/15 are green on the same tree.

Clause-②: no
Metadata-protocol: none

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (eslint on the touched files)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CYvu4t9zSjsTHiUubP

…e-composed knowledge service calls no store

A runtime-composed knowledge service is read as enabled or held once, at
kernel:bootstrapped. A record write before that reading (a seed, a package's
sample data) was synced at once, so a deployment with no embedder called the
store and logged a failed-batch warning. Record syncs that arrive while the
reading is pending now wait for it: the queue worker paths await it, and the
inline paths are deferred past it without holding the write up. Held, each
completes with no store call; enabled, each runs as before.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CYvu4t9zSjsTHiUubP
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-knowledge, touching 27 documentable anchor(s).

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/knowledge-rag.mdx (via KnowledgeService (symbol, a top-level class))
  • content/docs/protocol/knowledge.mdx (via KnowledgeService (symbol, a top-level class), handleRecordDelete (symbol, a top-level function), handleRecordUpsert (symbol, a top-level function))
What this run could not see
  • the SDK route bridge reached 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 5 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d9627c67ad3b0209e089bedc5b10de66a9ccaad8 — the merge of head b172943ca71afb2233ebbe9cd79e14303379ee5d into base f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d9627c67ad3b0209e089bedc5b10de66a9ccaad8 && git checkout d9627c67ad3b0209e089bedc5b10de66a9ccaad8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f b172943ca71afb2233ebbe9cd79e14303379ee5d && git checkout -B drift-repro f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f && git merge --no-ff b172943ca71afb2233ebbe9cd79e14303379ee5d

node scripts/docs-audit/affected-docs.mjs --json f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…nt reading when the service stops

A boot that fails before the reading left the record-sync worker waiting,
so destroy() hung on the queue unsubscribe. stopBuilds() now completes every
waiting sync without one, and a sync that arrives after the stop does not
wait. The contract docblocks now say syncs wait for the reading.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CYvu4t9zSjsTHiUubP
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

card thread #38479 · os-bill · session_01Utp6CYvu4t9zSjsTHiUubP

Contract review

Served-tier: TIER_DEFAULT
Head-sha: b4a5b82dc99dff3b2f3f3eb1cdc5268dcf45d2d7
Local-runs: vitest run src/__tests__/boot-window-38479.test.ts 4/4 green at this head; the same file with the three source files reset to origin/main fails the held and enabled cases and passes the host-mounted control and the reap-guard pin (2 failed, 2 passed); @objectstack/service-knowledge full suite 34 files / 912 tests green; node scripts/check-facade-delegation-only.mjs green (knowledge-service.ts 1696 of 1758); eslint on the four touched .ts files clean
Scope: packages/services/service-knowledge/src/knowledge-service-record-sync.ts, packages/services/service-knowledge/src/knowledge-service-sources.ts, packages/services/service-knowledge/src/knowledge-service.ts, packages/services/service-knowledge/src/tests/boot-window-38479.test.ts, .changeset/38479-knowledge-boot-window.md; read outside the diff: packages/services/service-knowledge/src/knowledge-service-plugin.ts, packages/services/service-knowledge/src/knowledge-record-hooks.ts, packages/services/service-knowledge/src/knowledge-service-top-level.ts, packages/services/service-knowledge/src/knowledge-service-search.ts, packages/services/service-queue/src/db-queue-adapter.ts, packages/core/src/dispatch-loop.ts, packages/core/src/kernel-base.ts, packages/objectql/src/plugin.ts, packages/objectql/src/lifecycle/lifecycle-service.ts
Tier-note: CONTRACT_REVIEW_TIER exhausted (429, resets Dec 9 20:00 UTC); Opus review per maintainer 「fable 用完之后,可以用 opus 复审」 (2026-12-03T15:42Z)

Round 1 on this head. The diff is one commit, b4a5b82d (5 files, +276 −5). Inputs read: card #38479 and its comments (triage 7381373263, measurement 7379734025, claim 7394443531), the PR body, the diff, and the check-runs on this head. The PR declares Clause-②: no and Metadata-protocol: none. It touches no packages/spec/src/** file and no governed rule text. So no L2 face hits, and this record has no ④. It is a TIER_DEFAULT review on request. PR author is objectstack-fleet[bot], so ③ names no author.

① Derived judgments

The fix. A runtime-composed service starts with enablementPending = true (knowledge-service.ts:209). A new list, enablementWaiters (knowledge-service.ts:205), holds a wake function per waiting sync. settleEnablement clears the flag, sets held, then wakes every waiter (knowledge-service-sources.ts:107-111). enablementSettled answers undefined when nothing is pending (knowledge-service-record-sync.ts:401-406).

Every record sync path, checked for a store call before the reading:

  • processRecordSync awaits the reading first (knowledge-service-record-sync.ts:419). Then resolveRecordSync answers not-synced when held (:463).
  • processRecordSyncBatch awaits the reading first (:529). syncRecordGroup, syncRows and considerBacklogReconcile are reached only after it (:551, :587). considerBacklogReconcile also returns when held (:696).
  • handleRecordUpsert and handleRecordDelete defer themselves past the reading and return at once (:881-886, :1073-1077). After the wake they re-enter, find nothing pending, and return when held (:887, :1078).
  • enqueueRecordSync only publishes a message (:343-353). Its consumer is the worker above, so a message published before the reading waits there.
  • requestSourceReconcile is reached from recordSyncFailure (:226), which the worker calls only after a failed sync, so after the reading.
  • The record hooks (knowledge-record-hooks.ts:264-287, :229-238) call only enqueueRecordSync, handleRecordUpsert or handleRecordDelete. Covered.
  • The realtime bridge (knowledge-service-plugin.ts:877-892) calls the same three. Covered. Its predicate branch goes to onPredicateWrite (:1028-1050), which arms a quiet-period reconcile; settleEnablement cancels pending reconciles when held (knowledge-service-sources.ts:112-113).
  • Hooks, the realtime subscription and the queue worker all start at kernel:ready (knowledge-service-plugin.ts:821-845). A write before that has no trigger at all.

Not found: no record sync path reaches a store before the reading on a runtime-composed held service.

Out of the card's scope, for the record only: search checks held and not enablementPending (knowledge-service-search.ts:162), and its stale repair calls syncRecord directly (:753). A search before kernel:bootstrapped would call the store. No transport serves before kernel:listening, and the service hands out no tool definition while pending (knowledge-service.ts:931). Not a finding here.

Ordering on an enabled deployment. settleEnablement wakes the waiters synchronously, and their continuations run as microtasks. The plugin handler then kicks buildSourcesAtBoot in the same synchronous run (knowledge-service-plugin.ts:773-791). So the deferred syncs and the boot build can both embed a seeded row. That also happens on main, where the sync runs first and the build after. Not a regression.

Duplicate syncs. The database queue renews each claimed row's lease while the handler is inside it (db-queue-adapter.ts:171-187), so a worker that waits for the reading does not lose its messages to a reclaim. The enabled test's two upserts of kb:r1 are one inline call and one queued message, as designed.

Public surface of @objectstack/service-knowledge: unchanged. The new field and getter are private. No new export, code or locale key.

② Semver level

.changeset/38479-knowledge-boot-window.md is @objectstack/service-knowledge patch. Clause-②: no and Metadata-protocol: none stand line-initial (:7-8) and in the PR body. That is right. The change narrows nothing a caller authors or sends. It only delays a sync inside the service. On the inline path it relaxes a wait: a save in the window no longer waits for its sync. No published schema moves. Patch fits.

The changeset text matches the code: every path (inline, per-message, batch) waits; held completes with no store; enabled runs as before; host-mounted is unchanged.

③ Boundary flags

  • Surface: the diff touches the three claimed source files, plus the new test and the changeset, which claim 7394443531 names as unlisted. Within the claim.
  • Facade rule: the facade gains one private field and one host getter (knowledge-service.ts:205, :1609). The logic is in the facets. check-facade-delegation-only is green locally.
  • SQL push-down: no new read, join or id materialisation.
  • Check-runs on this head when read: the fast gates are success (Check Changeset, PR-body guards, Governed Surface Queue Guard, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Check PR Size, Dogfood Regression Gate, Test UI). Test Core (12 shards), Type Check (4 jobs), Build Core, the other Lint jobs and Live E2E UI were in_progress. The landing check reads them again.
  • The PR body raises no question and asks for no decision.

Tests against the card

  • Expected 1 (measure: no store call before the reading on a held deployment; refused or deferred). Pinned by the held case (boot-window-38479.test.ts:75-94). It drives all four entry points before settleEnablement, asserts no adapter call, then settles as held and asserts not-synced on both queue paths, still no call and no warn. Each wait has teeth: removing any one of the four lets that path call the store, and calls is no longer empty. Confirmed for all four together by the reset-to-main run.
  • The enabled case (:96-111) pins that the waits do not drop work. The control (:113-118) pins the host-mounted path.
  • Expected 2 (the reap guard registers before the first reap on an enabled deployment). Pinned by :138-186 through a real LiteKernel and the real plugin. Green on main too, which is right: it pins existing order. See N3 for what it models.

Findings

  • S1 (should-fix) — a waiter that is never woken can hang shutdown. Nothing but settleEnablement wakes enablementWaiters (knowledge-service-sources.ts:111). The queue worker subscribes at kernel:ready (knowledge-service-plugin.ts:826). The reading comes later, at :773, after reconcileSources (:755), closeInterruptedBuilds and recordSources (:762-763) and provideEmbedder (:766). Boot-path hooks propagate a throw (kernel-base.ts:294-327), so a throw in any of those, or in an earlier plugin's kernel:bootstrapped or later kernel:ready handler, fails the boot before the reading. The rollback then calls destroy() (knowledge-service-plugin.ts:1436). It awaits syncQueue.unsubscribe (:1463). On the database queue that awaits loop.stop() (db-queue-adapter.ts:509-518), which awaits the in-flight tick (dispatch-loop.ts:177-184), which awaits the batch handler (knowledge-service-plugin.ts:979), which waits for a reading that never comes. Before this head that handler synced or failed and returned. Now a failed boot with a claimed message stalls until the kernel's shutdown timeout, or for good where there is none. Fix: release the waiters in destroy() (or stopBuilds()), so the queue paths throw a retryable error or answer not-synced, and the deferred inline syncs drop. Add a pin: a batch taken before the reading, then destroy(), resolves.
  • N1 (nit) — the contract docblocks do not say the syncs wait. The facets say the member's docblock is the contract. handleRecordUpsert's still says the save waits for the embedding call and "Inline, the chain is awaited" (knowledge-service.ts:1346, :1369). That is no longer true in the window. enabledByConfiguration (knowledge-service-top-level.ts:106-114) and settleEnablement (knowledge-service.ts:215-230) name only the tool definitions. One sentence in each.
  • N2 (nit) — the deferred inline sync leaves the hooks' tracking. KnowledgeRecordHooks tracks a sync in inFlight and checks stopped before it starts (knowledge-record-hooks.ts:296-315). In the window, handleRecordUpsert returns at once, so the tracked task ends before the real sync runs, and a sync woken after hooks.stop() still runs. Only settled() reads inFlight, and only tests call it (record-hooks-sync.test.ts:273). destroy() does not wait on it. Harmless today; worth one line in the hooks' docblock.
  • N3 (nit) — the reap-guard pin models the first reap as a later plugin's kernel:bootstrapped handler (boot-window-38479.test.ts:121-134). The real first reap is the lifecycle timer armed in ObjectQL start() (objectql/src/plugin.ts:1850) after initialDelayMs: 60 s by default (lifecycle-service.ts:86, :672-685), host-settable (objectql/src/plugin.ts:455). A host that lowers it below its boot time can reap before the guard registers. This predates this head (feat(service-knowledge)!: a knowledge service the runtime mounts holds its sources without an embedder or its deployment store #38470). It is a follow-up card or a docs line, not a fix here.

No must-fix. S1 is open.

Implemented-by: claude/project-thread-hetgca
Reviewed-by: session_01Utp6CYvu4t9zSjsTHiUubP (isolated L2 subagent)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

card thread #38479 · os-bill · session_01Utp6CYvu4t9zSjsTHiUubP

Contract review

Served-tier: TIER_DEFAULT
Head-sha: b172943ca71afb2233ebbe9cd79e14303379ee5d
Local-runs: @objectstack/service-knowledge full suite 34 files / 913 tests green at this head; boot-window-38479.test.ts 5/5 green; with the wake(false) line removed from stopBuilds, the new "stopped before the reading" case fails (times out) and the other four pass; node scripts/check-facade-delegation-only.mjs green (knowledge-service.ts 1711 of 1758); eslint on the six touched .ts files clean
Scope: packages/services/service-knowledge/src/knowledge-service-indexing.ts, packages/services/service-knowledge/src/knowledge-service-record-sync.ts, packages/services/service-knowledge/src/knowledge-service-sources.ts, packages/services/service-knowledge/src/knowledge-service-top-level.ts, packages/services/service-knowledge/src/knowledge-service.ts, packages/services/service-knowledge/src/tests/boot-window-38479.test.ts, .changeset/38479-knowledge-boot-window.md; read outside the diff: packages/services/service-knowledge/src/knowledge-service-plugin.ts, packages/services/service-queue/src/db-queue-adapter.ts, packages/core/src/dispatch-loop.ts
Tier-note: CONTRACT_REVIEW_TIER exhausted (429, resets Dec 9 20:00 UTC); Opus review per maintainer 「fable 用完之后,可以用 opus 复审」 (2026-12-03T15:42Z)

Delta review. Round 1 is the record on b4a5b82dc99dff3b2f3f3eb1cdc5268dcf45d2d7 (/mnt/project-files/card-38479/l2-review.md: PASS, S1 open, N1–N3 nits). The delta is one commit, b172943c (7 files, +65 −20). It answers S1 and N1. N2 and N3 are left as they were, which round 1 allowed: both are nits, and N3 predates this PR (#38470). Round 1's judgments on everything the delta does not move still stand. No L2 face is touched, so the record has no ④.

① Derived judgments

  • A waiter now takes a flag: (proceed: boolean) => void (knowledge-service.ts:207). The reading wakes it with true (knowledge-service-sources.ts:111). stopBuilds wakes it with false (knowledge-service-indexing.ts:1287).
  • enablementSettled answers false at once when builds are already stopped (knowledge-service-record-sync.ts:409). So a message taken after the stop does not wait either.
  • On false: the per-message path answers not-synced (:425). The batch path answers not-synced for every item (:536). The inline paths skip the sync (:891, :1082). None calls a store.
  • The plugin's destroy() calls stopBuilds() first (knowledge-service-plugin.ts:1440). It unsubscribes the queue later (:1463). So the batch handler that S1 found blocking loop.stop() (db-queue-adapter.ts:509-518, dispatch-loop.ts:177-184) now returns before the unsubscribe waits on it. S1's hang is gone, by reading.
  • stopBuilds has one caller in source, destroy() (knowledge-service-plugin.ts:1440). Nothing stops the waits on a live service.
  • On a normal shutdown the reading has already run, so the list is empty and enablementPending is false. The new branch does nothing then. Behaviour after the reading is unchanged.
  • Public surface: unchanged. The new member text is in docblocks. The field stays private.

② Semver level

.changeset/38479-knowledge-boot-window.md is still @objectstack/service-knowledge patch. Clause-②: no and Metadata-protocol: none still stand line-initial (:7-8). The delta adds one sentence on the stop case (:12). It matches the code. Patch is still right.

③ Boundary flags

  • Surface: the delta adds knowledge-service-indexing.ts and knowledge-service-top-level.ts. Neither is in claim 7394443531's file list. Both are in the same package, and the fix is the one round 1 asked for. This is not a breach by the dev. The seat owes a one-line claim amendment naming the two files.
  • Facade rule: the facade change is only docblock text (knowledge-service.ts:204-205, :234-238, :832-834, :1383-1386). The gate is green, with 47 lines left under the ceiling.
  • SQL push-down: unchanged.
  • Check-runs on this head when read: 3 success, 16 in_progress, 7 skipped. The landing check reads them again.

Round 1 findings

  • S1: closed. Waiters are released on stop, before the queue unsubscribes. The new case (boot-window-38479.test.ts:113-129) has teeth: without wake(false) it times out. It drives stopBuilds() directly, not destroy(). The order inside destroy() (:1440 before :1463) is confirmed by reading only.
  • N1: closed. The contract docblocks now state the wait: settleEnablement (knowledge-service.ts:234-238), handleRecordUpsert, which also covers handleRecordDelete (:1383-1386), stopBuilds (:832-834), and enabledByConfiguration (knowledge-service-top-level.ts:110-111).
  • N2, N3: open as accepted nits. N3 should go on a follow-up card, as round 1 said.

New

  • N4 (nit). A stopped wait answers not-synced with ok: true (knowledge-service-record-sync.ts:425, :536). The queue then completes the claimed messages, so they are deleted. destroy() says that "messages already published stay in the queue, for the next start" (knowledge-service-plugin.ts:1461). A boot that fails between kernel:ready and the reading therefore drops the messages it had claimed (at most one batch). It also drops any message claimed before the unsubscribe ends. On a deployment that would have read as enabled, those records stay stale until the next save or the reconcile. A held deployment loses nothing, because it would not sync them anyway. The reach is a failed boot only, and the reconcile repairs it. Releasing the claim without counting an attempt would keep the messages, but the queue contract has no such answer today. Name this trade-off in the stopBuilds docblock, or file it with N3.

No must-fix. No should-fix open.

Implemented-by: claude/project-thread-hetgca
Reviewed-by: session_01Utp6CYvu4t9zSjsTHiUubP (isolated L2 subagent)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

席位核对

ACCEPT and landing · 2026-12-03T23:01Z · head b172943ca71afb2233ebbe9cd79e14303379ee5d · repo:objectstack@os-bill

  1. Shape: 7 files, +325/−9. Fixes #38479; Clause-②: no, Metadata-protocol: none. Five files are in claim 7394443531; the two the S1 fix added (knowledge-service-indexing.ts, knowledge-service-top-level.ts) are covered by the claim amendment 7394952770.
  2. Premise measured: by the card thread on fresh main. The feat(examples): the Starter help articles as a knowledge source, in the blank template too #39340 blank-template starter's no-embedder case logs the exact WARN without the fix and is 6/6 green with it. service-knowledge is 913/913 green, and typecheck, the facade gate and eslint are clean. The seat read the diff: a record sync waits on the boot's enablement reading at every entry; the inline paths defer and do not hold the write; settleEnablement wakes the waiters with true, and stopBuilds with false.
  3. Gates:
    • Contract review: round 1 PASS 7394925444 at b4a5b82d (S1, a destroy() hang after a failed boot); delta PASS 7394926558 at this head, S1 fixed, no should-fix open. Both on Opus (Served-tier: TIER_DEFAULT), under the maintainer's 2026-12-03 15:42Z word 「fable 用完之后,可以用 opus 复审」.
    • Check-runs at this head: still running at this ACCEPT, none failed. Auto-merge waits for every required check, and the queue enters only on green.
  4. Accepted deviations: nit N2 (a deferred inline sync is not in KnowledgeRecordHooks' in-flight tracking; its only reader is a test), left as is.
  5. Out of scope: N3 (the reap-guard pin's first reap) and N4 (a stop before the reading completes claimed messages as not-synced): filed knowledge boot window: the reap-guard pin uses a later hook as the first reap, and a stop before the enablement reading completes claimed queue messages as not-synced #39421, a sub-issue of this card.
  6. Landing: not governed (check-governed-merges --pr), not a narrowing, 334 lines. The seat marks it ready and arms auto-merge. On merge, service-knowledge: pin a record write between boot and the enablement reading on a held deployment (after #38369 PR #38470) #38479 closes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 3, 2026 23:02
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge December 3, 2026 23:02
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 959b20f Dec 4, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-hetgca branch December 4, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

service-knowledge: pin a record write between boot and the enablement reading on a held deployment (after #38369 PR #38470)

2 participants