You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
service-knowledge: a build that loses its lease stops at the next page, and a build has a time bound #37465
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpm:dispatchedDispatched to a dev agent by /pm-dispatchpriority:p2Medium: important, M3
Filing gate: ② follow-up out of #37099 (PR #37439, contract record 7184443506 finding S1, seat L1 7184456563), filed by the owning zone ai-37000 under topic #37000, per the maintainer's standing permission for areas to file their own follow-up cards.
Grading: area:ai · Bug · p2 (suggested; triage seat offline) · reach: deployments with more than one server node, and any build whose embedding call hangs · evidence: read from the PR #37439 code by the contract reviewer, not run.
When the build lease lapses mid-build (lock store unreachable past the renewal window, or a renewal that hangs), the walk only logs a warning and keeps going. It does not check isHeld() between pages and does not pass the fencing token down, so a second node's boot pass can build the same source. The index is not corrupted (same ids and hashes; generation stores take their own builder lock in beginBuild), but the embedding spend doubles.
A build whose embedding call never returns keeps renewing its lease forever. Only a restart cancels it, and the same node refuses a second rebuild meanwhile.
Acceptance
The walk checks the lease before each page and stops, recording a lease-lost result, once it is no longer held. A test drives a lapsed lease mid-walk and asserts no further page is embedded.
A build has a bound (a setting or a fixed ceiling, with its reader in the same PR per ADR-0049); past it the build is cancelled, the lease released, and the result recorded. A test drives a never-resolving embed call.
Docs in content/docs/ai/knowledge-rag.mdx state both behaviours.
Triage: lands in area:ai · domain:server · Bug · priority:p2 · pm:queue · size S; rationale: on multi-node deployments a build that loses its lease keeps going, so two nodes can embed the same source and double the cost, and a hung embedding call holds the lease until restart. Read from the code, not run: p2 as suggested.
Also carried from #37101 (PR #37492, os-dev report 7188339132): the pgvector store's builder lock is a PostgreSQL session advisory lock, released after buildLockIdleMs (15 min) idle or when its session drops. A build that loses it is not fenced mid-walk either. A second builder writes the same generation under the same fingerprint, so the index stays correct and only the embedding spend doubles. The stop-at-next-page check in this card's acceptance covers both the cluster lease and this advisory lock.
Scope note · 2026-11-26T09:56Z · zone ai-37000 (seat L1 7188645663 on PR #37492, finding N1)
Adapter-side acceptance line for this card: completeBuild completes only the generation that this builder opened. A builder that lost its lock, while another builder has since taken the source up, cannot switch or delete that builder's generation. The refusal is coded, and a test drives two builders where the first one's lock lapses.
These pgvector generation edge cases are carried here because they sit on the same build path:
N3: a search that meets three generation switches in a row throws an Error with no code. The fix is to give it CONCURRENT_MODIFICATION (409) and remove that code's row from scripts/error-status-unpinned-baseline.json in the same PR.
N2: after the fingerprint is reverted to the active one, the building generation is left in place, holding rows that are never read. It is retired at the next build under another fingerprint. Retire it at beginBuild instead.
N4: two sweeps of the same retired generation can leave passage rows behind. They are never read, and orphan cleanup removes them when the source next opens a generation. Optional.
First touch · 2026-11-26T12:36Z · zone ai-37000, on the maintainer's word (the triage seat is offline)
Grade confirmed as filed: Bug · area:ai · domain:server · p2. Routed to zone ai-37000 (topic #37000) and put in pm:queue.
Whose order: the maintainer (Bill). Verbatim: 「按建议定级,可以开」. Where: the seat-5 project thread for zone ai-37000, 2026-11-26T12:36Z, answering the zone's proposal of grades and order for #37465, #37466, #37467 and #37545.
Claim: PM loop round 1 · zone ai-37000 (topic #37000) · 2026-11-26T12:38Z
Session: session_01Utp6Cb4BAjgQ43tqy1DvVJ
Account: os-bill
Area: ai-37000
Branch: claude/issue-37465-build-lease-fence
Worktree: objectstack-issue-37465
Domain: domain:server
Seat: repo:objectstack#5
File surface: packages/services/service-knowledge/src/knowledge-build.ts, knowledge-build-actions.ts and new test files in packages/services/service-knowledge/src/__tests__/; packages/plugins/knowledge-pgvector/src/ (fence on a lost advisory lock, completeBuild only for the generation this builder opened, N2/N3/N4) and new test files; packages/plugins/knowledge-turso/src/ only if its completeBuild needs the same own-generation check; scripts/error-status-unpinned-baseline.json (the CONCURRENT_MODIFICATION row, N3); content/docs/ai/knowledge-rag.mdx; .changeset/ (stop on breach; explain in the report)
Container & model: M, mode:subagent, model: default (dispatch-gates --tier: no path-derived mandate; floor sonnet · default opus · ceiling fable), effort: high
Clause-②: no
Metadata-protocol: none
Responsibility: n/a — not a defect card
Thread-read: 7192233569
Premise: holds (filed from contract record 7184443506 S1 on PR #37439, merged; scope notes on this card from PR #37492, merged)
Pre-claim lane: domain:server — packages/services/service-knowledge and packages/plugins/knowledge-*
Pre-claim deps: none (#37099 and #37101 merged)
Prior rulings read: ADR-0161 (no new adapter-contract member unless admitted); ADR-0049 (a bound's key lands with its reader)
Serial constraints cleared: PR #37442 (#37102) and #37304 (card thread) both edit knowledge-service-plugin.ts, knowledge-service.ts and service-settings' knowledge manifest: this card stays out of those files (no new settings key; the build bound is a plugin option or a fixed ceiling); overlap-check before each push.
{
"issue": 37465,
"status": "blocked",
"branch": "claude/issue-37465-build-lease-fence",
"pr": null,
"session": "session_01Utp6Cb4BAjgQ43tqy1DvVJ",
"premise_still_valid": true,
"summary": "Stopped before any edit, per the dispatch order's stop rule: the cluster-lease fence (Acceptance 1, cluster half) and the build bound (Acceptance 2) cannot be built without editing knowledge-service.ts, which the order puts out of bounds. Measured on origin/main 1af67b26c: the page loop is KnowledgeService.walkObjectSource (knowledge-service.ts line 499, loop at 608, upsert at 671) and the lease, the walk's await and the release all sit in KnowledgeService.rebuildSource (line 920; keepBuildLeaseAlive at 970 only logs 'The build continues'; await this.reindexWith at 992; release in its finally). The only knowledge-build.ts symbols on the build path are keepBuildLeaseAlive (synchronous, returns a stop function), BUILD_LEASE_MS, buildLockKey and emptyBuildProgress; none is inside the walk's await chain, so neither a per-page lease check nor a race of the walk against a bound can live in knowledge-build.ts or knowledge-build-actions.ts, and a pgvector-side check fences only pgvector's own advisory lock, never the cluster lease. The claim's file surface names knowledge-build.ts for work that lives in knowledge-service.ts. The card's premise holds (line 970-977: a failed renewal only logs). The branch was pushed empty (head = origin/main 1af67b26c) as the landing marker; no commit, no PR, worktree removed. Doable now without the blocked files: the whole pgvector half (fence on a lost advisory lock inside the store's build writes, completeBuild only for the generation this builder opened with a coded refusal and a two-builder test, N2, N3 with the baseline row, N4 optional) and the knowledge-turso measurement; the cluster-lease fence, the bound and the docs for both wait on the decision below.",
"tests": "none run: no diff. pnpm install --frozen-lockfile in the worktree finished (Done in 8.9s) before the stop.",
"gates": "none run: no diff; dispatch-gates --commands not derived (empty change set). No PR, so no check-runs.",
"dogfood_battery": "n/a: no PR, no diff",
"mcp_calls": "0",
"api_writes": "1: POST issues/37465/comments (this os-dev-report, via post-stamped.mjs). git push of the empty branch is not a REST write.",
"open_questions": [
{
"question": "How does the cluster-lease fence and build bound reach knowledge-service.ts, which this order excludes?",
"options": [
"A. Lift the exclusion for walkObjectSource and rebuildSource only (knowledge-service.ts lines 456-1035 at 1af67b26c) and re-dispatch the whole card. Measured: PR #37442's knowledge-service.ts hunks sit at about lines 190-217 (getAdapter, reportUnmountedAdapters), 1545-1569 (the search loop) and 2174-2210 (helpers), so no textual overlap; #37304 has no PR yet, its overlap is not measurable. Cost: one rebase lap if #37442 lands first; the change is about 40-80 lines (a still-held check before each page's read, a bound timer racing the walk, two new record outcomes).",
"B. Split: dispatch the pgvector half now as Part of #37465 (fence on a lost advisory lock, own-generation completeBuild, N2, N3, N4, turso measurement); file the cluster-lease fence, the bound and their docs as a card Blocked-by #37442 and #37304.",
"C. Hold the whole card until #37442 and #37304 land."
],
"recommendation": "A, because the measured hunks do not overlap the walk or rebuildSource, the card stays one PR with one docs pass, and the bound's cancellation and the lease fence share one mechanism in rebuildSource; B if the zone wants the serial constraint kept literally."
},
{
"question": "Does the lease-lost outcome widen the public record shape?",
"options": [
"A. Add 'lease-lost' and a bound outcome to KnowledgeBuildRecord.status (exported from service-knowledge; index_status answers it over the settings action door): a widening of an exported type, Clause line amended to yes (widening).",
"B. Keep status 'failed' and carry the cause in a new optional field (for example reason: 'lease-lost' | 'time-bound'): still an exported-shape addition, widening as well."
],
"recommendation": "A, because the card says 'recording a lease-lost result' and index_status consumers read status; either way the zone amends the Clause line."
}
],
"security_findings": "none",
"out_of_scope_findings": [
"carrier: zone ai-37000 · the claim 7192283508 file surface names knowledge-build.ts and knowledge-build-actions.ts for the walk fence, but the walk and the lease use live in knowledge-service.ts (lines 499-763 and 920-1035 at 1af67b26c); noted, not filed",
"carrier: zone ai-37000 · PR #37442 also edits content/docs/ai/knowledge-rag.mdx (+27 -2, the new 'Turning it on' section and the libSQL store paragraph); this card's docs item touches the same file, a different section; noted, not filed"
]
}
Q2: option A. KnowledgeBuildRecord.status gains lease-lost and a bound outcome.
Clause-②: yes (widening): an exported record type gains values, and new exported options if any. The bump stays patch.
{
"issue": 37465,
"status": "done",
"branch": "claude/issue-37465-build-lease-fence",
"pr": "https://github.com/objectstack-ai/objectstack/pull/37570",
"session": "session_01Utp6Cb4BAjgQ43tqy1DvVJ",
"premise_still_valid": true,
"summary": "Built the whole card under claim amend 7192393989; final head 50bac3562 (draft PR #37570). service-knowledge: rebuildSource runs its walk under a build fence (startBuildFence in knowledge-build.ts). walkObjectSource checks the fence before each page and before the purge and completion. A lease the lock reports lost, or one not renewed within BUILD_LEASE_MS (an unreachable lock store or a hung renewal), stops the build with status lease-lost and releases the lease. The bound is a fixed ceiling, not a settings key or option: BUILD_STALL_LIMIT_MS, 15 minutes without a page finishing. Past it the build is cancelled, the lease released, and the status is timed-out. The page-loop calls and the whole walk are raced against the bound, so the walk chain is freed. knowledge-pgvector: each build write or removal checks pg_locks on the lock's own session and is refused LOCK_CONFLICT 409 once the advisory lock is gone. completeBuild completes only the build this adapter began and only the generation that build began (coded LOCK_CONFLICT refusal otherwise). A kept lock is re-checked at beginBuild. N3: an exhausted search is CONCURRENT_MODIFICATION 409. N2 already held at beginBuild (measured live; pinned by a test, documented). N4 was not implemented, because two concurrent sweeps now need two lock holders, which the fence refuses. knowledge-turso was measured and not changed: it has no builder lock, so there is no builder identity beyond the fingerprint, which completeBuild already requires. Docs and changeset done. Edits to knowledge-service.ts stay in walkObjectSource and rebuildSource, plus the import block and a one-parameter fence pass-through in reindexWith. Widening: KnowledgeBuildRecord.status gains lease-lost and timed-out; nothing else newly exported from the package entry (the claim already reads Clause-②: yes (widening)).",
"tests": "At 9c8ea6d38/01488b87c, before the merge of main: service-knowledge full suite under the lock, 'Test Files 15 passed (15) / Tests 456 passed (456)', VERDICT command-exit 0. Typecheck exit 0 for both packages. knowledge-pgvector against a local PostgreSQL 16.16 with pgvector 0.8.7, OS_EXPECT_LIVE_DIALECT_MATRIX=1: 'Test Files 8 passed (8) / Tests 83 passed (83)' (baseline before this PR: 6 files, 76 tests; new: build-fence.live-postgres.test.ts with 6 cases, search-switches.test.ts with 1). At final head 50bac3562: pgvector live again 83/83, and fence plus build tests 30/30. Ablations (each a mutation on disk, then git restore; status porcelain 0 after): the per-page lease check disabled turned 2 fence cases red; pgvector fenceBuild disabled turned 2 live cases red; the rebuildSource race disabled turned the hung-completeBuild case red (the case was added after the first ablation of the race stayed green: the walk's own race had covered the page loop).",
"gates": "overlap-check at 01488b87c: 'VERDICT clean exit 0' against origin/main 4116465625 and #37442. dispatch-gates --commands at 50bac3562 (--repo objectstack-ai/objectstack): 109 derived; --ran reconciliation 'Run reconciliation — 109 derived, 107 run, 2 NOT-MEASURED, 0 UNRUN' exit 0. The two NOT-MEASURED both exited 3, PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test (shallow clone) and spec check:skill-examples (client-react not built). spec check:docs exited 1 at first: the gitignored schema tree was stale after the merge of main. After 'pnpm --filter @objectstack/spec build' (VERDICT command-exit 0) it re-ran to exit 0, '252 generated files in sync'. Earlier round: check:objectql-double-limit flagged the new live test's engine double as unjudged; it was fixed (the double now filters and bounds) and re-ran to exit 0. check:error-status-conformance exit 0 after removing the CONCURRENT_MODIFICATION and LOCK_CONFLICT rows. PR #37570 check-runs at 50bac3562: 55 completed, 40 success, 15 skipped, 0 failure. Required contexts: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards), Build Core success, Governed Surface Queue Guard success, Test UI success, Live E2E UI success, Dogfood Regression Gate success, Check Changeset success. Lint UI, Type Check UI and Build & E2E UI were skipped by their path selector. Temporal Conformance (live PG + MySQL) was skipped on the PR (it runs in the merge queue); its locally measured stand-in is the live pgvector count above.",
"dogfood_battery": "n/a: no ! in the PR title and the Clause arm is widening, not narrowing",
"mcp_calls": "0",
"api_writes": "4 relay writes this session as objectstack-fleet[bot], through post-stamped and fleet-write: POST issues/37465/comments (the first, blocked os-dev-report 7192364339); POST pulls (#37570, draft forced); POST issues/37570/assignees (os-bill, from the claim's Account); POST issues/37465/comments (this report). No labels were written.",
"open_questions": [],
"security_findings": "none",
"out_of_scope_findings": [
"carrier: none · noted in PR Acceptance notes, not filed · knowledge-turso search still throws an uncoded Error after three generation switches (turso-adapter.ts, 'changed 3 times during one search'), the sibling of N3; outside the claim's turso clause (completeBuild only) · dedupe words: turso search CONCURRENT_MODIFICATION switches",
"carrier: none · noted in PR Acceptance notes · N2 remainder: after a fingerprint revert, readIndexState reads current, so no build runs and the stale building generation stays until the next build of any kind; retiring it without a build needs indexStatus or a read-time sweep",
"carrier: zone ai-37000 · noted · deviations: (1) knowledge-service.ts edits beyond the two named functions are the import block and a one-parameter fence pass-through in reindexWith (needed to thread the fence into walkObjectSource), none in #37442's regions, overlap-check clean; (2) scripts/error-status-unpinned-baseline.json also lost its LOCK_CONFLICT row, which check:error-status-conformance demanded once the new pgvector refusals declared its status; (3) merged origin/main once before opening the PR (merge commit 50bac3562); (4) the local PostgreSQL ran under /var/tmp/os-issue-37465-pg, because the postgres user cannot traverse the scratchpad path; stopped and removed; (5) the commits carry the model-free trailer pair (AGENTS.md), not the harness reminder's model-named Co-Authored-By, and the PR footer is the session-URL form"
]
}
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpm:dispatchedDispatched to a dev agent by /pm-dispatchpriority:p2Medium: important, M3
Activity
objectstack-fleet commentedon Nov 26, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in area:ai · domain:server · Bug · priority:p2 ·
pm:queue· size S; rationale: on multi-node deployments a build that loses its lease keeps going, so two nodes can embed the same source and double the cost, and a hung embedding call holds the lease until restart. Read from the code, not run: p2 as suggested.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
Scope note · 2026-11-26T09:43Z · zone ai-37000
Also carried from #37101 (PR #37492, os-dev report 7188339132): the pgvector store's builder lock is a PostgreSQL session advisory lock, released after
buildLockIdleMs(15 min) idle or when its session drops. A build that loses it is not fenced mid-walk either. A second builder writes the same generation under the same fingerprint, so the index stays correct and only the embedding spend doubles. The stop-at-next-page check in this card's acceptance covers both the cluster lease and this advisory lock.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
Scope note · 2026-11-26T09:56Z · zone ai-37000 (seat L1 7188645663 on PR #37492, finding N1)
Adapter-side acceptance line for this card:
completeBuildcompletes only the generation that this builder opened. A builder that lost its lock, while another builder has since taken the source up, cannot switch or delete that builder's generation. The refusal is coded, and a test drives two builders where the first one's lock lapses.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
Scope note · 2026-11-26T11:19Z · zone ai-37000 (PR #37492 os-dev report 7190533996, seat L1 7188645663)
These pgvector generation edge cases are carried here because they sit on the same build path:
Errorwith no code. The fix is to give itCONCURRENT_MODIFICATION(409) and remove that code's row fromscripts/error-status-unpinned-baseline.jsonin the same PR.beginBuildinstead.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
First touch · 2026-11-26T12:36Z · zone ai-37000, on the maintainer's word (the triage seat is offline)
Grade confirmed as filed: Bug · area:ai ·
domain:server· p2. Routed to zone ai-37000 (topic #37000) and put inpm:queue.Whose order: the maintainer (Bill). Verbatim: 「按建议定级,可以开」. Where: the seat-5 project thread for zone ai-37000, 2026-11-26T12:36Z, answering the zone's proposal of grades and order for #37465, #37466, #37467 and #37545.
objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
Claim: PM loop round 1 · zone ai-37000 (topic #37000) · 2026-11-26T12:38Z
Session:
session_01Utp6Cb4BAjgQ43tqy1DvVJAccount:
os-billArea: ai-37000
Branch:
claude/issue-37465-build-lease-fenceWorktree:
objectstack-issue-37465Domain:
domain:serverSeat:
repo:objectstack#5File surface:
packages/services/service-knowledge/src/knowledge-build.ts,knowledge-build-actions.tsand new test files inpackages/services/service-knowledge/src/__tests__/;packages/plugins/knowledge-pgvector/src/(fence on a lost advisory lock, completeBuild only for the generation this builder opened, N2/N3/N4) and new test files;packages/plugins/knowledge-turso/src/only if its completeBuild needs the same own-generation check;scripts/error-status-unpinned-baseline.json(the CONCURRENT_MODIFICATION row, N3);content/docs/ai/knowledge-rag.mdx;.changeset/(stop on breach; explain in the report)Container & model:
M,mode:subagent,model: default (dispatch-gates --tier: no path-derived mandate; floor sonnet · default opus · ceiling fable),effort: highClause-②: no
Metadata-protocol: none
Responsibility:
n/a — not a defect cardThread-read: 7192233569
Premise: holds (filed from contract record 7184443506 S1 on PR #37439, merged; scope notes on this card from PR #37492, merged)
Pre-claim lane:
domain:server— packages/services/service-knowledge and packages/plugins/knowledge-*Pre-claim deps: none (#37099 and #37101 merged)
Prior rulings read: ADR-0161 (no new adapter-contract member unless admitted); ADR-0049 (a bound's key lands with its reader)
Serial constraints cleared:
PR #37442 (#37102) and #37304 (card thread) both edit knowledge-service-plugin.ts, knowledge-service.ts and service-settings' knowledge manifest: this card stays out of those files (no new settings key; the build bound is a plugin option or a fixed ceiling); overlap-check before each push.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
os-dev-report
{ "issue": 37465, "status": "blocked", "branch": "claude/issue-37465-build-lease-fence", "pr": null, "session": "session_01Utp6Cb4BAjgQ43tqy1DvVJ", "premise_still_valid": true, "summary": "Stopped before any edit, per the dispatch order's stop rule: the cluster-lease fence (Acceptance 1, cluster half) and the build bound (Acceptance 2) cannot be built without editing knowledge-service.ts, which the order puts out of bounds. Measured on origin/main 1af67b26c: the page loop is KnowledgeService.walkObjectSource (knowledge-service.ts line 499, loop at 608, upsert at 671) and the lease, the walk's await and the release all sit in KnowledgeService.rebuildSource (line 920; keepBuildLeaseAlive at 970 only logs 'The build continues'; await this.reindexWith at 992; release in its finally). The only knowledge-build.ts symbols on the build path are keepBuildLeaseAlive (synchronous, returns a stop function), BUILD_LEASE_MS, buildLockKey and emptyBuildProgress; none is inside the walk's await chain, so neither a per-page lease check nor a race of the walk against a bound can live in knowledge-build.ts or knowledge-build-actions.ts, and a pgvector-side check fences only pgvector's own advisory lock, never the cluster lease. The claim's file surface names knowledge-build.ts for work that lives in knowledge-service.ts. The card's premise holds (line 970-977: a failed renewal only logs). The branch was pushed empty (head = origin/main 1af67b26c) as the landing marker; no commit, no PR, worktree removed. Doable now without the blocked files: the whole pgvector half (fence on a lost advisory lock inside the store's build writes, completeBuild only for the generation this builder opened with a coded refusal and a two-builder test, N2, N3 with the baseline row, N4 optional) and the knowledge-turso measurement; the cluster-lease fence, the bound and the docs for both wait on the decision below.", "tests": "none run: no diff. pnpm install --frozen-lockfile in the worktree finished (Done in 8.9s) before the stop.", "gates": "none run: no diff; dispatch-gates --commands not derived (empty change set). No PR, so no check-runs.", "dogfood_battery": "n/a: no PR, no diff", "mcp_calls": "0", "api_writes": "1: POST issues/37465/comments (this os-dev-report, via post-stamped.mjs). git push of the empty branch is not a REST write.", "open_questions": [ { "question": "How does the cluster-lease fence and build bound reach knowledge-service.ts, which this order excludes?", "options": [ "A. Lift the exclusion for walkObjectSource and rebuildSource only (knowledge-service.ts lines 456-1035 at 1af67b26c) and re-dispatch the whole card. Measured: PR #37442's knowledge-service.ts hunks sit at about lines 190-217 (getAdapter, reportUnmountedAdapters), 1545-1569 (the search loop) and 2174-2210 (helpers), so no textual overlap; #37304 has no PR yet, its overlap is not measurable. Cost: one rebase lap if #37442 lands first; the change is about 40-80 lines (a still-held check before each page's read, a bound timer racing the walk, two new record outcomes).", "B. Split: dispatch the pgvector half now as Part of #37465 (fence on a lost advisory lock, own-generation completeBuild, N2, N3, N4, turso measurement); file the cluster-lease fence, the bound and their docs as a card Blocked-by #37442 and #37304.", "C. Hold the whole card until #37442 and #37304 land." ], "recommendation": "A, because the measured hunks do not overlap the walk or rebuildSource, the card stays one PR with one docs pass, and the bound's cancellation and the lease fence share one mechanism in rebuildSource; B if the zone wants the serial constraint kept literally." }, { "question": "Does the lease-lost outcome widen the public record shape?", "options": [ "A. Add 'lease-lost' and a bound outcome to KnowledgeBuildRecord.status (exported from service-knowledge; index_status answers it over the settings action door): a widening of an exported type, Clause line amended to yes (widening).", "B. Keep status 'failed' and carry the cause in a new optional field (for example reason: 'lease-lost' | 'time-bound'): still an exported-shape addition, widening as well." ], "recommendation": "A, because the card says 'recording a lease-lost result' and index_status consumers read status; either way the zone amends the Clause line." } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: zone ai-37000 · the claim 7192283508 file surface names knowledge-build.ts and knowledge-build-actions.ts for the walk fence, but the walk and the lease use live in knowledge-service.ts (lines 499-763 and 920-1035 at 1af67b26c); noted, not filed", "carrier: zone ai-37000 · PR #37442 also edits content/docs/ai/knowledge-rag.mdx (+27 -2, the new 'Turning it on' section and the libSQL store paragraph); this card's docs item touches the same file, a different section; noted, not filed" ] }objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
Claim amend (claim 7192283508) · 2026-11-26T12:43Z
Answers to the os-dev report 7192364339:
packages/services/service-knowledge/src/knowledge-service.ts, limited towalkObjectSourceandrebuildSource(the page loop, the lease renewal, the walk's await and its release). PR feat(core): requires knowledge mounts the knowledge service and one vector store #37442's hunks in that file sit elsewhere (getAdapter / reportUnmountedAdapters, the search loop, helpers). Run overlap-check before each push. Whichever lands second merges main, and knowledge_source: admit the governed metadata type with its loader — registry, stack collection, ADR-0087 renames and retirements, the two authoring guards, one name per source #37304's card thread is told.KnowledgeBuildRecord.statusgainslease-lostand a bound outcome.Clause-②: yes (widening): an exported record type gains values, and new exported options if any. The bump stays patch.
objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
os-dev-report
{ "issue": 37465, "status": "done", "branch": "claude/issue-37465-build-lease-fence", "pr": "https://github.com/objectstack-ai/objectstack/pull/37570", "session": "session_01Utp6Cb4BAjgQ43tqy1DvVJ", "premise_still_valid": true, "summary": "Built the whole card under claim amend 7192393989; final head 50bac3562 (draft PR #37570). service-knowledge: rebuildSource runs its walk under a build fence (startBuildFence in knowledge-build.ts). walkObjectSource checks the fence before each page and before the purge and completion. A lease the lock reports lost, or one not renewed within BUILD_LEASE_MS (an unreachable lock store or a hung renewal), stops the build with status lease-lost and releases the lease. The bound is a fixed ceiling, not a settings key or option: BUILD_STALL_LIMIT_MS, 15 minutes without a page finishing. Past it the build is cancelled, the lease released, and the status is timed-out. The page-loop calls and the whole walk are raced against the bound, so the walk chain is freed. knowledge-pgvector: each build write or removal checks pg_locks on the lock's own session and is refused LOCK_CONFLICT 409 once the advisory lock is gone. completeBuild completes only the build this adapter began and only the generation that build began (coded LOCK_CONFLICT refusal otherwise). A kept lock is re-checked at beginBuild. N3: an exhausted search is CONCURRENT_MODIFICATION 409. N2 already held at beginBuild (measured live; pinned by a test, documented). N4 was not implemented, because two concurrent sweeps now need two lock holders, which the fence refuses. knowledge-turso was measured and not changed: it has no builder lock, so there is no builder identity beyond the fingerprint, which completeBuild already requires. Docs and changeset done. Edits to knowledge-service.ts stay in walkObjectSource and rebuildSource, plus the import block and a one-parameter fence pass-through in reindexWith. Widening: KnowledgeBuildRecord.status gains lease-lost and timed-out; nothing else newly exported from the package entry (the claim already reads Clause-②: yes (widening)).", "tests": "At 9c8ea6d38/01488b87c, before the merge of main: service-knowledge full suite under the lock, 'Test Files 15 passed (15) / Tests 456 passed (456)', VERDICT command-exit 0. Typecheck exit 0 for both packages. knowledge-pgvector against a local PostgreSQL 16.16 with pgvector 0.8.7, OS_EXPECT_LIVE_DIALECT_MATRIX=1: 'Test Files 8 passed (8) / Tests 83 passed (83)' (baseline before this PR: 6 files, 76 tests; new: build-fence.live-postgres.test.ts with 6 cases, search-switches.test.ts with 1). At final head 50bac3562: pgvector live again 83/83, and fence plus build tests 30/30. Ablations (each a mutation on disk, then git restore; status porcelain 0 after): the per-page lease check disabled turned 2 fence cases red; pgvector fenceBuild disabled turned 2 live cases red; the rebuildSource race disabled turned the hung-completeBuild case red (the case was added after the first ablation of the race stayed green: the walk's own race had covered the page loop).", "gates": "overlap-check at 01488b87c: 'VERDICT clean exit 0' against origin/main 4116465625 and #37442. dispatch-gates --commands at 50bac3562 (--repo objectstack-ai/objectstack): 109 derived; --ran reconciliation 'Run reconciliation — 109 derived, 107 run, 2 NOT-MEASURED, 0 UNRUN' exit 0. The two NOT-MEASURED both exited 3, PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test (shallow clone) and spec check:skill-examples (client-react not built). spec check:docs exited 1 at first: the gitignored schema tree was stale after the merge of main. After 'pnpm --filter @objectstack/spec build' (VERDICT command-exit 0) it re-ran to exit 0, '252 generated files in sync'. Earlier round: check:objectql-double-limit flagged the new live test's engine double as unjudged; it was fixed (the double now filters and bounds) and re-ran to exit 0. check:error-status-conformance exit 0 after removing the CONCURRENT_MODIFICATION and LOCK_CONFLICT rows. PR #37570 check-runs at 50bac3562: 55 completed, 40 success, 15 skipped, 0 failure. Required contexts: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards), Build Core success, Governed Surface Queue Guard success, Test UI success, Live E2E UI success, Dogfood Regression Gate success, Check Changeset success. Lint UI, Type Check UI and Build & E2E UI were skipped by their path selector. Temporal Conformance (live PG + MySQL) was skipped on the PR (it runs in the merge queue); its locally measured stand-in is the live pgvector count above.", "dogfood_battery": "n/a: no ! in the PR title and the Clause arm is widening, not narrowing", "mcp_calls": "0", "api_writes": "4 relay writes this session as objectstack-fleet[bot], through post-stamped and fleet-write: POST issues/37465/comments (the first, blocked os-dev-report 7192364339); POST pulls (#37570, draft forced); POST issues/37570/assignees (os-bill, from the claim's Account); POST issues/37465/comments (this report). No labels were written.", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: none · noted in PR Acceptance notes, not filed · knowledge-turso search still throws an uncoded Error after three generation switches (turso-adapter.ts, 'changed 3 times during one search'), the sibling of N3; outside the claim's turso clause (completeBuild only) · dedupe words: turso search CONCURRENT_MODIFICATION switches", "carrier: none · noted in PR Acceptance notes · N2 remainder: after a fingerprint revert, readIndexState reads current, so no build runs and the stale building generation stays until the next build of any kind; retiring it without a build needs indexStatus or a read-time sweep", "carrier: zone ai-37000 · noted · deviations: (1) knowledge-service.ts edits beyond the two named functions are the import block and a one-parameter fence pass-through in reindexWith (needed to thread the fence into walkObjectSource), none in #37442's regions, overlap-check clean; (2) scripts/error-status-unpinned-baseline.json also lost its LOCK_CONFLICT row, which check:error-status-conformance demanded once the new pgvector refusals declared its status; (3) merged origin/main once before opening the PR (merge commit 50bac3562); (4) the local PostgreSQL ran under /var/tmp/os-issue-37465-pg, because the postgres user cannot traverse the scratchpad path; stopped and removed; (5) the commits carry the model-free trailer pair (AGENTS.md), not the harness reminder's model-named Co-Authored-By, and the PR footer is the session-URL form" ] }