diff --git a/docs/requirements/handoff-HEL-879.json b/docs/requirements/handoff-HEL-879.json new file mode 100644 index 0000000..352d7f2 --- /dev/null +++ b/docs/requirements/handoff-HEL-879.json @@ -0,0 +1,33 @@ +{ + "baseline_version": "1.11", + "read_commit": "c121c42e39174e0f627f129e7f7e5700f33acf26", + "task": "HEL-879 双职责一次交付:A) HEL-896 发布工具四项有限收口(总管独立复核清单)——①归档一致性强制:checkpoint busy 或源/快照行数不一致一律 CLI 非0、不形成可交付包,verify 拒绝 rows_match=False 旧包并按源路径映射做真实回退演练(解包隔离目录、实开各库核行数与哈希),自测 9/9 先复现旧失败形状再证修复;②目录内真实 SQLite(history_root/mem0_public_history.db 等)停服口径递归走 checkpoint+逐表核对,在线模式仅显式单库 backup API、含 SQLite 目录直接拒绝;③提前封账可执行:PersistentBudget.sealed()/seal() 原子写封账标记(真实用量保留不伪造不清零),acquire 首查封账(budget_sealed:51/55),跨重启/backup 归档恢复均拒绝、重复 seal 幂等、无解封路径,tools/seal_budget_hel879.py 为显式关闭命令,S6 负例(51/55 提前收尾、误重启、归档恢复、日顶有余量仍拒)并入 verify_budget_split 10/10;④安装入口唯一:hel895-release-candidate.md §2 全 offline 自足安装、§4 五步固定 SDK 入口(tarball 哈希→固定源构建→cp311 备产→仅本地轮→co-import),hel874-release.md §2/§4 标注被取代,mem0-stack.lock 的 mem0ai 行只作版本记录,audit 工具 head 动态化+证据目录可重定向,新证据 docs/rework/hel879/{sdk-audit,release-artifacts.json}。B) 统一语音候选隔离整合:hel-879-assembly 分支 = c121c42 + 发布收口(01ff919) + 语音后台 aba2aeb + 语音前端 c61d9c9(原作者 web/src 逐字节保留,CSS 哈希变化仅原作者 components.css +21 行),语音适配器测试对齐主线 HEL-882 硬闸(engineering_budget,不改产品门),全电池在该 head 实跑:pytest 324/324(299 主线+25 语音)、ruff 干净、web typecheck 0 错/lint 0 错1既有警告/vitest 88/88/build 通过、真实服务浏览器 9/9(零权限调用、零非回环出站,证据 docs/rework/hel879/browser/)、verify_hel877_voice_chain 8/8、.12 真SDK stdin 检查 8/8 ALL PASS(零写入零网络)、check_release_offline R1-R7、固定SDK回归 16/16+12/12+6/6+7/7+12/12。零真实 LLM/嵌入/ASR/TTS、零下载、零麦克风、未启动/停止任何服务、不部署、不合并 PR、PR#11 与 hel-870-assembly 未动、权威账与冻结未写、真实 cap 保持 0", + "requirement_ids": ["CG-006", "CG-008", "CG-009", "CG-010", "CG-011", "CG-012", "CG-013", "CG-014", "CG-015", "CG-016", "CG-018", "CG-021", "CG-023", "CG-029", "CG-030", "CG-031", "VIS-013", "AM-001", "AM-002", "AM-003", "UX-001", "UX-005", "UX-006", "GOV-001", "GOV-002", "GOV-003", "GOV-004", "GOV-005", "GOV-006", "DEL-001"], + "deliverable": "分支 hel-879-assembly(独立候选,未入 PR#11):发布收口 tools/release_snapshot_hel896.py v2(强制一致性+回退演练)、src/cybergril/life/model.py 封账(sealed/seal/acquire 首查)、tools/seal_budget_hel879.py、tools/verify_budget_split_hel896.py S6、tools/audit_sdk_offline_hel896.py head 动态化、deploy/hel895-release-candidate.md §0/§2/§4/§5 唯一入口、deploy/hel874-release.md §2/§4 取代标注、deploy/mem0-stack.lock 注释收口、docs/budget-package-hel895.md §6.2 可执行封账;语音整合:aba2aeb 后台模块 + c61d9c9 前端(原作者视觉逐字节保留)合并入候选,测试对齐主线硬闸;证据 docs/rework/hel879/{release-snapshot/selftest.json,sdk-audit/,release-artifacts.json,browser/,release-check/,regression-*.json}", + "acceptance": [ + "归档负例:busy checkpoint(复现 checkpoint=(1,9,8))与行数不一致均失败且零残留产物;rows_match=False 旧包 verify 拒绝;停服口径目录内 SQLite 逐表核对(history=1);在线模式含 SQLite 目录拒绝;verify 输出源路径 rollback_plan", + "封账负例:51/55 提前收尾后任何类别拒绝 budget_sealed:51/55 且用量保持 51;误重启拒绝;backup 归档恢复拒绝;重复 seal 幂等(sealed_at 不变);拒绝不落账", + "seal_budget_hel879.py 端到端:封账→自检 acquire 被拒→CLI ok=true", + "整合后全电池:pytest 324/324、vitest 88/88、typecheck/lint/build、真实服务浏览器 9/9(含零权限/零非回环出站)、语音链 8/8、.12 真SDK 8/8、R1-R7、固定SDK五套回归全绿", + "原作者前端逐字节保留:git diff c61d9c9 HEAD -- web/src 为空;后台 voice 模块 diff aba2aeb 为空" + ], + "deferred": [ + "真实通话验收(连续≥3轮、1秒开口打断、结束即停麦、无旧残音、断网清理、重开同档案):真实调用/D1音色/可信HTTPS设备路径/预算上限未获批,待主卡一次申请", + "会话到期/API重启后 LiveKit 房间与 worker 真实释放证据:_prune 仅删内存登记、end_session 有 delete_room,但『重启房间自然消亡』需真实环境验证,未测不冒充", + "增量字幕(worker 仅 final,interim 契约缺口):R5 字幕先行与完整产品要求不降级", + "CG-011 语音主动开口仍为显式 no-op 接缝", + "R6 天气/素材/每日与手动完整备份、R7 有条件观察:继续主卡承接", + "固定 SDK 真缺下载(37 项+hatchling)与 A/B/C 预算授权:待总管主卡一次申请", + "产品 PR#4、旧小样 PR#6、新小样 PR#8、发布 PR#11 均未合并未替换正式界面" + ], + "requirement_changes": [], + "verification": [ + "docs/rework/hel879/release-snapshot/selftest.json(9/9,先复现旧失败形状再证修复)", + "docs/rework/hel896/budget-split/budget-split.json(10/10 含 S6 提前封账负例,本 head 重跑)", + "docs/rework/hel879/sdk-audit/ 与 release-artifacts.json(闭包 55/缺 41/可复用 3,tarball 哈希实测=lock,精确提交)", + "docs/rework/hel879/browser/real-browser.json(9/9 真实服务浏览器,零权限调用、零非回环出站)", + "docs/rework/hel879/release-check/hel882-release-check.json(R1-R7)与 regression-*.json(固定SDK 16/16、12/12、6/6、7/7、12/12)", + ".12 livekit-agents 1.8.8 真 SDK stdin 检查 8/8 ALL PASS(零写入零网络,输出在运行日志)", + "未验证:真机/Safari/真实通话/部署环境;工程检查不代表用户体验验收" + ] +} diff --git a/docs/rework/hel879/browser/real-boot.png b/docs/rework/hel879/browser/real-boot.png new file mode 100644 index 0000000..45ad44e Binary files /dev/null and b/docs/rework/hel879/browser/real-boot.png differ diff --git a/docs/rework/hel879/browser/real-browser.json b/docs/rework/hel879/browser/real-browser.json new file mode 100644 index 0000000..92ea795 --- /dev/null +++ b/docs/rework/hel879/browser/real-browser.json @@ -0,0 +1,12 @@ +{ + "ok": true, + "checks": 9, + "fail_count": 0, + "netguard": { + "guard_loaded": true, + "nonloopback_connect_attempts": 0, + "nonloopback_dns_lookups": 0, + "rejected": [] + }, + "service_epoch_isolation": "CYBERGRIL_MODELS loopback, caps 0, socket guard rejecting non-loopback" +} \ No newline at end of file diff --git a/docs/rework/hel879/browser/real-card.png b/docs/rework/hel879/browser/real-card.png new file mode 100644 index 0000000..795c091 Binary files /dev/null and b/docs/rework/hel879/browser/real-card.png differ diff --git a/docs/rework/hel879/browser/real-gap.png b/docs/rework/hel879/browser/real-gap.png new file mode 100644 index 0000000..9bfaafc Binary files /dev/null and b/docs/rework/hel879/browser/real-gap.png differ diff --git a/docs/rework/hel879/browser/real-record.png b/docs/rework/hel879/browser/real-record.png new file mode 100644 index 0000000..129e461 Binary files /dev/null and b/docs/rework/hel879/browser/real-record.png differ diff --git a/docs/rework/hel879/browser/real-stage.png b/docs/rework/hel879/browser/real-stage.png new file mode 100644 index 0000000..303bd1c Binary files /dev/null and b/docs/rework/hel879/browser/real-stage.png differ diff --git a/docs/rework/hel879/regression-close-ownership.json b/docs/rework/hel879/regression-close-ownership.json new file mode 100644 index 0000000..bd48115 --- /dev/null +++ b/docs/rework/hel879/regression-close-ownership.json @@ -0,0 +1,215 @@ +{ + "head": "HEL-894 close ownership under cancellation", + "real_llm_requests": 0, + "real_embeddings": 0, + "boundary": "deterministic 512 vectors, non-loopback forbidden", + "protocol": "drain-phase cancel re-arms; finish-phase cancel keeps markers, refuses ticks, lands the layer-owned close exactly once; lock waiters never touch the owner's state", + "checks": [ + { + "name": "F1 cancelled caller does not return before its close lands", + "ok": true, + "detail": "" + }, + { + "name": "F1 markers stay: closing set, not yet closed, client untouched", + "ok": true, + "detail": "{\"closing\": true, \"closed\": false, \"client_usable\": true}" + }, + { + "name": "F1 tick during closing claims nothing and sends nothing", + "ok": true, + "detail": "{\"gateway_arrived\": false, \"gateway_posts\": 0, \"llm_used\": 0, \"batch\": {\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null}}" + }, + { + "name": "F1 layer-owned close lands exactly once, no live workers", + "ok": true, + "detail": "{\"closed\": true, \"client_usable\": false, \"live_workers\": 0, \"close_calls\": 1, \"closing_still_set\": true, \"batch\": {\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null}}" + }, + { + "name": "F1 no late error", + "ok": true, + "detail": "None" + }, + { + "name": "F1 reopened batch intact and unbilled", + "ok": true, + "detail": "{\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null, \"row_done\": 0, \"llm_used\": 0}" + }, + { + "name": "F2 cancelled caller does not return before its close lands", + "ok": true, + "detail": "" + }, + { + "name": "F2 markers stay: closing set, not yet closed, client untouched", + "ok": true, + "detail": "{\"closing\": true, \"closed\": false, \"client_usable\": true}" + }, + { + "name": "F2 tick during closing claims nothing and sends nothing", + "ok": true, + "detail": "{\"gateway_arrived\": false, \"gateway_posts\": 0, \"llm_used\": 0, \"batch\": {\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null}}" + }, + { + "name": "F2 layer-owned close lands exactly once, no live workers", + "ok": true, + "detail": "{\"closed\": true, \"client_usable\": false, \"live_workers\": 0, \"close_calls\": 1, \"closing_still_set\": true, \"batch\": {\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null}}" + }, + { + "name": "F2 no late error", + "ok": true, + "detail": "None" + }, + { + "name": "F2 reopened batch intact and unbilled", + "ok": true, + "detail": "{\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null, \"row_done\": 0, \"llm_used\": 0}" + }, + { + "name": "W owner close still pending, waiter cancel keeps the signal", + "ok": true, + "detail": "{\"active_close_pending\": true, \"signal_after_waiter_cancel\": true}" + }, + { + "name": "W new batch refused during the owner's close", + "ok": true, + "detail": "{\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null}" + }, + { + "name": "W original batch still actively owned while blocked", + "ok": true, + "detail": "{\"state\": \"pending\", \"reason\": null, \"owner\": \"a6173b4a79a84dbd6378281c17b23127\", \"attempts\": 1, \"entry_ids\": null}" + }, + { + "name": "W original worker completes, one close, new batch untouched", + "ok": true, + "detail": "{\"original_batch\": {\"state\": \"done\", \"reason\": null, \"owner\": null, \"attempts\": 1, \"entry_ids\": \"[\\\"494b27cf-6e99-4e9a-ad17-bc4c9d2f42ec\\\"]\"}, \"new_batch_still\": {\"state\": \"queued\", \"reason\": null, \"owner\": null, \"attempts\": 0, \"entry_ids\": null}, \"row_done\": 1, \"gateway_posts_after_release\": 1, \"client_closed\": true}" + } + ], + "finish_cancel_sdk_only": { + "caller_done_after_cancel": false, + "after_cancellation": { + "closing": true, + "closed": false, + "client_usable": true + }, + "tick_during_closing": { + "gateway_arrived": false, + "gateway_posts": 0, + "llm_used": 0, + "batch": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null + } + }, + "finish_landed": { + "closed": true, + "client_usable": false, + "live_workers": 0, + "close_calls": 1, + "closing_still_set": true, + "batch": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null + } + }, + "late_worker_error": null, + "persisted": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null, + "row_done": 0, + "llm_used": 0 + } + }, + "finish_cancel_then_store_close": { + "caller_done_after_cancel": false, + "after_cancellation": { + "closing": true, + "closed": false, + "client_usable": true + }, + "tick_during_closing": { + "gateway_arrived": false, + "gateway_posts": 0, + "llm_used": 0, + "batch": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null + } + }, + "finish_landed": { + "closed": true, + "client_usable": false, + "live_workers": 0, + "close_calls": 1, + "closing_still_set": true, + "batch": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null + } + }, + "late_worker_error": null, + "persisted": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null, + "row_done": 0, + "llm_used": 0 + } + }, + "waiter_cancel": { + "active_close_pending": true, + "signal_after_waiter_cancel": true, + "new_batch_during_closing": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null + }, + "original_batch_while_blocked": { + "state": "pending", + "reason": null, + "owner": "a6173b4a79a84dbd6378281c17b23127", + "attempts": 1, + "entry_ids": null + }, + "after_release": { + "original_batch": { + "state": "done", + "reason": null, + "owner": null, + "attempts": 1, + "entry_ids": "[\"494b27cf-6e99-4e9a-ad17-bc4c9d2f42ec\"]" + }, + "new_batch_still": { + "state": "queued", + "reason": null, + "owner": null, + "attempts": 0, + "entry_ids": null + }, + "row_done": 1, + "gateway_posts_after_release": 1, + "client_closed": true + } + }, + "failures": [] +} \ No newline at end of file diff --git a/docs/rework/hel879/regression-inflight.json b/docs/rework/hel879/regression-inflight.json new file mode 100644 index 0000000..9df024d --- /dev/null +++ b/docs/rework/hel879/regression-inflight.json @@ -0,0 +1,40 @@ +{ + "head": "HEL-886 inflight lifecycle", + "real_llm_requests": 0, + "real_embeddings": 0, + "boundary": "deterministic 512 vectors, non-loopback forbidden", + "checks": [ + { + "name": "L1_cancel_single_send_and_full_record", + "ok": true, + "detail": "arrived=1 concurrent=1 http_total=1 points=1 batch_live={'state': 'pending', 'owner': '9a6afb62871305fe6c7a056acf0b8797'} batch_concurrent=pending final={'state': 'done', 'reason': None, 'entry_ids': '[\"9838ab55-15ab-4872-b7cd-1ba91faea2d7\"]'} row_done=1" + }, + { + "name": "L2_lease_single_send_and_full_record", + "ok": true, + "detail": "arrived=1 concurrent=1 http_total=1 points=1 batch_live={'state': 'pending', 'owner': '8f42725681bcfda7043797c128eb0750'} batch_concurrent=pending final={'state': 'done', 'reason': None, 'entry_ids': '[\"e71ba931-650f-40a3-b571-5945829f6f7c\"]'} row_done=1" + }, + { + "name": "L3_shutdown_drains_live_worker_before_close", + "ok": true, + "detail": "arrived=1 waited=0.25s row_done_at=2000000 batch={'state': 'done', 'finished_at': 2000000}" + }, + { + "name": "L4a_all_done_finalizes_without_new_budget", + "ok": true, + "detail": "before={'state': 'done', 'entry_ids': '[\"80c8cb6b-e437-478c-a3fb-46d386ac9a07\"]'} after={'state': 'done', 'reason': None, 'entry_ids': '[\"80c8cb6b-e437-478c-a3fb-46d386ac9a07\"]'} http=1 llm_used=1" + }, + { + "name": "L4b_partial_keeps_the_hard_gate", + "ok": true, + "detail": "after={'state': 'queued', 'reason': 'semantic_llm_budget_exhausted'} http=0" + }, + { + "name": "L5_dead_owner_lease_still_recovers", + "ok": true, + "detail": "recovered={'state': 'failed', 'reason': 'lease_expired'} after={'state': 'done'} http=2" + } + ], + "gateway_requests_total": 7, + "failures": [] +} \ No newline at end of file diff --git a/docs/rework/hel879/regression-mem0-real.json b/docs/rework/hel879/regression-mem0-real.json new file mode 100644 index 0000000..123d498 --- /dev/null +++ b/docs/rework/hel879/regression-mem0-real.json @@ -0,0 +1,172 @@ +{ + "started": "2026-10-26T19:35:46Z", + "embedding_boundary": "deterministic 512-dimensional vectors installed before TextEmbedding construction; no model loaded; zero real embeddings", + "external_network": "socket.connect rejects all non-loopback hosts", + "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": "authority_prefix", + "items": 0, + "note": "authority:synthetic-verify-prefix" + }, + { + "kind": "dense", + "items": 1, + "note": "product:search" + }, + { + "kind": "dense", + "items": 1, + "note": "product:batch:add" + }, + { + "kind": "dense", + "items": 1, + "note": "product:add" + } + ], + "final_embed_rows": [ + { + "kind": "authority_prefix", + "items": 0, + "note": "authority:synthetic-verify-prefix" + }, + { + "kind": "dense", + "items": 1, + "note": "product:search" + }, + { + "kind": "dense", + "items": 1, + "note": "product:batch:add" + }, + { + "kind": "dense", + "items": 1, + "note": "product:add" + }, + { + "kind": "dense", + "items": 1, + "note": "product:search" + }, + { + "kind": "dense", + "items": 1, + "note": "product:batch:add" + }, + { + "kind": "dense", + "items": 1, + "note": "product:add" + }, + { + "kind": "dense", + "items": 1, + "note": "product:search" + }, + { + "kind": "dense", + "items": 1, + "note": "product:batch:add" + }, + { + "kind": "dense", + "items": 1, + "note": "product:add" + }, + { + "kind": "dense", + "items": 1, + "note": "product:search" + }, + { + "kind": "dense", + "items": 1, + "note": "product:search" + } + ], + "final_llm_used": 3, + "finished": "2026-10-26T19:35:47Z", + "gateway_requests_total": 3, + "failures": [], + "temp_dir": "/tmp/multica-task-29494715/hel874-real-sdk-8dkofioe" +} \ No newline at end of file diff --git a/docs/rework/hel879/regression-semantic-recovery.json b/docs/rework/hel879/regression-semantic-recovery.json new file mode 100644 index 0000000..40f4422 --- /dev/null +++ b/docs/rework/hel879/regression-semantic-recovery.json @@ -0,0 +1,45 @@ +{ + "head": "HEL-885 rework", + "real_llm_requests": 0, + "real_embeddings": 0, + "boundary": "deterministic 512 vectors, non-loopback forbidden", + "checks": [ + { + "name": "S0_positive_caps_without_authority_fail_closed", + "ok": true, + "detail": "missing=ledger_authority_required empty=ledger_authority_required" + }, + { + "name": "S1_p1_first_tick_partial", + "ok": true, + "detail": "state=queued reason=LLM extraction failed: semantic_llm_budget_exhausted http=1 completed=[2] points=1 per_row_anchor=True" + }, + { + "name": "S2_p1_restart_sends_only_missing_row", + "ok": true, + "detail": "state=done http=1 user_sent=True completed=[1, 2] entry_ids=[\"07401cdd-4964-4c74-aab5-516ab09cf5e4\", \"4d76b52d-186c-4b21-8bfa-e81341213589\"]" + }, + { + "name": "S3a_lease_expired_batch_recovers", + "ok": true, + "detail": "recovered={'state': 'failed', 'reason': 'lease_expired'} state_after=done http=2" + }, + { + "name": "S3b_concurrent_ticks_single_send", + "ok": true, + "detail": "http=2 states=['done']" + }, + { + "name": "S4a_aged_unknown_llm_reservation_kept", + "ok": true, + "detail": "second_allowed=False used_after_restart=1" + }, + { + "name": "S4b_aged_unknown_embed_reservation_kept", + "ok": true, + "detail": "second_allowed=False used=1 after_release=0" + } + ], + "gateway_requests_total": 6, + "failures": [] +} \ No newline at end of file diff --git a/docs/rework/hel879/regression-shutdown-queued.json b/docs/rework/hel879/regression-shutdown-queued.json new file mode 100644 index 0000000..9fec3b5 --- /dev/null +++ b/docs/rework/hel879/regression-shutdown-queued.json @@ -0,0 +1,182 @@ +{ + "head": "HEL-889 shutdown ownership & queued-cancel", + "real_llm_requests": 0, + "real_embeddings": 0, + "boundary": "deterministic 512 vectors, non-loopback forbidden", + "checks": [ + { + "name": "Q1 queued snapshot shows phantom-liveness", + "ok": true, + "detail": "" + }, + { + "name": "Q1 cancel releases registry and requeues", + "ok": true, + "detail": "{\"registered_workers\": 0, \"batch\": {\"state\": \"queued\", \"reason\": \"queued_worker_cancelled\", \"owner\": null, \"attempts\": 0, \"entry_ids\": null}, \"row_done\": 0, \"stored_entries\": 0}" + }, + { + "name": "Q1 in-process recovery completes without restart", + "ok": true, + "detail": "{\"batch\": {\"state\": \"done\", \"reason\": null, \"owner\": null, \"attempts\": 1, \"entry_ids\": \"[\\\"stub-1\\\"]\"}, \"registered_workers\": 0, \"stored_entries\": 1, \"row_done\": 1}" + }, + { + "name": "S1 aclose does NOT return while the worker is alive", + "ok": true, + "detail": "" + }, + { + "name": "S1 worker completes and flushes before store close", + "ok": true, + "detail": "{\"state\": \"done\", \"reason\": null, \"owner\": null, \"attempts\": 1, \"entry_ids\": \"[\\\"19039615-6f32-48e6-979b-715d2cd56fcb\\\"]\"}" + }, + { + "name": "S1 no late-worker error after honest drain", + "ok": true, + "detail": "" + }, + { + "name": "S1 durable reopen: done + row_done=1 + llm_used=1", + "ok": true, + "detail": "{\"state\": \"done\", \"reason\": null, \"owner\": null, \"attempts\": 1, \"entry_ids\": \"[\\\"19039615-6f32-48e6-979b-715d2cd56fcb\\\"]\", \"row_done\": 1, \"llm_used\": 1, \"gateway_posts\": 1}" + }, + { + "name": "S2 shutdown between rows requeues with first row proven", + "ok": true, + "detail": "{\"state\": \"queued\", \"reason\": \"shutdown_between_rows\", \"owner\": null, \"attempts\": 0, \"entry_ids\": null, \"row_done\": 1, \"gateway_posts_during_shutdown\": 1}" + }, + { + "name": "S2 resume sends ONLY the missing row and completes", + "ok": true, + "detail": "{\"state\": \"done\", \"reason\": null, \"owner\": null, \"attempts\": 1, \"entry_ids\": \"[\\\"f26d374a-858e-4dde-b2de-ae8af7057021\\\", \\\"258ab9a5-d523-45b0-ada1-d58fbda50ea7\\\"]\", \"row_done\": 2, \"gateway_posts_resume\": 2}" + }, + { + "name": "S3 cancelled aclose closes nothing and re-arms", + "ok": true, + "detail": "" + }, + { + "name": "S3 worker finishes done and a later aclose closes for real", + "ok": true, + "detail": "" + }, + { + "name": "S4 concurrent aclose drains once and closes once", + "ok": true, + "detail": "{\"batch\": {\"state\": \"done\", \"reason\": null, \"owner\": null, \"attempts\": 1, \"entry_ids\": \"[\\\"e553422c-1840-4ff4-b51c-a3586cc34179\\\"]\", \"row_done\": 1}, \"client_usable_after_close\": false}" + } + ], + "queued_cancel": { + "queued": { + "registered_workers": 1, + "product_executor_queue": 1 + }, + "after_cancel": { + "registered_workers": 0, + "batch": { + "state": "queued", + "reason": "queued_worker_cancelled", + "owner": null, + "attempts": 0, + "entry_ids": null + }, + "row_done": 0, + "stored_entries": 0 + }, + "after_recovery": { + "batch": { + "state": "done", + "reason": null, + "owner": null, + "attempts": 1, + "entry_ids": "[\"stub-1\"]" + }, + "registered_workers": 0, + "stored_entries": 1, + "row_done": 1 + } + }, + "shutdown_timeout": { + "deadline": { + "aclose_returned_while_worker_alive": false, + "batch_before_any_close": { + "state": "pending", + "reason": null, + "owner": "4a048d364194a961365c30ee1e570233", + "attempts": 1, + "entry_ids": null + }, + "client_usable": true + }, + "before_store_close": { + "state": "done", + "reason": null, + "owner": null, + "attempts": 1, + "entry_ids": "[\"19039615-6f32-48e6-979b-715d2cd56fcb\"]" + }, + "late_worker_error": null, + "persisted": { + "state": "done", + "reason": null, + "owner": null, + "attempts": 1, + "entry_ids": "[\"19039615-6f32-48e6-979b-715d2cd56fcb\"]", + "row_done": 1, + "llm_used": 1, + "gateway_posts": 1 + } + }, + "between_rows": { + "after_shutdown": { + "state": "queued", + "reason": "shutdown_between_rows", + "owner": null, + "attempts": 0, + "entry_ids": null, + "row_done": 1, + "gateway_posts_during_shutdown": 1 + }, + "after_resume": { + "state": "done", + "reason": null, + "owner": null, + "attempts": 1, + "entry_ids": "[\"f26d374a-858e-4dde-b2de-ae8af7057021\", \"258ab9a5-d523-45b0-ada1-d58fbda50ea7\"]", + "row_done": 2, + "gateway_posts_resume": 2 + } + }, + "cancelled_aclose": { + "after_cancel": { + "client_usable": true, + "batch": { + "state": "pending", + "reason": null, + "owner": "a712e0367aa123b265b47e2d3223846a", + "attempts": 1, + "entry_ids": null + }, + "closing_cleared": true + }, + "after_worker": { + "state": "done", + "reason": null, + "owner": null, + "attempts": 1, + "entry_ids": "[\"73f87468-f546-46d7-8116-37d4fe2818b1\"]" + }, + "client_usable_after_real_close": false + }, + "concurrent_aclose": { + "batch": { + "state": "done", + "reason": null, + "owner": null, + "attempts": 1, + "entry_ids": "[\"e553422c-1840-4ff4-b51c-a3586cc34179\"]", + "row_done": 1 + }, + "client_usable_after_close": false + }, + "failures": [] +} \ No newline at end of file diff --git a/docs/rework/hel879/release-artifacts.json b/docs/rework/hel879/release-artifacts.json new file mode 100644 index 0000000..59a7d42 --- /dev/null +++ b/docs/rework/hel879/release-artifacts.json @@ -0,0 +1,141 @@ +{ + "card": "HEL-879", + "generated_by": "release-artifacts inventory (offline, zero downloads)", + "release_code_commit": "01ff91985920162cddabc5f190d146d86793627d", + "audit_evidence": "docs/rework/hel879/sdk-audit/sdk-audit.json (head c121c42e39174e0f627f129e7f7e5700f33acf26)", + "single_install_entry": "deploy/hel895-release-candidate.md #4 (supersedes deploy/hel874-release.md #4)", + "fixed_source": { + "artifact": "/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-data/mem0-2c81af3.tar.gz", + "sha256": "9dcef9303ebcec116eec6739f01b8b35bd24459de6a569686b4d19b9412dda23", + "lock_record": "deploy/mem0-stack.lock: 9dcef9303ebcec116eec6739f01b8b35bd24459de6a569686b4d19b9412dda23", + "matches_lock": true, + "source_commit": "2c81af3bbe27d9bccb09c772d583df9e9be72ee5" + }, + "closure": { + "total": 55, + "missing": 41, + "missing_pure_python": [ + "backoff", + "coloredlogs", + "distro", + "fastembed", + "filelock", + "flatbuffers", + "fsspec", + "h2", + "hpack", + "httpcore2", + "httpx2", + "huggingface-hub", + "humanfriendly", + "hyperframe", + "loguru", + "mem0ai", + "mpmath", + "openai", + "portalocker", + "posthog", + "pytz", + "qdrant-client", + "requests", + "sniffio", + "sympy", + "tqdm", + "truststore", + "urllib3" + ], + "missing_native": [ + "charset-normalizer", + "greenlet", + "grpcio", + "hf-xet", + "jiter", + "mmh3", + "numpy", + "onnxruntime", + "pillow", + "protobuf", + "py-rust-stemmers", + "sqlalchemy", + "tokenizers" + ] + }, + "cache_reusable_reverified": [ + { + "name": "greenlet", + "version": "3.5.6", + "cache_hits": [ + { + "kind": "uv:wheels-v7", + "entry": "3.5.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64", + "content_digest": "d7ae14625784af8a268e8c156533b2e9d7694680e80a8466c8e5808cc3f1a005" + }, + { + "kind": "uv:wheels-v6", + "entry": "3.5.6-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64", + "content_digest": "2fc3afa56933ea2cbaf6005c1e61565e769db1f202b3d8c53a67e59a2ed307f7" + } + ] + }, + { + "name": "pillow", + "version": "12.3.0", + "cache_hits": [ + { + "kind": "uv:wheels-v7", + "entry": "12.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64", + "content_digest": "02620d3560d2e91e0920c1045ed814b02a4d15d8c1c960f43a060739acf0dc1f" + }, + { + "kind": "uv:wheels-v6", + "entry": "12.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64", + "content_digest": "657f02aee576df196a22c130a65a3dd0f7438a8b859c2221448bea2dac6d7112" + }, + { + "kind": "uv:wheels-v6", + "entry": "12.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64", + "content_digest": "02620d3560d2e91e0920c1045ed814b02a4d15d8c1c960f43a060739acf0dc1f" + } + ] + }, + { + "name": "truststore", + "version": "0.10.5", + "cache_hits": [ + { + "kind": "uv:wheels-v7", + "entry": "0.10.5-py3-none-any", + "content_digest": "54c5d4c83a1183954a6ca33169f8881c576160c722e93064ece271776ee2eac4" + }, + { + "kind": "uv:wheels-v6", + "entry": "0.10.5-py3-none-any", + "content_digest": "54c5d4c83a1183954a6ca33169f8881c576160c722e93064ece271776ee2eac4" + } + ] + } + ], + "build_backend_gap": { + "hatchling_cached_or_local": true, + "note": "固定源码构建仍缺 hatchling;如实保留,未获批不联网补齐" + }, + "fastembed_models": { + "cache_dir": "/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-857-2cf6dc7dfc87/workdir/hel857-data/fastembed-cache", + "exists": true, + "models": { + "models--Qdrant--bge-small-zh-v1.5": { + "files": 13, + "bytes": 190444780 + }, + "models--Qdrant--bm25": { + "files": 39, + "bytes": 56247 + } + }, + "default_cache_dir": "/home/xiaomo/.cache/fastembed", + "default_cache_exists": false, + "release_note": "真实 mem0 模式把 fastembed cache_dir 指向发布实例数据目录内的该缓存拷贝;本次零下载、不推理" + }, + "downloads_this_card": 0, + "note": "产物清单以 release_code_commit 为准;不要用旧父提交(04eff61/152479b/c121c42)说明冒充该 head。缓存命中为解包目录时记录内容摘要(目录无单一 sha256),安装时以 --offline 命中为准。" +} \ No newline at end of file diff --git a/docs/rework/hel879/release-check/hel882-release-check.json b/docs/rework/hel879/release-check/hel882-release-check.json new file mode 100644 index 0000000..26e1ce6 --- /dev/null +++ b/docs/rework/hel879/release-check/hel882-release-check.json @@ -0,0 +1,86 @@ +{ + "started": "2026-10-26T19:35:15Z", + "venv_python": "/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-879-3c721d56b938/workdir/CyberGril/.venv311/bin/python", + "venv_python_version": "3.11.16", + "checks": [ + { + "name": "R1_checkout_fresh_dir", + "ok": true, + "detail": "cloned tracked source into /tmp/multica-task-29494715/hel882-release-jk7k2a25/cybergril-hel874/current" + }, + { + "name": "R2_service_imports_product", + "ok": true, + "detail": "" + }, + { + "name": "R6_mem0_coimport_status_recorded", + "ok": true, + "detail": "import mem0 → ModuleNotFoundError: No module named 'mem0' (resolution path in deploy/hel874-release.md §4; no download in this check)" + }, + { + "name": "R7_pip_download_command_exists", + "ok": true, + "detail": "/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-879-3c721d56b938/workdir/CyberGril/.venv311/bin/python -m pip download --help → rc=0" + }, + { + "name": "R7_removed_uv_pip_download_still_absent", + "ok": true, + "detail": "uv pip download --help → rc=2 (kept absent on purpose; do not re-document it)" + }, + { + "name": "R2_service_serves_health", + "ok": true, + "detail": "version=R4-assembly semantic=stub" + }, + { + "name": "R3_create_status_recorded", + "ok": true, + "detail": "create status=201(409=前次运行的档案仍在,也是保留数据的表现)" + }, + { + "name": "R3_dialogue_refused_honestly", + "ok": true, + "detail": "http=200 events=b'data: {\"t\": \"chat.error\", \"epoch\": 1, \"turn_id\": \"00000000-0000-4000-8000-000000000001\", \"phi\": \"\\xe5\\xa5\\xb9\\xe8\\xbf\\x99\\xe4\\xbc\\x9a\\xe5\\x84\\xbf\\xe6\\xb2\\xa1\\xe6\\x8e\\xa5\\xe4\\xb8\\x8a\\xe8\\xaf'" + }, + { + "name": "R4_service_restarts_on_same_data", + "ok": true, + "detail": "epoch=2" + }, + { + "name": "R5_epoch_bumped_on_reopen", + "ok": true, + "detail": "1 → 2" + }, + { + "name": "R4_companion_created_offline", + "ok": true, + "detail": "status=409" + }, + { + "name": "R4_dialogue_stream_http", + "ok": true, + "detail": "status=200 events=b'data: {\"t\": \"chat.delta\", \"epoch\": 2, \"turn_id\": \"00000000-0000-4000-8000-000000000002\", \"delta\": \"\\xe6\\x89\\xb9\"}\\n\\ndata: {\"t\": \"c'" + }, + { + "name": "R4_messages_roundtrip", + "ok": true, + "detail": "roles=['user', 'user', 'companion']" + }, + { + "name": "R5_data_dir_preserved", + "ok": true, + "detail": "['companion.db']" + }, + { + "name": "R5_companion_row_survives_restart", + "ok": true, + "detail": "companion rows=1" + } + ], + "mem0_import_in_release_venv": "ModuleNotFoundError: No module named 'mem0'", + "removed_uv_pip_download_rc": 2, + "failures": [], + "finished": "2026-10-26T19:35:18Z" +} \ No newline at end of file diff --git a/scripts/verify_hel877_voice_chain.py b/scripts/verify_hel877_voice_chain.py index eb517a3..5874a28 100644 --- a/scripts/verify_hel877_voice_chain.py +++ b/scripts/verify_hel877_voice_chain.py @@ -101,8 +101,14 @@ def main() -> int: ), http=httpx.AsyncClient(transport=httpx.MockTransport(transport)), ) + # HEL-879 integration: mainline chat path hard-gates every send via + # router.guard.acquire (HEL-882); use the same approved engineering caps + # as the test suite so the chain check exercises the chain, not cap 0. + sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests")) + from conftest import engineering_budget router = build_router( - providers={t: provider for t in (Tier.HIGH, Tier.STANDARD, Tier.LOW)} + providers={t: provider for t in (Tier.HIGH, Tier.STANDARD, Tier.LOW)}, + budget=engineering_budget(), ) tmp = Path(tempfile.mkdtemp(prefix="hel877-")) app = create_app(db_path=tmp / "chain.db", router=router, diff --git a/tests/test_voice_chat_adapter.py b/tests/test_voice_chat_adapter.py index de05a2e..b8f485e 100644 --- a/tests/test_voice_chat_adapter.py +++ b/tests/test_voice_chat_adapter.py @@ -20,6 +20,7 @@ import uvicorn sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests")) +from conftest import engineering_budget # noqa: E402 from test_r2 import R2LLM # noqa: E402 from cybergril.api.app import create_app # noqa: E402 @@ -39,7 +40,12 @@ CREATE = {"name": "语音适配", "birth": "2000-10-18", "hour": "亥时", "rela @pytest.fixture def api(tmp_path): provider = R2LLM() - router = build_router(providers={t: provider for t in (Tier.HIGH, Tier.STANDARD, Tier.LOW)}) + # HEL-879 integration: the mainline chat path now hard-gates every real + # send through router.guard.acquire (HEL-882) — the engineering budget is + # the same approved-caps config every mainline test uses; without it the + # correct product behavior is fail-closed at cap 0. + router = build_router(providers={t: provider for t in (Tier.HIGH, Tier.STANDARD, Tier.LOW)}, + budget=engineering_budget()) # file-backed: uvicorn's lifespan in the live-server tests re-opens the same # database (":memory:" would hand it a second, empty store) app = create_app(db_path=tmp_path / "adapter.db", router=router,