Files
CyberGril/docs/requirements/handoff-HEL-882.json
T
zonggongandmultica-agent e291058754 HEL-882 rework: execution-table caps become real hard gates at the wire, SDK hidden retries and mid-add failures recover without loss, the 8360 release package runs offline, and the HEL-874 embedding evidence is corrected - every real provider exit (create/dialogue/life/gist/judgment/growth/proactive phrasing + mem0's internal extraction LLM) now persistently pre-allocates request count (per-category daily + one-shot totals in request_usage/budget_total, BEGIN IMMEDIATE) and a conservative token estimate before sending, refuses at the tightest cap (BudgetStop, no more downgrade-and-keep-calling) and survives restarts; known usage settles to actual, unknown/disconnect/failure keeps the full reservation; ledger guards gain per-day tops (embed_daily/llm_daily) and verify_ledger_authority rejects a fresh file bypassing the frozen 498/500 prefix; the mem0 SDK client's hidden OpenAI retries are disabled (max_retries=0) so every actual send is gated and answered failures (even 5xx) settle as used with only httpx.ConnectError-grade unsent requests released; embed refusals the SDK swallows into empty adds are re-raised as budget errors so the batch re-queues without burning an attempt and resumes when the cap returns, add_group resumes at vector-store level (src_group anchors: only missing rows resent, crash/restart/concurrency never duplicate), sem coverage is per-backend (stub batches no longer block a real rebuild, real done batches never resend) with backend-scoped batch keys; the release package is offline-executable: fresh-dir git clone, cybergril service account, PYTHONPATH in the unit so the lock-only venv imports the product, shipped caps explicitly 0 (=refuse by design until approved), deploy/mem0-stack.lock + accurate 3.11 wheel gap with a no-download path (hel857-venv is 3.10; never present stub/FTS as the real memory experience), and tools/check_release_offline_hel882.py verifies checkout/import/health/fail-closed/approved-run/data-preservation on loopback with echo stand-ins; evidence corrected per manager review: docs/rework/hel874/erratum-hel882.json + README appendix record that e978e87's verification did real local embeddings from cache (provable lower bound 12, exact total unrecoverable, temp sandbox gone) while zero-real-LLM/zero-download/zero-outbound stand, old JSONs and authoritative ledgers untouched, and tools/verify_mem0_real_hel874.py now installs the deterministic 512-dim stand-in before TextEmbedding construction plus non-loopback socket rejection (zero model loads) with final_embed_rows persisted before temp cleanup; verification: 272 python tests pass on 3.11.16 venv + requirements.lock offline (16 new: manager api repro blocked with 0 provider calls, sdk repro 1-HTTP/max_retries=0/llm_ops=1, mid-add swallow requeued-then-resumed, resume-no-duplicate, stub-to-mem0 rebuild, daily embed cap, unified mem0-LLM gate, authority refusal, restart-persistent counters, tightest-constraint settle/release), ruff clean (src/tests/tools), web tsc + 42 vitest + build via npm ci --offline, pinned-install deterministic re-run 12/12, manager review scripts re-run evidence attached in delivery, dual-target requirement checks 4/4 with handoff-HEL-882.json; zero real calls, zero real embeddings, zero non-loopback outbound, authoritative ledgers and freezes untouched, not deployed, PR not merged, no visual changes
Co-authored-by: multica-agent <github@multica.ai>
2026-10-26 23:20:18 +08:00

55 lines
8.6 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"baseline_version": "1.11",
"read_commit": "e978e878dfc34f38c781d48f87b93dc21bbf8a61",
"task": "HEL-882 返工(总管对 HEL-874 e978e87 独立复审后的一次归拢修正):执行表上限落成真实硬闸(所有真实 provider 出口发送前持久预占请求次数与保守 token、按最紧约束拒绝、重启不归零,含 Mem0 内部提取 LLM 并入统一闸;拒绝新账本文件绕过冻结)、SDK 隐藏重试与中途失败/恢复修齐(max_retries=0 逐次受闸、被应答失败照实入账、吞错识别为预算拒绝并重排队续跑、向量库级幂等不重发不丢行、stub→mem0 按后端区分覆盖)、发布包修到离线可执行(空目录 checkout、PYTHONPATH 服务导入、服务账号/权限、mem0 同进程导入准确缺项与不下载路径、空账初始化、回环离线核验脚本)、HEL-874 嵌入证据口径勘正与验证工具边界改确定性替身;零真实调用、零真实嵌入、零非回环出站、不改视觉、不部署、不合并、不碰权威三账与冻结余额",
"requirement_ids": [
"CG-006",
"CG-008",
"CG-011",
"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(基于 e978e878 追加,PR#11 只追加不强推)上完成四类修正:1) 硬闸——think/budget.py 增类别请求上限(dialogue/life/background/semantic,默认 0=拒绝)与一次性总量(A 部分)、BudgetStop、acquire/settle/release 预占制与保守 token 估算口径;life/model.py PersistentBudget 落库 request_usage/budget_total(r4.sql 新表,BEGIN IMMEDIATE 原子预占);api/app.py 主对话发送前 acquire、真实 usage 按实落账未知保守保留;structured() 全部后台出口同一闸;Mem0Backend 内部提取 LLM 接统一 request_guard(semantic 类别+日 token 池);EmbedLedgerGuard/LlmLedgerGuard 增日顶(embed_daily/llm_daily)与 verify_ledger_authority 冻结前缀校验(新空文件绕过 498/500 被拒);config/models.yaml 与 semantic.example.yaml 随包显式 0。2) SDK 边界与恢复——SDK client max_retries=0 禁隐藏重试;被网关应答过的失败照实入账、仅 httpx.ConnectError 级未发送释放;mem0 phase3/7 吞掉的嵌入预算拒绝经线程局地失败记录重抛,作业批遇预算拒绝回 queued 不耗 attempts,调 cap 后续跑;add_group 以向量库 src_group 锚做行级幂等(续传只发缺行、崩溃/重启/并发不重复发送);sem_covered 按后端区分(stub 批次不阻塞真实重建、mem0 完成批不重发),batch_key 含后端。3) 发布包——deploy/hel874-release.md 重写(空目录 git clone、cybergril 服务账号、PYTHONPATH 单元、models.yaml 硬闸默认 0 的设计行为说明);deploy/cybergril-hel874-8360.service.example 加 PYTHONPATH/Group;deploy/mem0-stack.lock 固定栈清单 + §4 准确缺项(hel857-venv 为 3.10、产品 3.11、缓存无 3.11 wheel,发布卡落 wheel 后同 venv 离线并入,本卡零下载)与不许 stub/FTS 冒充真实记忆体验;tools/check_release_offline_hel882.py 离线核验(R1 空目录 checkout/R2 服务 import+health/R3 未批上限 fail-closed/R4 批准后全链 echo 替身/R5 停止保留数据重开 epoch+1/R6 mem0 同进程导入现状)。4) 证据勘正——docs/rework/hel874/erratum-hel882.json 与 README 追加:e978e87 版验证读取缓存做过真实本地嵌入(可证下限 12 条、精确总数不可恢复)、提交信息与执行表『零真实嵌入』口径不成立、LLM=假网关/零下载/零出站口径仍成立;tools/verify_mem0_real_hel874.py 改为 TextEmbedding 构造前装确定性 512 维替身+socket 禁非回环(总管复现同口径),证据 JSON 落盘 final_embed_rows/final_llm_used 后再清临时目录;旧前后 JSON 与权威三账一律不改。验证:3.11.16 venv+requirements.lock 离线 272 项 pytest 全过(新增 tests/test_hard_gates_hel882.py 7 例:总管 api 复现拦住/类别日顶跨重启持久/后台类别闸/默认全拒绝/最紧约束与落账/持久计数器/一次性总量,tests/test_semantic_recovery_hel882.py 9 例:总管 sdk 复现拦住(1 次 HTTP、llm_ops=1)/未连接才释放/中途吞错重排队续跑/断点续传不重发/stub→mem0 重整与真实批不重发/嵌入日顶/内部 LLM 统一闸/authority 拒新文件/build_semantic fail-closed),ruff 0 错(src/tests/tools),web tsc+42 vitest+build 通过(npm ci --offline 零下载),固定 3.10 mem0 安装上确定性替身实跑 12/12(verify 工具)+总管两复现脚本复跑证据(见交付评论附件);零真实调用、零真实嵌入、零非回环出站,权威三账与冻结余额未写,未部署未合并未交体验地址,不改视觉。",
"acceptance": [
"总管 api 复现被拦住:日 token 已超限的轮次 0 次 provider 调用、如实 chat.error、计数不增(tests/test_hard_gates_hel882.py::test_daily_token_wall_refuses_before_any_provider_call)",
"总管 sdk 复现一被拦住:llm_cap=1 面对本地 500 恰 1 次 HTTP、llm_ops 已用=1、第二次 add 发送前拒绝;SDK client max_retries=0(test_hidden_retries_disabled_and_wire_hits_counted)",
"总管 sdk 复现二可恢复:embed 中途预算拒绝不再误写 done/[],批回 queued 不耗次数,调 cap 后同一批续跑 done 且 entry_ids 非空(test_mid_add_budget_swallow_requeues_then_resumes)",
"总管 sdk 复现三修复:stub 完成批不再阻塞 mem0 重建(enqueue=1、检索命中),mem0 完成批不重发(test_stub_batches_never_block_real_rebuild_and_real_never_resends)",
"断点续传:已入库行不重发、只补缺行;崩溃/重启后向量库级幂等(test_resume_never_loses_or_duplicates_rows)",
"请求计数与 token 预占持久化跨重启;类别日顶/一次性总量/日 token 按最紧约束拒绝;未批类别默认 0 全拒绝(test_dialogue_request_cap_persists_across_restart 等)",
"冻结防绕过:authority 前缀校验拒绝新空文件+cap>0 组合;build_semantic fail-closed(test_authority_block_refuses_a_fresh_file_bypassing_the_freeze)",
"发布命令离线可用:check_release_offline_hel882.py 全过(R1–R6),mem0 同进程导入缺项如实记录且解决路径不下载",
"证据勘正落地:erratum-hel882.json+README 追加,verify 工具确定性边界(零模型加载)实跑 12/12;旧前后 JSON 未改、权威三账未写",
"工程检查:272 pytest、ruff 0(src/tests/tools)、web typecheck/42 vitest/build、双目标需求检查 4/4(含本 handoff)"
],
"deferred": [
"发布与体验地址:由总管独立复审本 head 后交发布卡按 deploy/hel874-release.md 执行(8360 隔离实例);本卡未部署未合并 PR#11 未交体验地址",
"真实语义激活(CYBERGRIL_SEMANTIC=mem0):需 B 部分预算批准 + 3.11 mem0 栈 wheel 落位(deploy/mem0-stack.lock,本卡零下载);未激活前 stub/FTS 不冒充真实记忆体验",
"A/B/C 执行表数值仍为待批建议(docs/budget-plan-hel874.md):批准前所有 cap 保持 0=拒绝;新增预算由总管向白栖知一次性申请",
"R5 语音/R6 天气、素材、备份/R7 有条件观察承接不变;视觉仍交原作者,本卡未改视觉",
"真实体验效果(含硬闸拒绝时用户侧措辞是否需人设化)待体验地址交付后由白栖知判断"
],
"requirement_changes": [],
"verification": [
"分支 hel-870-assembly 追加提交(最终 head 见交付评论),PR#11 只追加未强推未合并;视觉总监分支未覆盖",
"python 3.11.16 venv + requirements.lock 离线:272 项测试全过(新增 16 例硬闸/恢复测试);ruff 0 错(src/tests/tools);web typecheck/vitest 42/build 通过(npm ci --offline)",
"固定 mem0 2.2.1 安装(hel857-venv 3.10.12)确定性替身实跑:tools/verify_mem0_real_hel874.py 12/12(零真实嵌入、零非回环连接、临时目录清理前逐笔账落盘);总管两复现脚本对本 checkout 复跑证据见交付评论附件",
"tools/check_release_offline_hel882.py(echo 替身、随机回环端口、临时目录)全过;mem0 同进程导入缺项(3.11 无 wheel)如实记录,解决路径 deploy/hel874-release.md §4,本卡零下载",
"python3 scripts/check_requirements.py --base-ref origin/main [--handoff docs/requirements/handoff-HEL-882.json] 与 --base-ref origin/agent/agent/de8874a3803b [--handoff …] 四项通过"
]
}