HEL-874 rework: bounded verbatim readback reaches the real provider input, real pinned Mem0 2.2.1 SDK contract verified live and the adapter's five wiring defects fixed, budget gates made provable (atomic reserve/settle embed ledger + independent llm_ops cap), definite-cap real-check execution table, 8360 isolated release package prepared (not deployed), 2026-10-26 user originals recorded source-only - semantic.context now quotes chain-verified archive rows (original words + role + when, <=200-char window with visible trim marker, summary demoted to a one-line pointer, same min(600,budget) cap) and episodic.context flips from gist-first-120-chars to verbatim-first (<=240) + role + date, both proven by tests/test_readback_hel874.py capturing the actual messages handed to the provider through the real API path: a detail absent from the gist yet quoted verbatim from a turn pushed outside the recent-20 window, the same for a semantic chain hit, and an unshared companion row never leaking through FTS, semantic or any anchor (AM-001); tools/verify_mem0_real_hel874.py runs the FIXED install itself (mem0ai 2.2.1 2c81af3, real embedded qdrant, real fastembed from the existing cache, deterministic 127.0.0.1 fake gateway, temp ledgers only): before=31970c4 dies at construction (second QdrantClient on the same path rejected by the SDK - recorded), and source-level findings confirmed live and fixed - unscoped search raises ValueError in 2.2.1 (add now carries user_id scope, search passes filters+top_k since limit is silently ignored), payload reads ride the SDK's own vector_store.client, the old outer search debit double-counted (wrapper is now the single accounting point), the SDK's internal extraction LLM was ungated (LlmLedgerGuard with its own llm_ops table, cap default 0) and check-then-debit could overshoot under concurrency (EmbedLedgerGuard now reserves atomically in BEGIN IMMEDIATE, releases on failure/cancel, purges stale holds); after fixes all 12 checks pass (construction/anchor payload/user scope/1 LLM + 2-3 embeds per add measured/extraction input set provably only prior gated batches incl. old memories and rolling history/unshared canary zero outbound/search single debit/concurrency never over cap/close-reopen intact/both zero caps refuse with ZERO outbound LLM requests), evidence in docs/rework/hel874/; mood sensitivity returns to the original repo's continuous rule 1.35-0.70*strength (bazi.sensitivity_from_strength, foundation commit 1012d8b) replacing HEL-870's invented 1.25/0.8 step and is labeled an engineering heuristic, never user-approved bazi science (external agent formulas remain not adopted); docs/budget-plan-hel874.md gives definite caps for the one-time team check (55 requests/0 embeds), first-week semantic activation (<=60 extract LLM / <=180 embeds) and user daily use with code-level hard-gate facts and authorization sources (old 20-30/100-200 were estimates, not approved quota; frozen 39/60 and 498/500 untouched and never挪用); deploy/hel874-release.md + cybergril-hel874-8360.service.example prepare the isolated fresh-empty-data-dir release with health capability matrix and data-preserving rollback (NOT executed, PR#11 not merged, no user-facing loop, no experience address); sources/comment-evidence-full-experience-20261026.json adds the two 2026-10-26 user originals (01a17806, 01a1780e full-experience-then-iterate) with authorship verified and manifest appended only - baseline/current/coverage/changes untouched; verification: 256 python tests pass on 3.11.16 venv + requirements.lock offline (3 new real-provider-input readback cases incl. AM-001 negative, mem0 fake rebuilt to mirror the real 2.2.1 surfaces, 9 cases), ruff clean, web tsc + 42 vitest + build pass, local 8360 stub smoke (loopback, isolated temp DB) health R4-assembly all green then stopped, real-SDK script re-run 12/12 after final edits, dual-target requirement checks 4/4 pass with handoff-HEL-874.json; zero real model calls, zero real embeddings, zero outbound (fake gateway on loopback + existing local model cache only), authoritative ledgers and freezes untouched, no existing services or profiles touched
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
multica-agent
parent
31970c4dd3
commit
e978e878df
@@ -0,0 +1,81 @@
|
||||
# HEL-874 · 真实整体检查执行表(有确定上限,交总管核定)
|
||||
|
||||
本表取代 runbook-hel870 §6 的估算口径:**原「约 20–30 次请求 / 100–200 条嵌入」
|
||||
只是估算,不构成任何已批准额度。**本卡(HEL-874)零真实模型调用、零真实嵌入、
|
||||
零出站(真实 SDK 验证全部走本地确定性替身与本地模型缓存)。
|
||||
|
||||
三部分各自独立账本与授权来源;超出既有授权的部分由总管向白栖知申请,
|
||||
批准前对应硬闸保持 `cap=0`(fail-closed,任何真实工作前拒绝)。
|
||||
HEL-857 系列冻结余额(真实请求 39/60、嵌入 498/500、HEL-835 闸)不挪用、
|
||||
不清零、不并入本表任何一部分。
|
||||
|
||||
## 0. 实测单次开销(本卡真实 SDK 验证得出,docs/rework/hel874/)
|
||||
|
||||
| 操作 | LLM 请求 | 嵌入条数 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| Mem0 单行 add(infer) | 1 | 2–3 | phase1 查询嵌入 1 + phase3 提取批嵌入 N + phase7 实体 upsert 0..N |
|
||||
| Mem0 search | 0 | 1 | 问答每轮 1 条查询嵌入 |
|
||||
| 失败/取消 | 预占即释放 | 不计账 | 预占-落账事务制;仅 LLM 失败前已成功的嵌入照实计(工作真实发生) |
|
||||
| 重试上限 | 每批 ≤3 次 | 同上×3 | 作业循环 attempts<3,租约过期回收不重发已成功批次 |
|
||||
|
||||
## 1. A 部分 · 一次性团队整体检查(隔离空库,非用户档案)
|
||||
|
||||
用途:统一候选在 8360 隔离实例上按体验链路清单 1–7 全链走一遍(stub 语义,
|
||||
不激活 Mem0),验证创建→对话→生活→情绪/关系→主动联系→重开同步与隐私负例。
|
||||
|
||||
| 项 | 次数上限(硬顶) |
|
||||
| --- | --- |
|
||||
| 创建 + 自主诠释 + 初始习惯 | 4 次请求 |
|
||||
| 对话(含多轮、中断重试) | 12 轮 ≤ 16 次请求 |
|
||||
| 生活槽(4 槽)+ 打断/恢复 | ≤ 8 次请求 |
|
||||
| 分享判定 / 成长 / gist | ≤ 20 次请求(每完成轮 2 条 gist × 最多 8 轮 + 判定/成长若干) |
|
||||
| 主动联系措辞 | ≤ 3 次请求 |
|
||||
| **合计硬顶** | **55 次请求 / 500,000 tokens / 0 嵌入** |
|
||||
|
||||
- 硬闸:`BudgetGuard`(daily_tokens,见 config/models.yaml)+ 每 Scene 记账;
|
||||
到 95% 非关键场景降档、单次超限降一档,不静默超支。
|
||||
- 授权来源:**需总管新批**(.11:8731 网关在产品环境的用量不属于 HEL-857 的
|
||||
60 次实验授权)。
|
||||
|
||||
## 2. B 部分 · 首周后台/语义激活(需白栖知批准后执行)
|
||||
|
||||
用途:`CYBERGRIL_SEMANTIC=mem0` 真实激活,独立新账(`embed_ops` 续账 +
|
||||
`llm_ops` 新表),观察提取/检索/原话回读在真实使用中的质量。
|
||||
|
||||
| 项 | 上限(硬顶) |
|
||||
| --- | --- |
|
||||
| Mem0 提取 LLM(随公开轮 add) | ≤ 60 次 |
|
||||
| 嵌入(提取批 + 实体 + 查询) | ≤ 180 条 |
|
||||
| 对话/生活/判定等其余 | 并入 C 部分日账 |
|
||||
|
||||
- 硬闸:`embed_cap` / `llm_cap` 写入 config/semantic.yaml(默认 0=拒绝);
|
||||
预占-落账事务制保证并发不越 cap、失败不计账;`embed_reserve` 预留复测余量。
|
||||
- 碰上限即停:作业批标 `failed:semantic_embed_budget_exhausted`,检索返回空
|
||||
块、对话回落词面 FTS,主对话不中断;恢复需总管调 cap,不自动翻页。
|
||||
- 授权来源:**需白栖知明确批准**(提高嵌入上限或另批独立账;现有 498/500
|
||||
余额 2 条不够任何真实激活,属 HEL-835 未解闸范围)。
|
||||
|
||||
## 3. C 部分 · 用户日常使用(体验地址交付后)
|
||||
|
||||
| 项 | 日上限(硬顶,建议值交核定) |
|
||||
| --- | --- |
|
||||
| 主对话 + 主动措辞 + 危机 | ≤ 60 次/日 |
|
||||
| 生活事件生成(4 槽/天) | ≤ 8 次/日 |
|
||||
| gist/判定/成长 | ≤ 40 次/日 |
|
||||
| Mem0 提取 LLM | ≤ 40 次/日 |
|
||||
| 嵌入(全部) | ≤ 60 条/日 |
|
||||
| tokens | 2,000,000/日(既有 BudgetConfig 硬闸) |
|
||||
|
||||
- 硬闸同上;`daily_tokens` 到 95% 降档、到顶停(非关键场景转规则路径),
|
||||
嵌入/提取到顶只停语义层,主对话可继续。
|
||||
- 授权来源:**需白栖知批准日预算后**才能交付体验地址;首周日用量按本表
|
||||
B 部分上限受控观察,超限如实记录不补发。
|
||||
|
||||
## 4. 本卡已核实的闸门事实(代码级,测试可复现)
|
||||
|
||||
1. `embed_cap=0` / `llm_cap=0` 在任何真实工作前拒绝,出站 LLM 为 0
|
||||
(真实 SDK 实测 C5)。
|
||||
2. 每次 search 恰好 1 条嵌入记账;并发预占不越 cap(C4/C6)。
|
||||
3. 对话同一轮绝不双发(chat_lock + 轮次幂等重放)。
|
||||
4. 语义作业失败 ≤3 次重试、租约回收不重复发送;失败嵌入不计账。
|
||||
5. 主对话 token 走 `BudgetGuard` 唯一闸,按 Scene 分桶可审计。
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"baseline_version": "1.11",
|
||||
"read_commit": "31970c4dd3851aae67a922b03264743d504b8e97",
|
||||
"task": "HEL-874 返工:补齐原话回读与真实记忆库接线——原话有界回读进入真实 provider 输入、实际固定 Mem0 SDK 合同核验并修复接线缺陷、预算闸可核验(嵌入预占制+内部 LLM 独立闸)、有确定上限的真实整体检查执行表、8360 隔离发布包、补记 2026-10-26 用户原话来源;不做部署、不合并、不启动用户真实循环、零真实调用",
|
||||
"requirement_ids": [
|
||||
"CG-006",
|
||||
"CG-008",
|
||||
"CG-011",
|
||||
"CG-012",
|
||||
"CG-013",
|
||||
"CG-014",
|
||||
"CG-015",
|
||||
"CG-016",
|
||||
"CG-021",
|
||||
"AM-001",
|
||||
"AM-002",
|
||||
"AM-003",
|
||||
"UX-004",
|
||||
"UX-006",
|
||||
"GOV-001",
|
||||
"GOV-002",
|
||||
"GOV-003",
|
||||
"GOV-005",
|
||||
"GOV-006",
|
||||
"DEL-001"
|
||||
],
|
||||
"deliverable": "在统一候选母线 hel-870-assembly(基线 31970c4 保留作前后对照)上完成四类修正,全部零真实模型/零嵌入/零出站(127.0.0.1 确定性假网关与本地模型缓存除外):1) 原话有界回读——memory/semantic.py chain_resolve 现返回锚定行的原话文本与时间戳,context() 把来源原话(每行≤200字窗口+可见截断标记)、角色、时间随命中注入模型上下文,摘要仅作一行指针,预算仍为 min(600,budget);memory/episodic.py context() 由『gist 优先截120字』改为原话优先(≤240字窗口)+角色+M月D日 HH:MM,gist 不再充当回读载荷;tests/test_readback_hel874.py 三例全部捕获真实发给 provider 的 messages(经 TestClient 全链):已退出近20轮窗口的旧轮细节(工牌编号A8823,gist 中不存在)原话进入模型输入且带角色与时间、语义链命中同样回读原话、未分享伴侣行原话在 FTS/语义两通道与任何锚点中都不出现(AM-001)。2) 实际固定 SDK 合同核验并修复——tools/verify_mem0_real_hel874.py 在 mem0ai 2.2.1(2c81af3,tarball SHA256 9dcef930 复核)固定安装上实跑:before(31970c4) 构造即死(同路径第二个 QdrantClient 被固定 SDK 拒绝,RuntimeError 已留证)、search 无 user_id 过滤被 2.2.1 直接 ValueError、limit 形参被静默忽略(正确为 top_k)、search 外层+包装双记账、内部提取 LLM 不过任何闸、并发 check-then-debit 可越 cap;after 全部修复(单client=SDK 自带 vector_store.client、add(user_id=)+search(filters,top_k)、包装为唯一记账点、LlmLedgerGuard 独立 llm_ops 表 cap 默认0、EmbedLedgerGuard 改预占-落账-释放事务制含过期预占清理)并 12/12 检查通过(C1构造/C2锚点与作用域与实测开销 1 LLM+2-3嵌入/C3默认提取输入集=旧记忆与滚动history均来自此前过门批次/C3b未分享canary零出站/C4过滤与单记账/C5双cap=0时出站LLM为0/C6并发不越cap/C7关闭恢复),证据 docs/rework/hel874/{real-sdk-before.json,real-sdk-after.json,README.md}。3) 预算闸可核验——临时隔离账实测(权威三账零写入);tests/test_mem0_backend.py 以镜像真实 2.2.1 表面的假SDK 9 例覆盖:双cap=0在任何真实工作前拒绝且 LLM 零调用、失败释放预占不记账、8路并发不越cap、llm_ops 计数、e2e 原话入块。4) 八字敏感度映射如实定案——mood_runtime 的阶梯 1.25/0.8(HEL-870 自造常数)改回原仓库奠基提交 1012d8b 既有连续规则 1.35-0.70*strength(bazi.sensitivity_from_strength 唯一处),并明确标注为工程启发式、非用户批准的命理科学事实;外部智能体材料中的固定公式未被采用(discussion-takeaways-20261025 不直接照搬清单)。另交 docs/budget-plan-hel874.md(A/B/C 三部分有确定上限执行表+代码级硬闸事实+授权来源,原20-30次/100-200条仅为估算的声明)、deploy/hel874-release.md + deploy/cybergril-hel874-8360.service.example(全新空数据目录、systemd、健康能力矩阵、停用与保留数据回退,未执行)、docs/requirements/sources/comment-evidence-full-experience-20261026.json(白栖知 2026-10-26 两条原话,01a17806 与 01a1780e『完整项目体验然后慢慢迭代』,作者/时间/父评论已核,manifest 只增新条目)、runbook §4/§6/§8 与 config/semantic.example.yaml 更新(llm_cap/user_scope/实测事实)。",
|
||||
"acceptance": [
|
||||
"原话回读进真实 provider 输入:tests/test_readback_hel874.py 3 例——旧轮细节原话(gist 无编号)+角色+时间出现在捕获的模型输入、语义链命中回读锚定行原话、未分享伴侣行原话与锚点双通道零泄漏(tests/test_readback_hel874.py)",
|
||||
"实际固定 SDK 合同:verify_mem0_real_hel874.py before(31970c4) 构造失败留证、after 12/12 通过(构造/锚点/作用域/提取输入集/canary/过滤/单记账/并发/双cap=0零出站LLM/关闭恢复),证据 docs/rework/hel874/",
|
||||
"预算闸:假SDK 9 例——embed/llm cap=0 在任何真实工作前拒绝(LLM 服务器零请求)、失败释放预占零记账、并发不越 cap、llm_ops 独立计数;权威三账与冻结余额零写入(tests/test_mem0_backend.py)",
|
||||
"八字敏感度:sensitivity_from_strength=1.35-0.70*strength 为原仓库既有程序规则(1012d8b),mood_runtime 回归该规则并如实标注工程启发式;外部智能体公式未采用(src/cybergril/core/bazi.py、mood_runtime.py 注释)",
|
||||
"执行表与发布包:docs/budget-plan-hel874.md 三部分有确定上限+授权来源;deploy/hel874-release.md+systemd example 全新空目录/健康矩阵/回退,未部署未合并未交体验地址",
|
||||
"用户原话来源:sources/comment-evidence-full-experience-20261026.json 只增两条原话及来源校验,manifest 增一条,baseline/current/coverage/changes 零改动(GOV-002 不擅改完整要求)",
|
||||
"工程检查:python 3.11 venv 全套 256 项测试通过、ruff 0 错、web typecheck+vitest+build 通过;双目标需求结构检查 4/4 通过(含本 handoff)"
|
||||
],
|
||||
"deferred": [
|
||||
"统一候选独立复审与发布:由总管对最终 head 独立复审(本卡作者不自行宣布通过);通过并按 A/B 预算批准后由发布卡执行 deploy/hel874-release.md(8360 隔离实例),本卡未部署未合并 PR#11 未交体验地址",
|
||||
"真实语义激活(CYBERGRIL_SEMANTIC=mem0):待 B 部分预算批准(embed_cap/llm_cap>0)后执行;固定 venv 并入产品进程的方案由发布卡决定",
|
||||
"真实整体检查 A/B/C 三部分执行:待总管核定并向白栖知申请授权(docs/budget-plan-hel874.md);本卡零真实调用",
|
||||
"R5 语音/R6 天气、素材、备份/R7 视觉观察承接不变(runbook §7);视觉仍交原作者;HEL-835 未解闸、39/60 与 498/500 冻结不动",
|
||||
"原话回读的用户体验效果(回读量是否恰当、是否影响语气)属体验验收,待统一体验地址交付后由白栖知判断"
|
||||
],
|
||||
"requirement_changes": [],
|
||||
"verification": [
|
||||
"分支 hel-870-assembly 追加提交(最终 head 见交付评论),PR#11 更新未合并未强推;视觉总监分支未覆盖",
|
||||
"python 3.11.16 venv + requirements.lock 离线安装:256 项测试全过(新增 test_readback_hel874.py 3 例、test_mem0_backend.py 重写为真实 2.2.1 表面镜像 9 例);ruff 0 错;web typecheck/vitest/build 通过",
|
||||
"真实固定 SDK 验证:hel857-venv(3.10.12+mem0ai 2.2.1+已有 fastembed 缓存只读)实跑 before/after 双证据 JSON;零真实出站(LLM=127.0.0.1 假网关)、零权威账写入",
|
||||
"python3 scripts/check_requirements.py --base-ref origin/main [--handoff docs/requirements/handoff-HEL-874.json] 与 --base-ref origin/agent/agent/de8874a3803b [--handoff …] 四项通过"
|
||||
]
|
||||
}
|
||||
@@ -14,5 +14,6 @@
|
||||
"dynamic-sample-effect-acceptance-20261023.md": "f5e9fde65a58ebc365de47569053ad7c30ce77ae82bb78773cc070e3cbffd90e",
|
||||
"comment-evidence-mature-reuse-20261025.json": "38ca076e26477e89cd161eaadb0fb00b0ee7bb5a26de2bd6ab41de52faaae79e",
|
||||
"mature-reuse-principle-20261025.md": "a2a75e071d3af5db722727bfaf8083bb60d07dcdd74e90d1e1374c1aafd2064d",
|
||||
"other-agent-discussion-20261025.txt": "42cd97029d73eace110e49e0566343dfeb25fe4f0633a10b78b126289938aaeb"
|
||||
"other-agent-discussion-20261025.txt": "42cd97029d73eace110e49e0566343dfeb25fe4f0633a10b78b126289938aaeb",
|
||||
"comment-evidence-full-experience-20261026.json": "75dd55b8755bdad217b44c3f516c9372b046aae06dff511527014c7b209eccff"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"id": "01a17806-cb7e-76f3-8f3f-3f6360ddc668",
|
||||
"author_type": "member",
|
||||
"author_id": "e5c6c938-db48-4ff9-954f-4fb8b063a132",
|
||||
"content": "我听不懂你的意思,用大白话问我",
|
||||
"created_at": "2026-10-26T11:44:33Z",
|
||||
"parent_id": "01a174b3-867e-7a90-9628-e1abd82a71b7"
|
||||
},
|
||||
{
|
||||
"id": "01a1780e-6954-73ad-91da-3a5d81831a07",
|
||||
"author_type": "member",
|
||||
"author_id": "e5c6c938-db48-4ff9-954f-4fb8b063a132",
|
||||
"content": "我觉得这是工程问题,我不懂所以我无法抉择,但我知道截止目前,整个项目仅前端通过了我的审核,我没有现有的聊天和资料,也不存在真实或假聊天,因为一切都还没开始,我期望的是进行完整的项目体验,然后慢慢迭代,否则我根本不知道哪里是对的哪里是错的,你交由我决定的东西我认为是在原地打转或者说是在外围转圈而不是直奔核心",
|
||||
"created_at": "2026-10-26T11:52:52Z",
|
||||
"parent_id": "01a174b3-867e-7a90-9628-e1abd82a71b7"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,45 @@
|
||||
# HEL-874 · 实际固定 Mem0 SDK 合同验证证据
|
||||
|
||||
运行脚本:`tools/verify_mem0_real_hel874.py`(仓库根,用 HEL-857 的固定 venv 执行;
|
||||
零真实出站——LLM 走 127.0.0.1 确定性假网关,嵌入用已有本地 fastembed 缓存,
|
||||
账本全部写在临时目录,不触权威三账)。
|
||||
|
||||
```bash
|
||||
/home/.../hel857-venv/bin/python tools/verify_mem0_real_hel874.py docs/rework/hel874/real-sdk-after.json
|
||||
```
|
||||
|
||||
固定安装事实(两份 JSON 的 `install` 字段):mem0ai 2.2.1、qdrant-client 1.20.0、
|
||||
fastembed 0.9.1;源码 tarball SHA256 `9dcef930…dda23` 与 HEL-857 记录一致;
|
||||
关键模块逐文件 SHA256 见 JSON。
|
||||
|
||||
## 结论(before = 31970c4 原适配层,after = 本卡修复后)
|
||||
|
||||
| 检查 | before | after | 事实 |
|
||||
| --- | --- | --- | --- |
|
||||
| C1 构造 | **失败** | 通过 | before 在同一路径开第二个 QdrantClient,固定 SDK 直接拒绝:`Storage folder … is already accessed by another instance of Qdrant client`——31970c4 的 mem0 模式根本起不来。after 复用 SDK 自带 `vector_store.client`,不再另开 client。 |
|
||||
| C2 add 锚点/作用域 | 无法到达 | 通过 | metadata(src_group/turn_roles/input_sha256)逐字落进 payload;`user_id` 作用域随 add 写入。 |
|
||||
| C2 每次真实开销 | 无法到达 | 通过 | 单行 add 实测 = 1 次提取 LLM + 2–3 条嵌入(phase1 查询嵌入 + phase3 提取批嵌入 + phase7 实体 upsert 嵌入),全部经包装记账。 |
|
||||
| C3 默认提取输入集 | 无法到达 | 通过 | 第二批 add 的提取提示实测包含第一批的提取记忆(旧记忆通道)与滚动 history——二者全部只来自此前过门批次,同一可证明输入集成立。 |
|
||||
| C3b 未分享 canary | 无法到达 | 通过 | 植入主档案的未分享伴侣行经 enqueue/tick 后不出现在任何出站 LLM 请求体,也不进任何锚点。 |
|
||||
| C4 search 过滤参数 | 无法到达 | 通过 | mem0 2.2.1 对无 `user_id` 过滤的 search 直接 `ValueError`(源码 main.py:1466 起);after 恒带 `filters={"user_id": …}`。`limit=` 形参在 2.2.1 被静默忽略,正确形参是 `top_k`。 |
|
||||
| C4 单次记账 | 无法到达 | 通过 | 每次 search 恰好 +1 条嵌入(before 设计上外层+包装双记,已在 fake-SDK 测试中证明并移除)。 |
|
||||
| C5 embed_cap=0 / llm_cap=0 | 无法到达 | 通过 | 任何真实工作前拒绝:假网关在此段收到 **0** 个请求;内部 LLM 现在过独立 llm_ops 闸(默认 0)。 |
|
||||
| C6 并发预占 | 无法到达 | 通过 | 8 路并发 search 对 cap=3 临时账,落账永不越 cap(BEGIN IMMEDIATE 预占)。 |
|
||||
| C7 关闭恢复 | 无法到达 | 通过 | aclose 后同目录重建实例,数据与锚点完好。 |
|
||||
|
||||
## 判定为真实缺陷并已修复的项(来源:固定安装源码核对 + 本脚本实跑复现)
|
||||
|
||||
1. 同路径双 QdrantClient → 构造即死(before JSON 的 trace)。
|
||||
2. 无过滤 search → 2.2.1 ValueError;`limit` 形参被忽略。
|
||||
3. search 外层+包装双记账。
|
||||
4. 内部提取 LLM 不过任何请求闸/账(embed 闸为 0 时也拦不住 LLM——本卡前
|
||||
LLM 先于嵌入扣账的说法不成立:实测 phase1 嵌入在前,但 LLM 从未被计入
|
||||
任何账)。
|
||||
5. 并发 check-then-debit 竞态可越 cap;失败/取消不回滚预占。
|
||||
|
||||
## 未发现问题的项(如实记录)
|
||||
|
||||
- 真实 fastembed `embed(text, memory_action)` / `embed_batch(texts, memory_action)`
|
||||
表面与适配层包装完全吻合(计数=落账)。
|
||||
- metadata 锚点在真实 qdrant payload 中逐字往返。
|
||||
- 滚动 history(save_messages 10 条窗)只含本产品此前 add 的原始消息。
|
||||
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"started": "2026-10-26T14:02:45Z",
|
||||
"install": {
|
||||
"python": "3.10.12",
|
||||
"mem0ai": "2.2.1",
|
||||
"qdrant-client": "1.20.0",
|
||||
"fastembed": "0.9.1",
|
||||
"mem0_path": "/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/mem0",
|
||||
"module_sha256": {
|
||||
"memory/main.py": "f329ca4a17af1fbefb32ac10d4cc7ae7ddbdb7435a87eb74c30915cff98b8b7c",
|
||||
"memory/storage.py": "5f5ecdadd2b260fd14f36a0f338336eb760275465dd1056a99a47e1ef07702bd",
|
||||
"embeddings/fastembed.py": "3ec2ae87df5d0bebedb8b5471366c3412975847458499f66097f7b8c9ac8c9b8",
|
||||
"llms/openai.py": "37e6d3c22b55df0731740f4e0868b95bd480ce44363227fe53461db328c5f67e",
|
||||
"vector_stores/qdrant.py": "da570579d5cad69e6f123fdfe32b725235a25604e70047666bec763ba6e2bf43"
|
||||
},
|
||||
"source_tarball_sha256": "9dcef9303ebcec116eec6739f01b8b35bd24459de6a569686b4d19b9412dda23"
|
||||
},
|
||||
"adapter_has_llm_guard": true,
|
||||
"checks": [
|
||||
{
|
||||
"name": "C1_construct",
|
||||
"ok": true,
|
||||
"detail": "client_path=sdk-vector-store-client"
|
||||
},
|
||||
{
|
||||
"name": "C2_add_anchor_payload",
|
||||
"ok": true,
|
||||
"detail": "created=True payload_keys=['created_at', 'data', 'hash', 'input_sha256', 'src_group', 'text_lemmatized', 'turn_ids', 'turn_roles']"
|
||||
},
|
||||
{
|
||||
"name": "C2_add_user_scope",
|
||||
"ok": true,
|
||||
"detail": "user_id present in stored payload"
|
||||
},
|
||||
{
|
||||
"name": "C2_add_ledger_shape",
|
||||
"ok": true,
|
||||
"detail": "embed_items=3 llm_calls=1"
|
||||
},
|
||||
{
|
||||
"name": "C3_extraction_input_set",
|
||||
"ok": true,
|
||||
"detail": "old_memory=True new_row=True history_carry=True"
|
||||
},
|
||||
{
|
||||
"name": "C3b_unshared_canary_never_outbound",
|
||||
"ok": true,
|
||||
"detail": "queued_public_batches=2 leaked=False anchor_taint=False"
|
||||
},
|
||||
{
|
||||
"name": "C4_search_filters",
|
||||
"ok": true,
|
||||
"detail": "hits=3"
|
||||
},
|
||||
{
|
||||
"name": "C4_search_single_debit",
|
||||
"ok": true,
|
||||
"detail": "embed_delta=1 (pre-fix=2)"
|
||||
},
|
||||
{
|
||||
"name": "C6_concurrency_cap",
|
||||
"ok": true,
|
||||
"detail": "outcomes=['ok', 'refused'] used=3 cap=3"
|
||||
},
|
||||
{
|
||||
"name": "C7_reopen_after_close",
|
||||
"ok": true,
|
||||
"detail": "hits_after_reopen=3"
|
||||
},
|
||||
{
|
||||
"name": "C5_embed_zero_refuses",
|
||||
"ok": true,
|
||||
"detail": "err=semantic_embed_budget_not_approved llm_sent=0"
|
||||
},
|
||||
{
|
||||
"name": "C5_llm_zero_refuses",
|
||||
"ok": true,
|
||||
"detail": "err=semantic_llm_budget_not_approved llm_sent=0"
|
||||
}
|
||||
],
|
||||
"embed_rows_after_first_add": [
|
||||
{
|
||||
"kind": "dense",
|
||||
"items": 1,
|
||||
"note": "product:search"
|
||||
},
|
||||
{
|
||||
"kind": "dense",
|
||||
"items": 1,
|
||||
"note": "product:batch:add"
|
||||
},
|
||||
{
|
||||
"kind": "dense",
|
||||
"items": 1,
|
||||
"note": "product:add"
|
||||
}
|
||||
],
|
||||
"finished": "2026-10-26T14:02:47Z",
|
||||
"gateway_requests_total": 3,
|
||||
"failures": []
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"started": "2026-10-26T14:02:48Z",
|
||||
"install": {
|
||||
"python": "3.10.12",
|
||||
"mem0ai": "2.2.1",
|
||||
"qdrant-client": "1.20.0",
|
||||
"fastembed": "0.9.1",
|
||||
"mem0_path": "/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/mem0",
|
||||
"module_sha256": {
|
||||
"memory/main.py": "f329ca4a17af1fbefb32ac10d4cc7ae7ddbdb7435a87eb74c30915cff98b8b7c",
|
||||
"memory/storage.py": "5f5ecdadd2b260fd14f36a0f338336eb760275465dd1056a99a47e1ef07702bd",
|
||||
"embeddings/fastembed.py": "3ec2ae87df5d0bebedb8b5471366c3412975847458499f66097f7b8c9ac8c9b8",
|
||||
"llms/openai.py": "37e6d3c22b55df0731740f4e0868b95bd480ce44363227fe53461db328c5f67e",
|
||||
"vector_stores/qdrant.py": "da570579d5cad69e6f123fdfe32b725235a25604e70047666bec763ba6e2bf43"
|
||||
},
|
||||
"source_tarball_sha256": "9dcef9303ebcec116eec6739f01b8b35bd24459de6a569686b4d19b9412dda23"
|
||||
},
|
||||
"adapter_has_llm_guard": false,
|
||||
"checks": [
|
||||
{
|
||||
"name": "C1_construct",
|
||||
"ok": false,
|
||||
"detail": "RuntimeError: Storage folder /tmp/multica-task-4220825970/hel874-real-sdk-3tml6wtr/vec/vec_public is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead."
|
||||
}
|
||||
],
|
||||
"trace": "Traceback (most recent call last):\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/portalocker/portalocker.py\", line 1008, in lock\n self.locker(fd, flags)\nBlockingIOError: [Errno 11] Resource temporarily unavailable\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/qdrant_client/local/qdrant_local.py\", line 178, in _load\n portalocker.lock(\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/portalocker/portalocker.py\", line 1151, in lock\n _posix_locker_instance.lock(file, flags)\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/portalocker/portalocker.py\", line 1011, in lock\n raise exceptions.AlreadyLocked(\nportalocker.exceptions.AlreadyLocked: (BlockingIOError(11, 'Resource temporarily unavailable'), '[Errno 11] Resource temporarily unavailable')\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/tmp/multica-task-4220825970/opencode/before-31970c4/tools/verify_mem0_real_hel874.py\", line 222, in main_async\n backend = Mem0Backend(config_for(tmp, ledger, port=port, cap=64, llm_cap=32))\n File \"/tmp/multica-task-4220825970/opencode/before-31970c4/src/cybergril/memory/semantic.py\", line 163, in __init__\n self._memory = Memory.from_config(\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/mem0/memory/main.py\", line 737, in from_config\n return cls(config)\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/mem0/memory/main.py\", line 496, in __init__\n self.vector_store = VectorStoreFactory.create(\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/mem0/utils/factory.py\", line 216, in create\n return vector_store_instance(**config)\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/mem0/vector_stores/qdrant.py\", line 81, in __init__\n self.client = QdrantClient(**params)\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/qdrant_client/qdrant_client.py\", line 130, in __init__\n self._client = QdrantLocal(\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/qdrant_client/local/qdrant_local.py\", line 91, in __init__\n self._load()\n File \"/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-venv/lib/python3.10/site-packages/qdrant_client/local/qdrant_local.py\", line 183, in _load\n raise RuntimeError(\nRuntimeError: Storage folder /tmp/multica-task-4220825970/hel874-real-sdk-3tml6wtr/vec/vec_public is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead.\n",
|
||||
"finished": "2026-10-26T14:02:49Z",
|
||||
"gateway_requests_total": 0,
|
||||
"failures": [
|
||||
"C1_construct: RuntimeError: Storage folder /tmp/multica-task-4220825970/hel874-real-sdk-3tml6wtr/vec/vec_public is already accessed by another instance of Qdrant client. If you require concurrent access, use Qdrant server instead."
|
||||
]
|
||||
}
|
||||
+16
-7
@@ -36,8 +36,15 @@ PYTHONPATH=src .venv311/bin/python -m uvicorn cybergril.api.app:create_app \
|
||||
## 4. 真实 Mem0 通道(需预算批准后启用)
|
||||
|
||||
1. 固定安装复用:mem0ai 2.2.1(源码提交 `2c81af3bbe27d9bccb09c772d583df9e9be72ee5`)独立 venv(HEL-857 已建,`hel857-venv`);产品进程需能 import 该包(部署卡决定合入产品 venv 或 venv 合并方案,不 fork 上游)。
|
||||
2. `cp config/semantic.example.yaml config/semantic.yaml`,由总管按批准值填 `embed_cap`(>0 才会放行任何真实嵌入);账本指向唯一权威 `embed_ledger.sqlite3` 续账。
|
||||
3. `CYBERGRIL_SEMANTIC=mem0` 重启。任何未批预算的嵌入调用都会 fail-closed 拒绝(`semantic_embed_budget_not_approved/exhausted`),不会碰 498/500 冻结余额。
|
||||
2. `cp config/semantic.example.yaml config/semantic.yaml`,由总管按批准值填 `embed_cap`/`llm_cap`(>0 才会放行任何真实嵌入/内部提取 LLM);账本指向唯一权威 `embed_ledger.sqlite3` 续账(`llm_ops` 同库新表,独立 cap)。
|
||||
3. `CYBERGRIL_SEMANTIC=mem0` 重启。任何未批预算的嵌入或内部 LLM 调用都 fail-closed 拒绝(`semantic_embed/llm_budget_not_approved/exhausted`),不会碰 498/500 冻结余额。
|
||||
|
||||
**HEL-874 实测接线事实(docs/rework/hel874/,固定安装本体验证)**:
|
||||
mem0 2.2.1 拒绝同路径第二个 QdrantClient(旧适配层构造即死,已改走 SDK 自带
|
||||
client);search 必须带 `user_id` 过滤且 `top_k` 才是有效形参(`limit` 被静默忽略);
|
||||
每次 search 恰好 1 条嵌入记账(旧外层+包装双记已移除);SDK 内部提取 LLM 已过
|
||||
独立闸并计数;并发预占不越 cap;`embed_cap=0`/`llm_cap=0` 时出站 LLM 为 0。
|
||||
单行 add 实测开销:1 次提取 LLM + 2–3 条嵌入(查询/提取批/实体 upsert)。
|
||||
|
||||
## 5. 体验链路清单(按用户实际体验顺序;只有实际能力标已接)
|
||||
|
||||
@@ -45,7 +52,7 @@ PYTHONPATH=src .venv311/bin/python -m uvicorn cybergril.api.app:create_app \
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | 打开入口 → 无档案正常创建(名字/生日/时辰/关系,AM-002/003/CG-012) | 已接 | `/api/companion`;出生底色四柱+解释空间(UX-004/CG-013–015),创建时生成自主诠释与初始习惯 |
|
||||
| 2 | 与她文字对话(真实传输接口,SSE 流式) | 已接(真实模型网关 .11:8731) | 每轮供给底色/诠释/成长/情绪词/关系提示;近 20 轮+预算内历史 |
|
||||
| 3 | 原话与记忆写入 → 回忆页 | 已接 | R3 主档案+gist;回忆页仅显示过门公开条目 |
|
||||
| 3 | 原话与记忆写入 → 回忆页 | 已接 | R3 主档案+gist;回忆页仅显示过门公开条目。**HEL-874:记忆回读原话优先**——FTS 与语义两条检索通道都把命中原话(含角色与时间)有界注入模型输入,不再只给 120 字摘要(tests/test_readback_hel874.py 用真实 provider 输入捕获证明) |
|
||||
| 4 | 她的生活(后台 4 槽/天,活动延续/打断/恢复) | 已接(同 2 的真实网关) | 日子页只显示她讲过的(AM-001);未分享内容服务器侧裁剪 |
|
||||
| 5 | 情绪与关系真实接线 | 已接 | 事件推动情绪(方程持久化、重启恢复);对话累计亲密/信任;模型只见一个词与行为指令 |
|
||||
| 6 | 主动联系(网页内留言,R4 批准参数) | 已接(真实网关生成措辞) | 间隔≥6h、8–23 点、显著度≥0.6、唤醒≥0.5、亲密≥0.4;有真实已公开依据;关页积累、回来可见;缺席不武器化;不重复 |
|
||||
@@ -58,11 +65,12 @@ PYTHONPATH=src .venv311/bin/python -m uvicorn cybergril.api.app:create_app \
|
||||
|
||||
没有任何按钮或字幕假装存在未接能力;未接项在界面保持既有诚实文案。
|
||||
|
||||
## 6. 真实整体冒烟预算申请(交总管核定;与用户日常使用预算分开)
|
||||
## 6. 真实整体检查预算(有确定上限的执行表)
|
||||
|
||||
- 一次性冒烟(隔离空库、非用户档案):创建+诠释 1 次、对话 6–8 轮(含主动消息 1–2 次措辞)、生活槽 4 次、分享判定/成长/ gist 若干(约 6 次)、合计约 **20–30 次真实请求**(.11:8731 网关,HEL-857 的 60 次授权不含本产品环境;需总管明确本轮来源与上限)。
|
||||
- 语义层激活(如批准):每公开轮 1 次提取(LLM)+ 每条 1 嵌入 + 每次查询 1 嵌入;首周估计 **约 100–200 条嵌入**——当前权威账 498/500 冻结,需按 HEL-869 §6.1 由白栖知决定提高上限或另批独立账。
|
||||
- 日常使用预算模型(参考,供核定):轻使用约 20–40 请求/天 + 15–30 嵌入/天。
|
||||
**以 `docs/budget-plan-hel874.md` 为准**(A 一次性团队检查 55 请求/0 嵌入;
|
||||
B 首周语义激活 ≤60 提取 LLM/≤180 嵌入;C 用户日常逐项日顶)。本节原
|
||||
「20–30 次请求 / 100–200 条嵌入」仅为历史估算,**不构成已批准额度**;
|
||||
三部分独立账本与授权来源见该表;本卡零真实调用,冻结余额不挪用。
|
||||
|
||||
## 7. R1–R7 承接与立即可派工范围
|
||||
|
||||
@@ -78,3 +86,4 @@ PYTHONPATH=src .venv311/bin/python -m uvicorn cybergril.api.app:create_app \
|
||||
- 本运行环境仅有 Python 3.10(产品需 ≥3.11);测试用 uv 离线缓存的 3.11.16 venv + `requirements.lock` 完成(无新增下载)。系统 python3.10 下与 `asyncio.timeout` 相关的既有用例会失败,属环境版本差异,非本卡回归。
|
||||
- .11:8731 网关从本运行环境可达(health 探活 ok,未发对话请求)。
|
||||
- 服务器 .12 只读核实(未触任何服务):cybergril-api(8310)/hel822(8320)/hel829(8340)/hel835(8350, guarded)/S1 web 均运行中;8090(音色管理)、8081(历史口型试验件)监听存在;/opt/voice-agent 存在。端到端语音可用性未验证,不以监听存在冒充服务可用。
|
||||
- HEL-874 真实 SDK 验证环境:hel857-venv(Python 3.10.12 + mem0ai 2.2.1 固定安装)与已有 fastembed 模型缓存(只读复用,零下载);LLM 走 127.0.0.1 确定性假网关,账本全在临时目录,权威三账零写入。证据 `docs/rework/hel874/`。
|
||||
|
||||
Reference in New Issue
Block a user