Repository navigation
Description
repo:objectstack#2 · os-warren · session_01JQwxbYGom9jneGXshSXk4W
Filing category ④ — child card of topic #38703, row B1 · Source: topic #38703
Grade: priority:p1 · area:ai · inherits the topic's grade; every phase-3 go/no-go is decided on this card's numbers.
维护者速读
- 问题:现在只知道「一次检索约 1.1 秒」,不知道时间花在嵌入、向量扫描、范围条件还是权限复查上;之前的实测用的是本地未提交的代码。
- 本卡做:先交付一个提交进仓库的分段计时手段,再在验收环境(A4)上按四档范围、四档并发跑基线。B2 前后各跑一次,第一期出口再跑一次。
- 用途:第三期每一项(HNSW、表布局、只嵌入一次……)做不做,都看这份数据。
Business reason
Topic #38703, maintainer 2026-11-30: 「第三期,按验收数据决定做不做,并且由人工决策后才继续」. Without a committed, repeatable segment timing there is no data for that decision, and HNSW is pulled into phase 1 only if this baseline fails the line.
What (topic row B1, verbatim)
验收环境上的 knowledge-pgvector 基线,在套件版本上测。先交付计时手段(不依赖本地未提交的代码)。分段计时(嵌入、向量、范围条件、权限复查),范围取 1%、10%、30%、100%,并发取 1、5、10、20。B2 前后各跑一次;第一期出口时再跑一次,作为第三期决策的数据
Two parts
- Instrument (starts now, no dependency): a committed way to read per-search segment times — embed, vector statement, scope predicate, permission re-check — from a real
search_knowledgecall. Prefer an existing seam (structured debug log / metrics hook / the service's existing timing if any) over a new public surface; if a new option or log key is needed, the claim declares it (Clause-②). Plus a committed load/bench script runnable against any PostgreSQL URL. - Baseline (blocked by A4): run on the A4 environment (kit PostgreSQL 16 + pgvector 0.8.7, ~60k passages, 1024 dims) at scope 1/10/30/100 % × concurrency 1/5/10/20; report p50/p95 with sample counts, machine shape, cold/warm. Run before and after B2; again at the phase-1 exit.
Constraints from the topic
- Tests pin statement shape / call counts, never wall-clock time.
- Speed numbers are quoted only from a bench that has passed L1, never from estimates.
- Record per search: duration, hit count, searches per question, backfill share (scoped and unscoped separately), embedding-call failures.
Dedupe
Topic #38703's dedupe covers pgvector/HNSW (open and closed). #38510 (closed) holds an earlier local pgvector reading; this card replaces its uncommitted timing with a committed one.
Part 2 (baseline) — dispatched · 2026-11-30T15:03Z
Both blockers merged: #38726 (B2, f782a12) and #38692 phase 1a (pgvector PR #38745, 8a7e65b). #38747 (scope-first filter) also merged. Claim 7282361408 sends the PostgreSQL 10-client re-run on main 8a7e65b or later to the cloud#5250 rig, scoped and unscoped, vector and hybrid modes. The results are posted here.
Activity
objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbYGom9jneGXshSXk4W
2026-11-30T07:40Z · Claim · topic #38703 row B1, on the maintainer's 「整个专题都归你接手 38703 加速处理」 (2026-11-30T07:21Z, project thread). That order lifts the knowledge pause for this topic's phase 1.
Triage (lane self-triage, fleet-filed child card): area:ai · priority:p1 (inherits the topic) · type Task · fix lands in new bench/timing files; no
domain:*until a path is written.Claim: PM loop round 1
Session:
session_01JQwxbYGom9jneGXshSXk4WAccount:
os-warrenBranch: a new branch from
origin/main; the card thread names it on its first push.Worktree:
objectstack-issue-38719Domain:
domain:serverSeat:
repo:objectstack#2Area:
o2-E(topic #38703 zone)File surface:
packages/plugins/knowledge-pgvector/bench/**(reason: new directory, the committed load/timing script),.changeset/38719-*.md(reason: one changeset if a package export changes). Service-side segment timing inpackages/services/service-knowledge/src/**is NOT in this claim: it waits for #38700, then a claim amendment after check-handover.packages/plugins/knowledge-pgvector/src/**is held by #38692 and is not in this claim.Container & model:
M,mode:thread,model: default tier — dispatch-gates --tier 2026-11-30: "no path-derived mandate",effort: highClause-②: no
Metadata-protocol: none
Responsibility: n/a — not a defect card
Thread-read: none
Premise: holds —
grep -rn statement_timeout packages/plugins/knowledge-pgvector/src0 hits and poolmax: this.opts.poolMax ?? 4atplugin.ts:155onorigin/maind2caaec; no committed segment timing exists (the topic's 1.1 s reading came from uncommitted local code).Serial constraints cleared: #38692 (claim 7270621658,
knowledge-pgvector/src/**) — not touched; #38700 (service-knowledge split) — not touched, service timing waits for it.objectstack-fleet commentedon Nov 30, 2026
triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ
First-touch review: confirmed · area:ai · Task · p1 as the topic grades it (#38703 row B1: every phase-3 go/no-go reads this card's numbers) · type set to Task (measurement tooling and a baseline run) and
domain:serveradded for the knowledge-pgvector timing hooks.objectstack-fleet commentedon Nov 30, 2026
repo:objectstack@os-warren · os-warren · session_01JQwxbXQcnpisuAAJRr8yNr
os-dev-report
Reported 2026-11-30T08:15Z
{ "issue": 38719, "status": "done", "branch": "claude/project-thread-7ze7yf", "pr": "https://github.com/objectstack-ai/objectstack/pull/38729", "session": "session_01JQwxbXQcnpisuAAJRr8yNr", "premise_still_valid": true, "summary": "Part 1 delivered as draft PR #38729 (head 8e3e522f, Part of #38719): a new, unpublished packages/plugins/knowledge-pgvector/bench/ directory (instrument.mjs, run.mjs, instrument.test.mjs, README.md). It times each real search_knowledge call per segment through seams the code already takes; no file under either package's src/ was edited. Segments: embed measured (adapter embedder option). Vector statement measured as ranking (adapter pool option); that statement also carries the keyword leg and the scope predicate. Permission re-check measured (service dataEngine option: permission_recheck after ranking, visible_ids before it). Pool wait measured (pool option). Scope predicate NOT MEASURED in situ: it is a conjunct of the ranking statement's one WHERE. --isolate-scope gives a labelled DERIVED out-of-situ number (paired bare-count statements on the captured WHERE, run serially, server Execution Time). The in-situ seam needed is the store timing its own statement parts: a change under knowledge-pgvector/src, held by #38692. run.mjs takes any PostgreSQL URL and a scope % x concurrency grid (default 1/10/30/100/none x 1/5/10/20). Per cell it reports p50/p95 with sample counts, hit count, searches per question, backfill share (scoped and unscoped separately), embedding-call failures, service 'search failed' log lines, the machine shape, and cold or warm. Mechanism hypotheses: the pool option is injectable (confirmed); no committed search-path timing existed (confirmed); the vector and scope parts are one statement (confirmed: hence the derived pass); embed and permission timing are reachable via the embedder and engine (confirmed).", "tests": "At head 8e3e522f, under os-verify-lock. pnpm --filter @objectstack/knowledge-pgvector test: VERDICT command-exit 0; Test Files 6 passed | 8 skipped (14); Tests 29 passed | 93 skipped (122). The 8 skipped are the live-PostgreSQL files: OS_TEST_POSTGRES_URL is unset. pnpm --filter @objectstack/knowledge-pgvector typecheck: exit 0. bench/instrument.test.mjs alone: 5 passed. Ablation: permission_recheck reclassified on disk gave 1 failed | 4 passed (the two-round recheck pin); restored with git restore, porcelain clean. Live smoke: local PG 16.15 with pgvector 0.6.0, 5,000 passages, 1024 dims, full 1/10/30/100/none x 1/5/10/20 grid, 40 searches a cell, --isolate-scope. VERDICT command-exit 0; 20/20 cells; 0 failed searches; 0 'search failed' lines. Not quotable: not L1, a shared box, and pgvector 0.6.0, not the kit's 0.8.7.", "gates": "Local subset: node scripts/pm/dispatch-gates.mjs --commands derived 46 commands at 8e3e522f; all 46 were run with exit codes captured before any pipe. 43 exited 0 on the first pass. pnpm check:dts-closure exited 1 because the closure had been built with OS_SKIP_DTS=1; after a full declaration build it was re-run and exited 0 (129/129 declaration files present). Two are PREREQUISITE NOT MET and count as NOT MEASURED: node scripts/check-plugin-teardown-shape.mjs --self-test (exit 3: a shallow clone cannot reach the pinned fixture commit) and pnpm check:dual-build-cjs-loads (exit 3: the workspace is not fully built). --ran reconciliation: 46 derived, 44 run, 2 NOT-MEASURED (exit 3). CI check-runs on 8e3e522f when this was written: Check Changeset=success, Governed Surface Queue Guard=success; Lint/Type Check lanes, PR-body guards and Check PR Size were in_progress. NOT MEASURED: CI convergence, reason: the report is delivered at the end of local verification; the seat reads CI.", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "2 — (1) fleet-write relay pr_create, run 46379857540: POST /repos/objectstack-ai/objectstack/pulls (draft) + POST /issues/38729/assignees [os-warren] + POST /issues/38729/labels [skip-changeset], read back byte-identical; (2) post-stamped.mjs: POST /repos/objectstack-ai/objectstack/issues/38719/comments (this report). git push x3 to claude/project-thread-7ze7yf, not REST writes.", "classifier_refusals": [ { "command": "mkdir -p $SP/src && cd $SP/src && git clone -q --depth 1 --branch v0.8.7 https://github.com/pgvector/pgvector.git && cd pgvector && make && make install", "reason": "[Undermining Oversight]", "mode": "subagent", "human_turn_before": "unknown", "resend": "none — not resent; the Ubuntu package postgresql-16-pgvector (0.6.0) was installed with apt-get instead, so the smoke run used pgvector 0.6.0" } ], "open_questions": [ { "question": "Part 2 on A4: run.mjs composes its own KnowledgeService over a throwaway schema with synthetic data. It cannot yet time the kit's own runtime or the already-indexed BrightRule source (59,949 passages). Which does the A4 baseline measure?", "options": ["A: add a bench option to search an existing source and schema (a run-only follow-up in bench/**)", "B: accept the bench composition on the kit's PostgreSQL, seeded at 60k x 1024 with an OpenAI-compatible embedder equal to the customer's, as the B1 number", "C: time the kit's runtime itself (needs a runtime-side seam; touches service-knowledge, which waits for #38700)"], "recommendation": "B for the first B1 reading (it runs today and measures the same open code paths and PostgreSQL), then A once #38700 lands, because B needs no new seam and A only removes the synthetic-data caveat" }, { "question": "Should the scope predicate get an in-situ number?", "options": ["A: keep the derived out-of-situ pass (--isolate-scope) as B1's scope figure", "B: add a store-side seam under knowledge-pgvector/src (held by #38692) that times the statement parts"], "recommendation": "A until phase 3 asks for B6, because the derived pass already gives scope selectivity and predicate cost on the same WHERE, and B edits a held file" } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: #38703 row B2 · in the local smoke run, pool wait at concurrency 10-20 took most of the search time with poolMax 4 (e.g. 100% scope, 20 clients: pool wait p50 1451 ms of a 1776 ms total p50). This is B2's pool-size setting, noted, not filed", "carrier: #38703 row B7 · every query with keyword terms runs the hybrid ranking statement today, so 'vector statement' timing includes the keyword leg until mode: 'vector' lands. Noted, not filed" ], "deviations": [ "The shared checkout already held the local branch claude/project-thread-7ze7yf, so dev-worktree.sh refused that name. The worktree was built on the local branch claude/issue-38719-pgvector-bench, and every push used HEAD:claude/project-thread-7ze7yf.", "Commit trailers use the model-free pair (Claude-Session + Co-authored-by: Claude) as AGENTS.md and the pre-push hook require, not the dispatch order's model-named trailer.", "The PR body says 'Part of #38719' (os-dev.md's non-closing form) where the dispatch order said 'Refs #38719'.", "The throwaway PostgreSQL cluster lives at /var/lib/postgresql/os-issue-38719 (port 54719), because the postgres user cannot traverse the scratchpad. It is stopped.", "The PM HOLD at 07:58Z interrupted the gate loop. It was resumed on the RESUME order; the earlier hold-handback reported 0 writes, superseded by this report." ], "files_changed": ["packages/plugins/knowledge-pgvector/bench/README.md", "packages/plugins/knowledge-pgvector/bench/instrument.mjs", "packages/plugins/knowledge-pgvector/bench/instrument.test.mjs", "packages/plugins/knowledge-pgvector/bench/run.mjs"], "head_sha": "8e3e522f8edcf45244a4df6c78fa011d40ead657" }objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbYGom9jneGXshSXk4W
2026-11-30T08:22Z · Part 2 (baseline) withdrawn by the maintainer's scope ruling on topic #38703 (acceptance moves to his own project; 「ok」 08:20:47Z, os-warren's project thread). This card closes as completed when PR #38729 (part 1) merges; no release back to the queue.
objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbYGom9jneGXshSXk4W
2026-11-30T08:34Z · Part 2 (baseline) reopened. The maintainer, os-warren's project thread, 2026-11-30T08:34Z: 「你能做的测量当然可以做,你觉得值得做的我也可以配合你」. This supersedes the withdrawal above. Part 2 runs after PR #38726 (B2) and this card's PR #38729 land, on the PostgreSQL environment from cloud#5250, and again after #38692 phase 1a ships
mode: 'vector'. The embed segment stays marked synthetic until a real embedder is configured. The card no longer closes on #38729's merge: it releases withRefs #38719 (part 1)and part 2 is claimed by this seat.objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbYGom9jneGXshSXk4W
2026-11-30T09:23Z · Landed (part 1) · Release
packages/plugins/knowledge-pgvector/bench/**) merged in PR chore(knowledge-pgvector): per-search segment timing and a load bench for search_knowledge #38729 (L1 ACCEPT 7273562813, landing 7273580531).Part of #38719: the card stays open.Release: claim 7271844805 — part 1 landed; part 2 (baseline) remains and is parked
pm:blockedon fix(knowledge-pgvector): a failed search is a coded refusal, its statement has a time limit, and its pool size is a setting #38726 (B2) per the body'sBlocked-by:line; the re-run also waits for 知识源加「检索方式」和混合比例:只用向量 / 只用关键词 / 混合(可设比例),由应用元数据指定,单次检索可覆盖 #38692 phase 1a by the maintainer's choice on 2026-11-30 (decision card: 「先不做,合并后复测再定」). Seat 2 zone o2-E re-claims part 2 when both have merged.objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbYGom9jneGXshSXk4W
2026-11-30T15:03Z · Claim · part 2 (baseline re-run) · topic #38703 row B1 · zone o2-E
Both blockers have landed on
main: #38726 (B2, f782a12) and #38692 phase 1a's store side (#38720 spec f576dee, #38722 service d316627, #38721 turso 9bb2762, #38745 pgvector 8a7e65b). #38747 (scope-first GIN filter) has also landed, closed 2026-11-30T12:55Z by PR #38758. The re-run therefore measures all three. Maintainer decision 2026-11-30T09:04Z: re-measure after merge, then decide.Claim: PM loop round 2
Session:
session_01JQwxbYGom9jneGXshSXk4WThread session: the cloud#5250 acceptance thread of this project (it holds the PG16 rig and the real-embedding setup)
Account:
os-warrenBranch: none (measurement only; no code on this part)
Worktree: none
Domain:
domain:serverSeat:
repo:objectstack#2Area:
o2-EFile surface: none in this repo. Results go on this card as a comment.
Container & model:
M,mode:thread,model: default tier,effort: highClause-②: no
Metadata-protocol: none
Responsibility: n/a — not a defect card
Thread-read: 7274153000
Premise: holds —
git grep -n jsonb_path_ops origin/main -- packages/plugins/knowledge-pgvector/src/sql.tshitssql.ts:117;origin/mainis 8a7e65b.Serial constraints cleared: none (read-only measurement).
Run order. Framework at
main8a7e65b or later, PG16 + pgvector on cloud#5250's rig, the same replayed plan as the earlier runs (500 searches, 10 clients, cold then warm), the BrightRule corpus with unit sharing applied, real embeddings, pool and statement limit at their defaults (20, 10 s). Rounds: scoped and unscoped, each in vector mode and in hybrid mode. Report p50/p95/p99, failures, coded refusals by code, zero-hit searches, refill share, pool waits, and thebench/segment timing. Include oneEXPLAINof a scoped vector statement that shows the metadata index.os-warren commentedon Nov 30, 2026
Part 2 — PostgreSQL 10-client re-run on framework main (claim 7282361408)
Verdict: on the acceptance plan, scoped search now meets the goal: 10 people asking at once, no timeouts. 2,000 scoped searches at 10 clients (vector and hybrid, cold and warm): 0 failures, 0 coded refusals, 0 zero-hit searches, 0 pool-wait or statement-timeout log lines, scoped p95 0.61–0.72 s, p99 ≤ 1.21 s. Before: 7.8 s p95 with 64 pool timeouts on the pin with a synthetic embedder (run 2), 4.24 s p95 with real embeddings at pool 4 (09:50Z run). One limit stays: the bench's wide cells (a scope covering 100 % of the units, or no scope, with keyword-heavy synthetic queries) still time out at 10 clients on this box. That is the exact-scan ceiling, the phase-3 question, not the acceptance plan; see "Bench" below.
Setup. Framework at objectstack main
8a7e65b4(#38726 pool default 20 and 10 s statement limit; #38745 retrieval modes; #38747 via #38758 metadata GIN index plus scope-first containment), linked into cloud37434ff(branchclaude/project-thread-lfow22, rigscripts/knowledge-acceptance/), EE composed-artifact boot from source; the cloud pin696d02f5has none of these. PostgreSQL 16.16 + pgvector 0.8.7,shared_buffers128 MB,max_connections200; 4 CPUs, 15.7 GiB, database, app, embedder proxy and load client on one machine. Fresh database; BrightRule artifact0f618c6withsource.retrieval.modeset per round; corpus 58,512 clauses (4 merged seeds); unit sharing applied (policy-unit-sharing.mjs). Embeddings:openai/text-embedding-3-smallat 1024 dims through the Vercel AI Gateway, one index pass (58,512 inputs, 5.29 M tokens, 0 failures). Pool and statement limit at their defaults. The same replayed plan as run 1 (294 questions, 500 searches, 10 clients, topK 5, groupByclause_hash), its unit ids remapped to the new database by unit code (a first attempt with the old ids gave 500/500 zero hits on the scoped rounds: the rig's mistake, not the product's; discarded).Rounds (latency = the whole
search_knowledgecall over MCP, embedding and permission re-check included; ms):SERVICE_UNAVAILABLE,TIMEOUTor57014lines in the app log across all rounds; 0 "search failed" lines.差旅费报销管理办法, 5 vs 5 hits).EXPLAIN of the scoped vector statement as the store sent it (captured from the database log, unit
DEMO-GROUP, one unit), run with the same WHERE:Bitmap Index Scan on knowledge_vec_d1024_metadatawithIndex Cond: (metadata @> ANY ('{"{\"owning_unit\": \"…\"}","{\"owning_unit\": [\"…\"]}"}'::jsonb[])), 168 rows, top-N heapsort, execution 4.4 ms (was a sequential scan of 58,508 rows, about 400 ms). Full plan:explain.txtin the attached data.Bench (
packages/plugins/knowledge-pgvector/bench, same database server, synthetic dataset of 60,000 clauses over 100 units, fake in-process embedder soembed≈ 0, hybrid with the keyword leg on every statement, pool 20, warm):Reading: pool waits are gone at every cell (≤ 0.1 ms p50); the cost is the ranking statement, and it grows with the rows the scope admits. A scope of 1 % (BrightRule's units hold 0.3 % each) stays well inside the goal at 10 clients. Wide or absent scopes with a keyword leg that matches broadly are the exact-scan ceiling: the 10 s statement limit now turns them into coded
TIMEOUTrefusals instead of silent zero hits (#38726 working as designed). These bench queries are six synthetic vocabulary words each, far broader than BrightRule's questions, andshared_buffersis the 128 MB default (the bench's unscoped cells read 0.85–1.16 M blocks from outside the buffer cache). Whether that ceiling matters to a customer is phase 3's question (HNSW, buffer sizing), not this card's.Data (summaries, rows, embedder stats, bench JSON, EXPLAIN): project files
cloud-5250/rerun-2026-11-30/.Generated by Claude Code
objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbYGom9jneGXshSXk4W
2026-11-30T17:20Z · Close · completed · topic #38703 row B1 · zone o2-E
bench/instrument) merged in PR chore(knowledge-pgvector): per-search segment timing and a load bench for search_knowledge #38729.main8a7e65b) is recorded in 7286066875. On the acceptance plan, scoped and unscoped search meet the phase-1 goal in both vector and hybrid modes: 2,000 scoped searches at 10 clients, 0 failures, 0 refusals, 0 zero-hit, scoped p95 0.61–0.72 s. The scoped vector statement uses the metadata index (4.4 ms).TIMEOUTat 10 clients. That is the exact-scan ceiling, phase 3's question, which the maintainer ruled out of scope (2026-11-30T08:00Z 「第三期不处理」).chore(knowledge-pgvector): per-search segment timing and a load bench…