Repository navigation
fix(chat): distinguish settled command failures during unfinished-work recovery - #8194
Conversation
…ence Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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 · Codex GPT-6 · OpenAI · self_reported(当前 host 身份观测 unavailable,未声称精确构建)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
原消息有明确未完工作、普通命令已退出的 Chat/Lark 用户。此前退出码为 1 的已结束命令会让旧请求永久等待;现在先独立核验进程已结束,再由原队列只补剩余工作。原消息可自动得到剩余工作的结果,无须用户重复提交;测试核验产物只写一次且原路只回复一次。不把非零退出当业务成功,不重放原失败命令,不改变原授权、停止及单次接续预算。安装态采用和全部历史欠答的真实回传仍须独立验收;管家 Codex 的重启中断属于另一条既有恢复路径。
改动思路 / Approach
普通命令退出属于原生 DTO 解释,应在 native_chat provider 统一归一;Core 的接续资格、授权、原来源和去重仍由既有 typed owner 决定。本 PR 只修正原生已结束命令的证据解释,并让原 worker 接续与回传测试覆盖这条路径。最强反对理由是:命令失败后可能已经改过部分文件,退出码不能证明业务成功。本实现只承认进程已结束;仍须原 worker 的明确剩余工作与效果已结束报告、完整稳定原生库存、无后台效果、原来源及授权和停止核验。直接放宽全部 failed 或增加另一套业务重试都更差;两处读取共用一个谓词即可。
具体改动 / Changes
基准规范为 docs/architecture/rfcs/app-conversation-and-async-inbox-v0.md,spec_revision 546c08c0d3f22358ef09b13e69f7edaa806121b8,按 Explicit unfinished work after a completed Turn 章节审查。该基准把全部 failed 一律等待;本 PR 刻意修改普通进程终态的这一个条件,依据是明确退出事实及原有“只做剩余工作”的用户合同,不能用修改后的 RFC 自证正确。explicit-unfinished-work 的原报告/来源/grant,stable-native-inventory 的完整库存/后台/派发前重读,以及 single-original-queue 的单次预留和回传均由现有路径继续实施。
关键代码讲解
codex_adapter.py:273的_settled_work_effect保留 completed;只有 commandExecution 的 failed、整数普通正退出码、合法开始结束时间和字符串输出才作为已结束证据。布尔值、无退出、失败却零退出、超时/信号退出均拒绝。失败 fileChange/MCP 不通过。codex_adapter.py:289的completed_work_readback在原始和后续关联 Turn 两处调用同一谓词。唯一 final、显式 unfinished、原生库存摘要和重复读取、后台检查不变;Core 仍决定是否预留 work-1。没有新增持久状态、命令、设置或第二消费者。
5 个文件共 +85/-18,其中产品代码 +19/-3,其余为既有测试和两份 RFC。完整回归 PASS 74 项。相同最终测试文件与真实 Core/原 worker 入口,base 为4个预期失败及1个负例通过,head 为5项通过。测试明确核对原 Turn 字节不改、首段产物保留、剩余只写一次、原来源只回复一次,重启采用原预留。
对主干的风险 / Risks
没有发现阻塞问题。主要风险是把“进程已结束”误读成“业务成功”,本次没有删除原效果报告及 Core 限制,也没有重放原失败 Turn。缺退出/输出、时钟不合法、超时124、信号137、失败 MCP/文件、后台活动、cold/foreign owner、来源编辑、撤权、停止、后续重复输入均由测试保持等待。模拟原生 app-server 驱动真实 Core/worker;另外9条持久原生 DTO 的只读检查只证明终态识别,不能证明活 owner、后台效果或实际业务交付。
标准预合并 PASS:6项直接检查和11项选择检查;Ruff、编译、公开边界5文件及双语差分通过。首轮缺 TypeScript 开发依赖而失败,正常 npm ci 后同命令通过,未改范围或预算。另一次全局 check 被两条无关 Goal authority 状态阻止,其公开扫描已通过,最终精确范围与 premerge 扫描均通过。按当前 Goal 合同不获取或等待 CI。
语义与 CI 对齐
复用原 DTO 和 typed Core 转移,没有新增枚举或替代 authority;语义检查通过。这是明确披露的普通退出证据修正,不是默认关闭功能,不能套用 feature-off 宣称。可回滚到旧 release 恢复旧等待行为,无持久迁移。
我的整体评价 / Verdict
这是 justified_increment:长程接续和用户体验在已覆盖路径改善,省去重复提交或人工确认,但不冒称全部积压已清。检查 codex_adapter.py 到原 Chat/Lark worker,未改变页面、组件或消息渲染布局,视觉验收不适用。真实安装态历史消息验收单列,不用合成测试替代。设计符合 provider 解释外部事实、Core 管资格和副作用的分工,代码量必要且没有第二状态 owner;后续重启中断修复仍由原机制维修承担。已核远端准确 head b42ed05a4ae19f4e7df8a725345085ab79777171,无评论或未解决发现。具备用户原先明确授予的相关修复自合并权限;merge readiness 仍需临合并独立检查。
English verdict: APPROVE — head b42ed05; no blocking finding, 74 regression cases and standard local premerge pass. Installed backlog recovery remains separate acceptance.
Historical unfinished requests can remain stuck after an ordinary command has exited with a nonzero code: the native readback currently treats every failed command as an unknown live effect. Recognize a recorded ordinary process exit as settled evidence, while preserving the original worker report, source/grant/stop fences, live background checks, inventory digest and single continuation reservation.
Missing exits or ordered timestamps, timeout/signal exits, and failed file-change/MCP effects still hold. This does not certify business success or authorize replaying a failed command. Both RFC mirrors explain the boundary.
Validation: 74 history/original-worker regression cases pass. With identical final test files, base has four expected failures and one negative-case pass; head passes all five. Nine persisted native command DTOs also qualify as terminal processes; that read-only diagnostic does not prove live background ownership or delivery. Standard premerge passes all six direct checks and eleven selected checks after installing the repository's missing TypeScript dev dependency; the initial dependency failure is retained. Ruff, compilation, bilingual diff and public boundary scan pass.
Presentation: this changes native DTO interpretation behind the existing Chat/Lark queue; no page layout, new control or setting changes. The original-source worker integration tests exercise result delivery and restart/idempotency without a second consumer. Installed adoption and complete historical message recovery remain separate acceptance work; this PR does not fix every restart category.