瀏覽代碼

docs: the connect cap makes retry ladders dearer, and a grep is not a state check

Two lessons from consumers after the 0.18.1 deploy.

novitax found a second-order cost of the connect cap that I shipped without
checking: honouring embedTimeoutMs at face value makes a multi-rung ladder cost
closer to the sum of its labels. Their [6000, 5000] went from 6063 ms measured
to about 11 s against a 15 s route budget. Worse, the failure shape changes from
an embedding_timeout the caller retries into a hard wall-time cut-off of the
whole run, which is exactly the check this file already prescribes when
tightening a contract. Records the threshold - only asks above 4000 moved at all
- so nobody re-derives who is affected, and notes that the escape hatch is
GLOBAL, so relieving one tenant re-halves every other tenant's read window.

And their own finding: a repo grep told them no collection pinned
embedding_model, when both were pinned out of band at creation. The grep
answered "does our code set this", not "is this set". Prod's default is
text-embedding-3-small, so had the field really been empty they would have been
embedding against OpenAI while reasoning about qwen throughout. Read the
collection metadata, not the tree.
fszontagh 3 周之前
父節點
當前提交
6be32a41da
共有 1 個文件被更改,包括 7 次插入 和 0 次删除
  1. 7 0
      CLAUDE.md

+ 7 - 0
CLAUDE.md

@@ -695,6 +695,13 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   Two halves worth keeping separately, because only one of them was theirs. Theirs: quoting an upstream latency without asking which collection produced it. **MINE: publishing a measurement without its corpus**, which is the half that can be fixed by the person with the data, and is cheaper than any correction afterwards. State rows and vector bytes beside any cold-path figure.
   **And tie such a figure to a QUANTITY rather than a date.** 0.025 s is a fact about 121 rows, not a property of their deployment; it expires if the corpus grows roughly a hundredfold, and nothing announces that. Same discipline as the snapshot-headroom measurement that silently went stale through ordinary growth.
 
+- **MAKING A TIMEOUT HONEST MAKES A RETRY LADDER MORE EXPENSIVE, AND THE TENANTS WHO TUNED AGAINST THE DISHONEST VERSION NEVER KNEW THEY HAD.** 0.18.1's connect cap is the fix and this is its second-order cost, raised by novitax rather than noticed by me. Before the cap, a declared `embedTimeoutMs` of 6000 resolved to connect 3 s + read 3 s, so a fully exhausted `[6000, 5000]` ladder measured **6063 ms** - about half its face value. Honoured properly it is 2+4 then 2+3, so the same ladder now costs up to **11 s** against a route `timeoutMs` of 15000: headroom 9 s down to 4 s.
+  **The failure that arrives is not the one the caller handles.** A rung expiring is an `embedding_timeout` they recognise and retry; the ladder overrunning the run's wall budget is a hard cut-off of the whole function, which surfaces as the route dying. So the fix moved a tenant from "slow but handled" toward "fails in a shape nothing branches on" - the exact thing this file's own rule demands be checked, and I shipped without checking it.
+  **THE THRESHOLD, so nobody has to re-derive who is affected: only values ABOVE 4000 changed at all.** Below that the half-of-budget rule was already tighter than the 2 s cap, so a 2000 ms ask still resolves to connect 1 + read 1 and a 4000 ms ask to connect 2 + read 2, exactly as before. One consumer's four call sites are 2000 and 4000 and are therefore inert; only a ladder with a rung over 4000 moved.
+  **The escape hatch is global, which is the part to say out loud BEFORE an incident rather than during one.** `embedding_connect_cap_sec` hot-reloads and 0 restores the pre-0.18.1 arithmetic exactly - but it is a GLOBAL setting, so relieving one tenant's ladder re-halves every other tenant's read window. There is no per-project form of it today. That asymmetry is why the warning went to every consumer with a function rather than only to the one who found it.
+- **A REPO-WIDE GREP ANSWERS "DOES OUR CODE SET THIS", NEVER "IS THIS SET" - AND THE THING THAT CREATED A COLLECTION MAY NOT BE THE REPO YOU ARE GREPPING.** novitax, 2026-11-03, off the back of our settings payload. A long comment in their function had reasoned that neither `kb_facts` nor `kb_fact_answers` pins `embedding_model`, on the evidence that nothing in their repo sets it, and concluded that both being empty is what made the two collections comparable. **Both ARE pinned, to `qwen/qwen3-embedding-8b`, set at creation out of band.** Their conclusion survived by a different route - same model on both, and a pin is write-once - but the reasoning was wrong, and the cost of being wrong was concrete: prod's `default_embedding_model` is `text-embedding-3-small`, so had the field genuinely been empty they would have been embedding against OpenAI while every latency note in that file argued about qwen.
+  The grep was correct and answered a different question, which is this file's most repeated shape in a new place: provisioning that happened once, by hand or by a script that is not in the tree, is invisible to any search of the tree. **Read the collection's own metadata (`GET .../collections/{c}` reports `embedding_model`), not your repo.**
+
 ## Deploy / publish
 
 **`VERSION` and `api/openapi.json`'s `info.version` must agree, and `packaging/build.sh` now refuses to build unless they do** (`scripts/check-version-sync.sh`, run at the top level so it covers the local, Docker and publish paths alike). They drifted once: 0.10.0 was published with the docs claiming 0.9.2, and since `openapi.json` ships in the server package and is served at `/openapi.json`, the stale value was live. **Correcting it cost a whole release**, because a published version number is never reused for different content - which is why 0.10.0 exists but must never be deployed. A release step that relies on remembering is a release step that gets skipped, so it is a check rather than a checklist line.