Repository navigation
fix(chat): preserve native proof for safe report launch recovery - #7567
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)
动机 / Motivation
未发现阻断性问题。已配置原会话周期报告的用户和维护者。主干在模型请求发布前拒绝后保留结果未知的事务,后续无法安全续办;本修复只把可证明的发布前拒绝写成原生失败,再沿原事务续办一次。真实 File/SQLite 原泵能恢复同窗报告并由原投递链读回,第二次拒绝和未知效果均不会重复运行。不补写旧未知事务、不新增执行者,不完成任意自然语言配置、整体前端旅程或真实模型报告质量验收。真实自然到期、完整自然语言与多受众报告资格仍由既有报告任务继续。
改动思路 / Approach
最强反对理由是:如果把已经发出的请求也当成“尚未开始”,自动恢复就会重复业务。这里没有把未知改成安全:捕获范围止于启动 guard 的进入,yield 之后的发布和等待仍沿原失败路径。原生 executor 记录已存在的 contract_rejected 失败,原始 attempt 不清零;Python 只读取同一个 canonical journal,TypeScript 再核同身份、同窗口、一次尝试、原生失败阶段和当前权限。
拒绝事实由现有原生 executor 落盘,恢复资格仍由 TypeScript owner 决定,未增加并行权威。本 PR 只交付发布前拒绝的持久记录与同事务一次接续;未知旧事务、完整任务化及真实内容验收保持原边界。相较于放松 unknown gate 或增加另一套报告重试器,这个 producer/consumer 修复复用了现有状态和恢复规则。原普通 Task、monitor 和未启用订阅的路径没有获得新的重试授权。
具体改动 / Changes
验收依据是 docs/product/periodic-reports.md,spec_revision 90b26f2fa26835d668f4f1fb77dea87c81fda755 的既有恢复段落;不是用本 PR 新增说明反向定义正确行为。prepublication-proof 对应发布前确证、same-native-continuation 对应原事务一次接续、unknown-remains-stopped 对应未知效果及第二次拒绝停止;三项均 implemented。
关键代码讲解
StewardTurnHost.run.launch(steward_turn.py:643)只在 guard 进入时将准确 stale refusal 交给已有 typed host failure。上下文仍覆盖原发布区间;发布后同类异常不会被转换。原生失败记录和外层旧回复都持续保留。_report_launch_recovery(同文件258)从原结算身份找原 Turn,读取 canonical inspection 与 journal。它没有重写历史、从缺少事件推断未执行,也没有直接认定可以重试。admitStewardManagedTurn(steward_managed_mode.ts:505)同时要求当前原订阅/窗口/任务、完全相同的原请求和 native key、唯一首次 canonical contract failure、无生成及结算,并要求内核已允许从 host_execute 继续。接受的只是现有独立外层 carrier,native 事务身份不变。
测试更新对应真实写入结果,不放宽原断言:保留原失败字节、原模型启动次数、完整生成、原受众 publication 读回与重复 poll 零重复。新增两后端反例把同样 stale exception 放到真正发布之后,另验未知 OSError;产品文档明确旧 in-progress unknown 仍停止。5文件 +103/-21,其中生产改动只在两个既有 owner,未新增 schema、CLI、store 或 worker。
对主干的风险 / Risks
主要风险是 publication 边界误分类,以及只修 consumer 却仍无法取得内核恢复资格。本次通过真实 Chat/native Task/Turn 和 File/SQLite 证据验证两者。相同最终8用例在不可变 base 是4 FAIL/4 PASS;修复头8 PASS。原旧测试在 base 另有四次“取不到恢复 Turn”的 IndexError,保留为原缺陷证据。首轮实现曾误要求 inspection 的 host_invoked 为 true;内核在尚无完成阶段时应保留 null,已按原合同纠正并重验,未修改内核 unknown gate。
PASS:295项相邻 native 用例、8项 TS admission、TypeScript typecheck、Ruff,以及标准 premerge 的6 direct/11 selected,均无失败或人工 hold。按 Goal 政策未查询 CI。合成 app-server 与 Lark 只证明机制和投递读回,不证明付费模型内容质量或自然生产准点。老未知事务不迁移、不自动重放,回滚同样保留其原记录。
语义与 CI 对齐
复用既有 contract_rejected、native failed-phase recovery 和原会话 typed admission;没有创建新的通用语义词表、将硬门改称建议或把报告特例放入泛化 kernel。新证据仍受当前原 grant/停止和原一次恢复约束。完整 managed/NL/GUI 资格由原工作继续,本阶段不冒称父目标完成。
我的整体评价 / Verdict
APPROVE,边界是 justified_increment。long_horizon improved:已证明安全的拒绝不再卡住这一报告窗口;user_experience improved:既有授权下无需新增用户陈述、确认、配置或页面导航。本次只改 steward_turn.py 与 steward_managed_mode.ts 的启动失败和恢复准入,未改变任何渲染页面。本 PR 没有新增实际 App 像素或真实模型内容质量验收。代码量判为必要,当前不增加抽象:现有 executor 落盘、TypeScript 决策和原投递 owner 已足够,继续抽出独立重试层只会重复权威。旧持久 unknown 保守兼容,未把共同升级当成删历史的理由;自然到期、完整任务化和真实质量仍保留未验收。
English verdict: APPROVE — head 066e7a2. Canonical pre-publication rejection enables one original-transaction continuation; unknown and post-publication work remains stopped. File/SQLite decisive and adjacent native tests, typed admission and required local checks passed.
A calendar report rejected before
turn/startpublication could retain an in-progress native journal with unknown host effects, blocking its intended single continuation. Record only the first-party guard-entrystale_goal_authorityrefusal through the existingcontract_rejectedhost-failure contract, and require that exact durable failure plus the current subscription and native recovery decision before resuming the same transaction.The historical outer response and native attempt remain retained. Post-publication exceptions, unknown transport outcomes, a second refusal, changed identity, and revoked authority do not trigger another automatic attempt; existing unknown journals stay blocked. The native executor and typed conversation admission keep ownership, with no new scheduler or worker.
Validation: 8 real File/SQLite pump, native-journal, generation and original-route readback cases pass, including successful continuation, a rejected continuation and both unknown/publication negatives. The control-plane report suite (8 tests), TypeScript typecheck, Ruff and bilingual diff check pass. The three adjacent native suites pass (295 tests), and standard premerge passes 6 direct and 11 selected checks with no holds. The same final eight fixtures produce four expected recovery failures and four passing conservative controls on immutable main 90b26f2. This PR does not claim live report quality, a natural production deadline, or installed adoption yet.