Repository navigation
fix: 整理各步骤独立预算并限制记忆配对积压 - #120
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
记忆配对耗尽共享的 50 次额度时,人物摘要与 persona 会长期得不到执行机会。本次按 CO-07/CO-08/CO-09/CO-10 将四步额度独立,并给待处理 pair 设置 2000 项上限。
max_callsentry_profile_max_callsperson_summary_max_callspersona_max_callsCO-10 审查后调整入口画像和 persona 两项默认值:EF-15 只含 6 个入口,而上线已有 12 个群入口且还会增长,原上限 18 可能让部分入口每天轮不到;现有 persona 确定性测试 P95=3 低估了尚未合并的 #61,规划者汇总其公开 persona_v1/v2 为 133 次/23 个候选、265 次/30 个候选,平均约 5.8/8.8 次(含检查与复查),原上限 6 会再次造成预算跳过。默认上限改为 60/30,记忆 300、人物摘要 40 保持不变。这些是每轮调用上限,不代表常规用量;HTTP 重试和 JSON 修正仍各计一次。完整依据写入 README。没有运行真实模型或 CPU 压测。
每个实际请求在事务外调用,准入按 purpose 从持久账本计数;预检不扣次数,重启保留快照和已用额度。每日 token 限额、暂停及停止信号先于各步额度,一步用尽后其他步骤仍可运行。生成重试/修正保留检查名额,原修订/版本写回检查不变。新运行快照含四项上限,旧快照缺新键时读默认值但不改原文。
迁移
034_consolidation_step_budgets.sql只将“值为整数 50 且没有任何consolidation_settings_saved”的历史默认升级为 300。管理员保存过整理设置,包括只改开关或显式保存 50,均保持原值;其他字段、历史迁移、db.py 和已有运行快照不动。核实唯一产品管理写入路径为带该操作记录的设置 PATCH;首次设置不写整理设置,数据库导入/定时备份保留设置与审计记录。直接 SQL/内部 Store.set_setting 的无审计 50 无法和历史默认区分,也会升级。规划按 importance 降序、changed_at 降序、id 升序保留前 2000 个 pending/classified/decided pair,其余终态
backlog_trimmed,不写 receipts、不改记忆;任一侧以后语义/扫描指纹变化可重新规划。依赖任务不修剪,每轮 128 个新种子和 256 项工作快照上限不变。修剪与计数同事务,报告不重复累计。UX 接口:
GET /admin/api/settings的 consolidation 对象返回上述字段;PATCH /admin/api/settings/consolidation部分更新,0 只停对应步骤,改动只影响后续新运行。预算报告items[].outcome=model_step_budget、details={step,max_calls,calls_used},step 为 entry_profile/memory/person_summary/persona,停止原因在 reason。修剪报告的 outcome/reason 为 backlog_trimmed,details 为 count/limit。summary.model_calls 仍为四步合计;consolidation.skip_reason 仍为记忆阶段原因。前端由 UX 后续接入。验证:
uv build:成功生成 wheel 与 sdist;两包均含新默认值与未修改的迁移 034,未含密钥配置、.venv 或 node_modules。测试对齐清单
既有测试只对齐预算语义,未跳过用例或删除断言:
test_maintenance_cognition.py:persona_case 夹具及下一轮提额使用 persona_max_calls;两处新库默认 50→300;非法上界 51→1001,新测试补 51 合法;原共享预算阻止 persona 用例改为 memory=1/persona=2 后仍发布,保留合并断言并精确校验 3 次调用;HTTP 重试/修正测试只改预算命名,参数与断言保留。test_entry_profile_consolidation.py:dream 夹具、0/1 小额度、两入口上限及生成重试额度改用 entry_profile_max_calls,结果断言不变。test_person_summary_consolidation.py:预算模块说明和 prepare 夹具改用独立额度;顺序用例设 memory=1、summary=4,原顺序断言保留,断言两个发布、4 次摘要调用及完整 5 次账本。test_person_summary_admin.py:设置往返的新库默认 50→300,类型和审计断言不变。test_merge_scoring_v2.py:CO-09 批准的一行夹具修改,保留 runner 原设置、仅覆盖max_calls=1;原测试名称和全部断言不变,防止夹具重置配置意外启用入口画像。CO-08 已授权与 #61 重叠的预算用例,后合并方用 merge origin/main 解决冲突。入口画像、memory_ops、persona、maintenance、goals、调度、前端及其他源码均未改。
完整日志与汇总报告位于仓库外
/Users/cassia/Local/Code/iris-eval-artifacts/consolidation-step-budgets-20261017/。PR 保持开放,交规划者审查。CO-09 已完成的离线对照基线(本轮未重跑):
b1493c4fd83c9af75cbf0e08c0cf6aa251864c11(含 #117)。learning-compare-co09/summary.json和recall-compare-co09/summary.json确认学习 272 批、召回 1140 份返回及 214 次判断输入零差异。main 源码指纹0498bc79c8957a49fda26478e9f489a7cac27f907d3d81602d745e177d52d1b4;CO-09 候选源码指纹6e1a419e33b86163dfe9088dccecdbafa2d4e285e71b22fa0558ccff5323d7d9。CO-09 验证期间 main 另合入 #118、#119,当时提交前为
caa4cc89d619f9747897d77c0a621cad9a04119a;最新迁移仍为 033。本 PR 的代码与测试基线固定为上面列出的b1493c4。受审 head:
a17811bc8ca3e2cd558ae3c70997b53a3ddfe2bc。CO-10 默认值测试对齐:
test_consolidation_step_budgets.py将新字段的默认值断言固定为入口画像 60、人物摘要 40、persona 30,同时核对 GET 回退值与ConsolidationSettings默认;先红 1 failed,修改后同项 1 passed。迁移 034 SHA-256 仍为efb6a7dfb0e4cb4d9c8719d8956fe1f3b3d0e7bda31774f307447045f572d866,与上一 head 逐字一致。