Repository navigation
fix(agent): 修复停机续跑初始化失败与重复回复 - #1721
Merged
Merged
Conversation
chen-ran
force-pushed
the
codex/fix-shutdown-resume
branch
from
November 1, 2026 01:39
c5ef7a3 to
41fadbf
Compare
chen-ran
marked this pull request as ready for review
November 1, 2026 01:58
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.
Author
Type
Summary
普通任务在 Server 停机后创建新的续跑 run。如果工作区在前置检查后短暂不可用,初始化失败会直接结束新 run,原任务也不再进入恢复队列。续跑还缺少原请求锚点:读图反馈可能无法落库;当历史输出归入原 turn、实时输出却使用新 turn 时,同一回答或错误会显示两份。
resume_turn,携带原回答身份及已提交前缀;Web 在该 turn 内接续新输出。run 的执行身份、admission turn 和 fencing 保持独立,前缀也不会因本次 provider retry 被清掉。Related Issues
关联 #1391 的普通任务停机续跑路径。与 #1707 的
waiting_decision同 run 接管修复独立。Validation
已重基到 main
858b0fc52(包含 #1697、#1700),保留 checkpoint 历史读取逻辑。重基后及请求锚点精简后已重新执行相关检查与页面续跑;开发数据库使用 main 自带的 migration 170,本 PR 不新增迁移。-race:前置检查成功后,初始目标解析及后续 run-config 解析各失败一次,续跑仍完成读图;断言只有一份图片反馈、没有重复写用户请求、全部续跑输出归入原 turn,实时视图保留原前缀。在同一用例中验证意图保存请求 ID、再次停机的请求解析与决策 fallback;既有 history reset、steer/decision continuation 用例通过,无跳过。pnpm --filter @memohai/web typecheck、ESLint 和 UI contract 通过(contract 有 3 条既有 warning)。测试仅新增三个聚焦入口,复用既有 PostgreSQL 与前端 harness;没有复制额外的场景矩阵或把 QA 脚本提交到仓库。
Agent 浏览器验收
独立开发环境
memoh-resume-qa,使用仓库 dev compose、真实 PostgreSQL 与 containerd 工作区,页面为http://localhost:29082/bot/shutdown-resume-qa。在真实页面发送任务,实际执行一次
printf输出PREFIX_EXEC_OK,随后连续两次在模型流进行中重启 Server。原 run 和 C1 均记录为lost / session_runtime.interrupted,C2 自动读/data/qa-resume.png并完成。C1 没有写入自己的历史消息,恢复只能依靠其意图携带的请求 ID;最终页面保留原步骤且只显示一份回答。最新会话
7ec05459-ef1d-4073-a91a-cc6db4202b90:原 run50f05072…,C13944d28a…,C2ae9d1113…为completed。C1 运行时保存的请求 ID 和 C2 admission 中的请求 ID 都是88c5856d-132e-4421-9c27-4091ab0d7784。数据库只有一个原始用户请求,命令和读图各执行一次,图片反馈仍归入原 turn。Provider 请求记录确认收到图片输入。验证边界: 页面验收使用明确标注的受控 OpenAI-compatible Provider,命令和文件操作通过真实工作区执行。两次暂时不可用的故障注入在 PostgreSQL 集成测试中完成;没有在浏览器演练中人为断开工作区。未进行本 PR 的真实商业模型或 Codex 登录/对话验收,未重新部署 Cloud kind。以上均为 Agent QA。
Screenshots / Recordings
移除运行链回溯后,连续两次重启仍自动完成读图,保留原命令输出,最终回答只显示一次:
Human QA