Repository navigation
fix(chat): recover frozen reports after native validation failure - #7215
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
启用周期报告的原会话用户,以及负责自动续跑的原服务。 嵌入式宿主生成日报后,子 Python 无法加载 LoopX,独立校验失败;旧服务一直保留稿件,既不结算也不送达。修复版让原服务校验同一份冻结稿并完成原事务。 已经写好的报告可自动走到原渠道全文读回,不需要用户重新描述任务、复制内容或人工补发。 不新增调度器、任务库、消息消费者、模型执行器或权限,也不重跑已发生的模型调用。 生产安装、原消息实际送达和下一独立自然周期仍需验收;通用周期任务的自然语言编排由现有主线继续。
改动思路
资格仍由现有 TypeScript 准入判断,Python 只适配已安装宿主与现有 kernel validator;journal、租约、结算和私聊 sender 各保留原权威,不建立第二套恢复状态。 本 PR 只闭合冻结稿独立校验与原生事务剩余步骤恢复。 校验回调来自原服务代码,与模型执行分离:它重新读取原订阅及窗口,校验冻结输入、候选、正文和 manifest 的完整谱系,再检查当前原授权。文件存在只让 frontier 发现待恢复事项,不能证明稿件有效。原生 Turn 驱动继续决定校验结果、任务完成、持久写回与额度结算;私聊 sender 仍只接受真实 native commit,且必须完成全文读回。
下面是相同测试输入的对比表,不是生产送达证明;对照源为基线 c37ab4df 和本次 head 135821b7。未新增用户准备或确认步骤,已有意图和授权直接沿原服务恢复。
| 相同输入 | 基线 | 本次 head |
|---|---|---|
| 无独立 LoopX 安装的子 Python;原生冻结稿校验失败 | 四个正向验收失败,稿件卡在 OPEN | 十一个同组用例通过,同一事务完成,模型调用数不变 |
| 暂停、篡改、未来首日和普通宿主默认值 | 七个反例及兼容用例通过 | 相同七个用例继续通过,无新增发送或模型调用 |
| typed 缓存校验恢复与错误身份/阶段 | 一个新恢复用例失败,两个原用例通过 | 三个用例通过,错误身份/阶段/模型准备仍拒绝 |
具体改动
规范依据为 periodic reports contract,revision c37ab4df9b00f86cd502f0d355b4d1a52bc97760。Daily portfolio report 的独立生成校验已实现;Native scheduling and execution 的单执行者及原事务恢复已实现;Original private report settings and execution 的原授权及全文读回边界已保留并以反例验证;Acceptance boundaries 的生产安装、真实原消息和下一自然周期验收仍为 deferred,不能由此源码评审冒充完成。
关键代码讲解
StewardTurnHost._report_validator在已安装的 owning host 中读取原窗口和订阅 revision,再调用完整validate_private_generation与delivery_current。这利用 kernel 已有的独立 callback validator,而不是让模型自行宣布校验通过,也不依赖裸子解释器额外安装 LoopX。StewardTurnHost.recover_report_settlement查询原 client 关联与唯一 native settlement key,保留历史 outer response。OPEN 稿件在原 Todo 租约下只恢复 validation 及后续步骤;传入的no_model若被执行就立即报错。生成和缓存恢复共用原租约的 acquire/proof/release,lease epoch/version/owner 边界仍保留。admitStewardManagedTurn cachedGeneration只允许原 OPEN Todo、failed 且一致的 journal、严格按顺序完成的host_execute与typed_result、从 validation 继续且reinvoke_host=false。缺失、顺序错误、外来 key、停用订阅、进行中 journal 或请求准备新模型上下文全部拒绝。原 DONE 后剩余效果恢复分支仍独立保留。execute_turn_run_once validator selection只接受原 app-server 内部适配提供的回调;普通 CLI 不能替换其选定的 command validator。回调为 None 时原命令验证保持默认,仍校验 argv 格式;没有新增命令行 flag、模型协议字段或持久状态。
对主干的风险
最强反例是“常规测试环境能 import LoopX,但部署时裸子解释器不能”,从而源码测试都绿、实际稿件仍卡住。本次确实创建无 LoopX 的隔离 Python,以真实原 worker 产生历史校验失败,然后从原 pump 恢复;不是手填成功 journal 或 mock 校验后置条件。File 与 SQLite 均经过真实租约、journal、任务完成和结算,再由合成 provider 完成全文发送及读回;模型和 Lark IO 是明确的合成边界,尚不证明生产内容质量。
最终 native 报告/host/sender/monitor 回归 111 项通过,typed 回归 12 项通过,普通 CLI 校验四项通过,类型检查及 standard exact-source premerge 全部通过。其中一项既有监控测试采用父进程内的时钟控制:原测试强制两个不同 keyed 观察落在同一秒,先前 90 项通过而该项因旧的严格顺序规则失败;不可变基线和本版在固定同秒条件下均以完全相同原因拒绝,在递增毫秒条件下均通过。相关四个因果代码/测试文件完全相同,本次没有修复或放松该规则。最终测试只为该快速合成窗口推进时钟,不改变报告裸子进程的 import 环境。
早期新负例漏传必填 Agent 参数,已补齐。另一次临时时钟探针误把源码路径导出给裸子进程,使六项历史失败条件失效;该无效探针已停止并保留,改为只在 pytest 父进程内加载。最终验收未删除或放松原断言。原可选全机诊断仍有两个不可用的旧 Goal source,它们不在本次差异责任层;独立 public-boundary 子检查及本次必要预合并均通过。暂停、损坏稿件、撤权及未知效果仍保留原失败,不发布、不重跑。
语义与 CI 对齐
本次复用已有 task-validator callback、native journal phase、原生恢复和租约词汇;没有新增公共协议、任务权威或业务调度策略。TypeScript 保留资格判断,Python 承担宿主 IO,kernel 保留强制校验和效果执行。当前 managed review 明确 wait_for_ci=false,因此未查询、轮询或等待 GitHub CI;本地必要验证和 merge-readiness 仍必须通过。
我的整体评价
资格仍由现有 TypeScript 准入判断,Python 只适配已安装宿主与现有 kernel validator;journal、租约、结算和私聊 sender 各保留原权威,不建立第二套恢复状态。 本 PR 只闭合冻结稿独立校验与原生事务剩余步骤恢复。 长程效果 improved:完成的模型工作不再被宿主包装环境卡死,恢复与重复观察不会增加模型调用或重复已验证发送。用户体验 improved:已有意图和权限不增加任何人工准备、复制或确认轮次;停用与真实失败的状态仍诚实可见。visual_review 为 not_applicable:Only native host validation, typed recovery and descriptive documentation change; no rendered page, report format or setting changes. unverified_scope:Live report quality, installed delivery and the next natural cycle remain outside this source review.
机制成本与问题相称:生产改动复用现有 callback、journal 和私聊 sender,并合并原租约重复逻辑。旧持久请求和失败记录仍需读取,普通 CLI 是真实独立调用者,因此保留它的 command validator;没有为兼容再建版本协议或存储。评审结论 APPROVE,仅覆盖准确 head 135821b720af03e6b0f70565d16ef4e8e66f2981 的恢复修复。实际安装与原服务自动送达继续作为独立验收,通用任务自然语言入口不在本次完成范围。
English verdict: APPROVE — 135821b720af03e6b0f70565d16ef4e8e66f2981 independently validates and settles the original frozen report without repeating its model. Matched File/SQLite baseline failures, unchanged stop/default paths, 111 native tests, 12 typed tests, ordinary CLI validation, typecheck and exact-source premerge passed. Installed live delivery and broader generic task authoring remain separate acceptance work.
Goal And Delivered Outcome
A periodic report can be generated successfully while its native Turn still fails validation: an embedded Python host imports LoopX through its bootstrap, but the recorded bare child interpreter cannot import the package. The original producer then retains a valid frozen report with an open generation task and never settles or delivers it.
main; this is a scoped runtime repair, with no new scheduler, task store, consumer or provider permission.Author Declaration
StewardTurnHost._report_validator, native Turn validator adapterrecover_report_settlement,admitStewardManagedTurn,StewardReports.frontierScope And Continuation
Validation
135821b720af03e6b0f70565d16ef4e8e66f2981.regression_parityregression_paritystaticnpm run typecheck:control-plane; diff hygiene; public-boundary scan of all nine changed paths.unitintegrationstaticloopx canary premerge --from-git-diff --git-diff-base origin/main: six direct and fourteen selected checks passed, including the RFC bilingual check.real_entrypointreal_backendmanualRetained failures: an earlier new negative fixture omitted a required Agent argument and was corrected. An unmodified run passed 90 cases and hit one pre-existing monitor fixture failure: two distinct keyed polls in the same second trigger the existing strict ordering rule. The same fixed-clock command fails with the same exact diagnostic on base and head; advancing milliseconds passes both, and all four causal source/test files are identical. An intermediate clock probe exported the checkout into child Python and invalidated six historical-failure conditions; that probe was stopped and replaced by parent-only plugin loading, without changing assertions or production code. The final suite keeps the original isolated-child condition.
Coverage and gaps: validates both new report paths and the shared CLI isolation boundary. Synthetic publication checks prove the sender contract, not live report quality or receipt by the real audience. CI waiting follows the managed Goal's configured review policy.
Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
none.Signed-off-bytrailer.