Repository navigation
fix(cli): os knowledge rebuild and status give the right answer behind a load balancer - #37578
objectstack-fleet[bot] wants to merge 3 commits into
Conversation
…when a poll lands on another node Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ Co-authored-by: Claude <noreply@anthropic.com>
…angeset Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 40 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d93b758c432d3df88ef04625ac09b4f4a8a01145 && git checkout d93b758c432d3df88ef04625ac09b4f4a8a01145
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6c290d3af7c52d019d1de1c09b6b0306f09700bb c67ccd1f4a2146930b9b8e5aa8cccfdde82c102a && git checkout -B drift-repro 6c290d3af7c52d019d1de1c09b6b0306f09700bb && git merge --no-ff c67ccd1f4a2146930b9b8e5aa8cccfdde82c102a
node scripts/docs-audit/affected-docs.mjs --json 6c290d3af7c52d019d1de1c09b6b0306f09700bb
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 91e9a57 · 2026-11-26T14:18Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Read: card #37466 (body, triage, first touch, claim, os-dev report), the PR #37578 body and Acceptance notes, the net diff against ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
…ue baseline on a shared store Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ Co-authored-by: Claude <noreply@anthropic.com>
Requested by Bill · project thread
Fixes #37466
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Design: the card's second option. The build record stays per node (no service change); the CLI falls back to the index state the store reports, which is the same on every node.
os knowledge rebuildreadsindex_statusonce before it starts the build, as the baseline. A progress read answered by a node without this build's record (no record, or a record with anotherstartedAt) is no longer an exit 1. It reads the index state instead: when the baseline was notcurrent(never built, new fingerprint, changed recipe, no recipe hash), the index turningcurrentmeans a complete build recorded itself (adapters record the recipe hash only incompleteBuild), and the command exits 0, saying the counts were not read.current, the index state cannot tell a running build from a finished one (a same-fingerprint rebuild opens nobuildinggeneration in either adapter:knowledge-memoryandknowledge-pgvectorbeginBuild), so the command keeps polling until a read reaches the building node, whose record decides.failed/not-run) or after the new--timeout(seconds, default 600, counted as polls times--interval) of reads that reach no record of this build and do not see the index turncurrent. The timeout message says the build may still be running and points atos knowledge status; a read that reaches the record starts the timeout again, so a single-node build is never cut off.os knowledge statuslabels the record as the answering node's, and when that node holds none says a build run on another node (or before a restart) is not shown, while the index state is the store's.content/docs/deployment/cli.mdxKnowledge section and a patch changeset.Measured before designing:
index_statusalready returnsindex(state, due, detail, held) from the store andbuild(ornull) from the answering node, so "no record on this node" (build: null) and "never built" (index.state: nothing) are separate fields; no service change was needed.Tests
packages/cli/src/commands/knowledge/knowledge.test.ts, newdescribe"a poll that lands on a node without the build record": still running (polls alternate between a node without the record and the building node, exit 0), succeeded (index turnscurrent, exit 0), an older record on the answering node read as no record, an index alreadycurrentwaits for the building node and reports its recorded failure,--timeoutexits 1 with its statement, and the timeout restarts on a read of the record. Existing rebuild tests gained the baseline read.Readings at 91e9a57
vitest run src/commands/knowledge/knowledge.test.ts: Test Files 1 passed, Tests 12 passed (lock VERDICT command-exit 0).pnpm --filter @objectstack/cli typecheck: VERDICT command-exit 0 (incl. check:test-typecheck OK).Acceptance notes
index_statusanswer carries no node identity, soos knowledge statuscan only say "the node that answered", never which node ran a build.--timeout.Verification
Read first:
packages/cli/src/commands/knowledge/rebuild.ts(the fallback branch after the record check), then the new tests.Two-minute check:
pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 src/commands/knowledge/knowledge.test.tsshows 12 passed.Generated by Claude Code