Files
CyberGril/docs/budget-package-hel895.md
T
zonggongandmultica-agent 04eff611e7 HEL-895 release candidate: the approved kernel 152479b + the HEL-881-passed proactive-inbox frontend bf234570 assembled into one auditable head, with the full post-synthesis battery, the release package and the one-approval budget execution package - integration is a clean merge (the mainline 31970c4..152479b never touched web/, so the merge brings exactly the visual director's six frontend files plus handoff-HEL-875/880.json; web/ is verbatim bf234570 and src/tests/tools/config are verbatim 152479b, all HEL-874..894 backend fixes preserved, no redesign, no visual decision, the unpushed b48d28b test merge superseded); verification rerun on the merged head: 299 python tests pass on the 3.11.16 venv + requirements.lock offline, ruff clean (src/tests/tools), web typecheck 0 errors / lint 0 errors 1 pre-existing warning / vitest 55/55 / build passes with CSS still index-DdDYzR5S.css (visual untouched), pinned-SDK regressions on hel857-venv (3.10.12, deterministic 512-dim stand-in, loopback-only, temp ledgers): verify_close_ownership_hel894.py 16/16, verify_shutdown_queued_hel889.py 12/12, verify_inflight_lifecycle_hel886.py 6/6, verify_semantic_recovery_hel885.py 7/7, verify_mem0_real_hel874.py 12/12, check_release_offline_hel882.py R1-R7 15/15 (R6 honestly records the 3.11 mem0 gap); NEW real-HTTP pagination contract 7/7 (tools/verify_http_pagination_hel895.py: the real product service seeded with 327 rows proves the reverse-page + limit+1 probe + next_before + epoch contract the approved frontend depends on, the public field allowlist with proactive exactly on reach-out rows, and a mechanical port of inbox.ts fetchAfter proving the HEL-880 gap semantics against the real backend - 5-page cap leaves the gap, the next call closes it and hands the two new reach-outs exactly once); NEW real-server browser 7/7 (web/tests/hel895_real.mjs: Chromium CDP against the real API + built dist - real boot, reach card arriving over real HTTP, stage playback, the 260-row long-absence gap regression, SIGTERM restart epoch+1 with no duplicate rows, zero permission requests; evidence docs/rework/hel895/); deliverables: deploy/hel895-release-candidate.md (exact head, manifest, install reference, health matrix, disable/rollback, the exact 3.11 fixed-SDK gap verified offline - product venv imports fine, no mem0/qdrant/fastembed wheels in any local cache, hel857-venv 3.10 fixed stack untouched and un-mixed, zero downloads, resolution path unchanged per hel874-release.md §4) and docs/budget-package-hel895.md (the A/B/C tables as one approvable package: per-send four-gate stacking semantics, the cross/duplicate/missed accounting verdict - A totals stack on daily category caps by design, B extraction LLMs are dual-counted in llm_ops cumulative AND the semantic daily gate by design, embeds count only as items, all four request categories plus the global token pool cover every outbound site, failures/cancels conservatively billed with no refunds, cap-hit stop semantics and evidence - all still cap=0 defaults, the 39/60 and 498/500 freezes and the HEL-835 gate untouched); requirement checks 6/6 (origin/main, origin/agent/agent/de8874a3803b and the actual mainline 152479b, each with and without handoff-HEL-895.json); zero real LLM, zero real embeddings, zero downloads, authoritative ledgers and freezes unwritten, not deployed, PR#11 appended-not-merged, no visual changes, R5/R6/R7 honestly deferred
Co-authored-by: multica-agent <github@multica.ai>
2026-10-27 02:23:08 +08:00

5.7 KiB
Raw Blame History

HEL-895 · 真实全链一次批准执行包(A/B/C 合并核定稿;仍全部待授权,默认 0 不变)

本文件把 docs/budget-plan-hel874.md 的 A/B/C 三表收拢成一次可批准的具体执行包: 每一步的请求/嵌入/失败-取消-重试上限、累计与日顶的叠加口径、一次性团队检查与用户 日常使用的分账、碰顶停机语义与留证方式。技术核对基于本卡实际代码与配置 (src/cybergril/life/model.py 的 PersistentBudget、src/cybergril/think/budget.py、 config/models.yaml、config/semantic.example.yaml、299 pytest 含 tests/test_hard_gates_hel882.py)。

批准状态:三部分均未批准。随包 models.yaml 全部上限为 0(未批准即发送前拒绝), semantic.example.yaml 缺省全 0。本卡零真实调用、零真实嵌入、零权威账写入。 旧账 39/60(真实请求)与 498/500(嵌入,冻结 2 条)及 HEL-835 闸原样保全, 不挪用、不重置、不并入。真实数值只有白栖知批准后由总管写入。

1. 批准项(一个包,三个独立账)

部分 用途 硬顶(批准后由总管写入) 账本
A · 一次性团队整体检查 8360 隔离实例按体验链 1–7 全链走一遍(stub 语义,零嵌入) 总量 55 次请求 / 500,000 tokens / 0 嵌入(budget.total_requests/total_tokens,跨日累计) budget_total/request_usage/token_usage
B · 首周语义激活 CYBERGRIL_SEMANTIC=mem0 真实激活观察 提取 LLM ≤60 次(llm_cap);嵌入 ≤180 条新批 → 按算式写 embed_cap=680、embed_reserve=2(权威账已用 498/原批 500) llm_ops(新表)/embed_ops(权威账续账,authority 冻结前缀必填)
C · 用户日常使用 体验地址交付后每日 dialogue ≤60/日、life ≤8/日、background ≤40/日、semantic ≤40/日(daily_requests);嵌入 ≤60 条/日(embed_daily);tokens ≤2,000,000/日(daily_tokens,全类别共池) 同 A 的持久表 + 日顶列

A 当天同时受 C 类日顶约束(叠加见 §2);B 期间的对话/生活/判定请求并入 C 日账, 不占 B 的 60 次。三部分独立授权来源保持:A 需总管新批(产品环境网关用量不属于 HEL-857 的 60 次实验授权);B/C 需白栖知明确批准。

2. 叠加口径(逐笔发送前原子预占;总管核定值写入后自动生效)

一次真实 provider 发送(创建/对话/生活/gist/判定/成长/主动措辞/Mem0 内部提取) 在 PersistentBudget.acquire 同时过四道闸,任一到顶即 BudgetStop 拒绝,不降档续调:

  1. 类别日顶(该调用所属 daily_requests 类别:dialogue/life/background/semantic);
  2. 日 token 池(daily_tokens,全类别共池;70% 警告、95% 非关键场景 structured 预检先停);
  3. A 部分一次性总量(total_requests/total_tokens,跨日累计,重启不归零);
  4. B 部分类别账:Mem0 内部提取 LLM 另过 llm_cap 累计 + llm_daily;嵌入过 embed_cap 累计(含冻结 embed_reserve)+ embed_daily。

交叉核对结论(本卡逐项核过代码与测试):

  • 交叉(有意叠加,非重复计费):A 的每次请求同时计入 A 总量与当天类别日顶; B 的每次提取 LLM 同时计入 llm_ops 累计与 semantic 日顶 + 日 token 池。两处计数 用途不同(一个限一次性总量/首周观察,一个限每天),不会互相退款或放宽。
  • 不重复:嵌入只记 embed_ops(条数),不进请求计数;提取 LLM 只在 llm_ops+统一请求闸各记一次;主对话与语义层各自独立闸(tests/ 双实例同库复现)。
  • 不漏记:四个请求类别(dialogue/life/background/semantic)+ 嵌入 + 全池 token 已覆盖全部产品出站点;SDK 隐藏重试已禁用(max_retries=0),每次实际发送都过闸。

3. 失败、取消与重试(保守入账,不退款)

  • 发送前预占(请求次数 + 保守 token 估算:输入字符 1:1 + 声明 max_tokens 全额); provider 返回真实 usage 按实际修正(多补少退)。
  • 未知 usage/断流/失败/取消保守保留全部预占;已发送的成本不当未发生。唯一释放 路径是可证明未连接(httpx.ConnectError 级)的显式 release()。
  • 真实错误重试 ≤3 次/批;预算拒绝不耗重试次数——作业回 queued (reason=semantic_*_budget_*),总管调 cap 后同批续跑,已完成行不重发。
  • 嵌入:单条失败释放;批次中途失败整批保守落账。

4. 碰顶停机语义与留证

  • 全部硬闸在发送前拒绝(budget_*_exhausted / semantic_*_budget_*),拒绝如实 记录,不补发、不换渠道。
  • 语义层到顶只停语义(检索回落词面 FTS,主对话不中断);日 token 到顶停当日全部 真实调用;A 总量到顶即团队检查收尾。
  • 留证:budget_total/request_usage/token_usage/embed_ops/llm_ops 表 + 服务日志 + 隔离实例数据目录(SQLite WAL 单文件可整体归档);碰顶当时的拒绝 reason 与计数快照截图/导出一并归档到交付评论。

5. 本包默认状态(本卡随包可执行)

config/models.yaml:daily_tokens: 2000000(结构性默认值,非授权)、 daily_requests.* 全 0、A 部分总量两行保持注释(待批);config/semantic.example.yaml 全部 cap/daily 为 0、authority 必填结构就位。未写入批准值前,任何创建/对话/ 生活/gist/判定/成长/主动措辞/提取调用都在发送前被硬闸拒绝(budget_*_exhausted), 这是设计行为;已由 tools/check_release_offline_hel882.py R3 与 299 pytest 复现。