Repository navigation
fix(control-plane): preserve original-Turn closeout after automatic archival - #8264
Conversation
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com>
…chive-closeout-20261107 Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.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
[P2] 终结时保留归档 Todo 的原验收证据。 已通过验证、写回并扣账一次后,只修改终结命令的 --evidence,File 和 SQLite 都会写入替换后的证据。返回的仍是原验证回执。随后拿原证据重试会得到幂等回放,Todo 回读却仍指向替换后的证据。归档终结应沿用已接受的 evidence,并拒绝不同的证据参数。 证据写入
动机 / Motivation
执行一轮已验收任务的 Agent 需要完成结算,并能在丢失响应后凭原身份取回结果。 在 101 个 Todo 的合成状态下,普通完成会归档当前 Todo。旧版已写回并扣账一次,终结命令仍报 todo_archived。 用原验收证据重试时,修复版在 File 和 SQLite 上都能终结并回放,验证器、写回和扣账各执行一次。 这次验证覆盖源码 CLI 和两个隔离的权威后端。实际宿主采用和完整成本仍待验。 当前提交还允许在终结时替换已归档的验收证据。
改动思路 / Approach
在既有 TypeScript 生命周期里复用同轮校验,只给归档记录补上终结状态。 新增的入口沿用同轮 fence 和普通完成回执。源文本摘要、原 claim、当前权威状态与 provider CAS 继续约束这次写入。无需改变归档阈值或重跑已验收的任务。当前还要约束复用的终结写入,避免把归档前已有的证据覆盖行为带到归档后。 父回执检查
具体改动 / Changes
关键代码讲解
- readSameTurnCompletionReceipt 从相同 Goal、Todo 和 Turn 找到普通完成回执,并核对原验证。缺失或错配的回执会拒绝。 实现
- executeCoordinationTodoTerminalLifecycle 在拒绝归档 Todo 前允许原 Turn 的终结通过。同轮写回和扣账仍是前置条件。 归档分支
- terminalRequestSha 和 terminalTarget 在普通 Turn 模式下沿用旧摘要,摘要没有绑定 evidence。新分支随后进入共用写入,直接使用调用方提交的证据。 摘要 写入
按 abf1442 的 docs/reference/canonical-terminal-review.md 核对 original-turn-chain、premature-closeout 和 receipt-recovery。原证据路径能按顺序终结并回放。普通完成后、写回扣账前仍会拒绝。与 #8161 集成的四种 File/SQLite 对照也通过,整体 Goal 检查失败时,局部 Todo 可以完成,原 Goal 的失败和检查次数均保留。 原契约
对主干的风险 / Risks
同一真实验证器在两种后端各执行一次。原证据对照保留完成时间、归档状态和一次扣账。替换证据的反例也返回通过的旧回执,因此应额外检查权威 Todo 中的证据字段。基线的 active SQLite 路径已有覆盖行为,基线归档路径拒绝写入。本提交把这条写入扩到了归档记录。请在现有 CLI 回归里加仅变更 --evidence 的反例,再验证原命令仍可终结并回放。 现有回归
语义与 CI 对齐
沿用原 completion_turn 和 no_followup,没有新状态值。10 项 CLI、212 项 TypeScript、类型、Ruff 与快速 premerge 均通过。主干 2659e5f 的合并预检及双语检查通过。严格 CQR 因归档证据反例未通过。PostgreSQL 结果来自作者,托管 CI 按策略保留未知。
我的整体评价 / Verdict
原 Turn 的归档终结恢复值得保留。归档终结应沿用已接受的 evidence,并拒绝不同的证据参数。 可以沿用历史指纹,在新归档分支约束证据字段,保留原验证和回放。改动集中在原生 CLI 结算和 Todo 回读。修订后需复测 File 和 SQLite 的精确输入与证据替换。新提交的 Goal 检查对照已经通过,终结证据覆盖仍可复现。实际安装、采用和完整成本仍待单独验收。
English verdict: REQUEST_CHANGES. Keep the original accepted evidence when closing an archived Todo. Both native backends currently let changed evidence overwrite the archived record while replaying the original validation.
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.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
动机 / Motivation
Agent 已经验证并完成 Todo,但自动归档发生在这一轮结算结束之前。 基线允许写回和扣额,最后一步却以 todo_archived 拒绝,原轮次留在未终结状态。 同一组 101 条合成 Todo 在基线扣额一次后无法终结。旧提案可以终结,却能只改证据指针并复用旧回执。修订后原证据可以完成结算,替换会被拒绝。 真实 File 和 SQLite 均可读回原证据、原完成时间和四步回执,验证、写回与扣额各发生一次。 评审聚焦这条源码 CLI 路径。分发拆包、实际宿主采用和完整成本属于后续验收。 审查修复后的 wheel、受控进程中断和重启仍需在 R1/V4 旅程单独验证。
改动思路 / Approach
把同一父回执核对提到归档分支前,active 路径共用这一个 helper。已接受的证据随新归档终结回执保存,重放沿现有 receipt owner 读取。 本 PR 交付原轮次在自动归档后的终结与回执恢复,继续使用现有 CLI、CAS 和归档规则。
先定位相同轮次的普通完成,再以它为依据完成终结。提高归档阈值只会延后故障,直接移除归档检查则会放开其他归档任务。这里沿用原 claim、来源摘要、验证与扣额,并用同一 provider 的条件写入保护原结果。回执丢失后,现有 CLI 用原身份取回既有结果。
具体改动 / Changes
评审提交 7ec8d19b9501cdf058a088bc509456e13dd65677,实际差异基线 10f66ec5e5586453a5579e9943b189bba84698ca。4 个文件,+381/-48。按基线 10f66ec5e5586453a5579e9943b189bba84698ca 的 docs/reference/canonical-terminal-review.md 核对 original-turn-chain、premature-closeout 与 receipt-recovery。三项都由实际 CLI 回读覆盖。 原规范
关键代码讲解
readSameTurnCompletionReceipt复用既有 fence,要求原 actor、claim、验证声明和回执继续匹配。归档分支只有通过这个检查才能进入原终结事务。 父回执completionEvidenceRejection拒绝不同的显式证据。第一次终结读归档 Todo,后续重放读新回执保留的原证据值。历史 fingerprint 保持可读,原来的终结时间和归档状态得以保留。 证据核对 · 回执字段test_original_turn_closes_automatically_archived_todo_once在 File 和 SQLite 上各组合有无失败的整体 Goal 检查。它验证局部完成不改写整体失败,也不重跑任一验证。英中 RFC 保留旧失败和后续分发资格边界。 真实 CLI 回归 · 英文 RFC · 中文 RFC
对主干的风险 / Risks
我用独立合成结果复跑了基线、旧提案 12627eff8005b900d8c1b99589de02a8a481a8aa 和新提交。两个后端的基线均在一次扣额后拒绝归档终结。旧提案接受替换证据,新提交在首次终结和重放都拒绝。带有效说明但首次省略证据时,原证据、完成时间和一次验证均保留。另一个已注册 actor 被拒绝。已有 active 路径对照一致。原任务无需重新认领,也无需重新执行验证器。
当前 13 条及基线 9 条聚焦 CLI 检查通过。当前 TypeScript 类型检查、Python Ruff、双语 RFC 和 5 个直接、4 个选中 quick 检查通过。当前另有 284 条定向 TypeScript 检查通过。较广的 TypeScript 组合在两侧均达到本轮六分钟时限。本次结论采用已完成的实际 CLI 对照、定向验证和类型检查,较广组合的整体结果保留为未完成。严格质量回执 cqr_a2dd87b0f854edb47359 已通过并读回。 远端 CI 按策略未查询。
语义与 CI 对齐
本改动复用原生命周期词汇与回执身份。新增的回执值承载原归档证据,既有前置结算和拒绝规则继续执行。无须改动归档阈值、注册规则或 Goal 验证。DCO 逐提交检查通过。
我的整体评价 / Verdict
改动位于现有 CLI 结算和 Todo 回读,未触及 App、Lark 或浏览器布局。 独立证据覆盖源码 CLI 的 File 和 SQLite。原生 Windows、真实 PostgreSQL、安装态、打包重启和长期成本留待验证。 原轮次可在自动归档之后完成原结果的终结,重试也继续返回已有验证和扣额。范围集中在现有终结 owner 与一组直接回归,适合独立交付。旧提交的证据替换已在两个真实后端修复。
English verdict: APPROVE for 7ec8d19b9501cdf058a088bc509456e13dd65677. Matched File and SQLite source CLI runs confirm original-Turn archived closeout, once-only validation and debit, and rejection of changed evidence both before commit and on replay.
With 101 Todos, ordinary completion can archive the selected Todo after its validator succeeds. Its original Turn must still finish writeback, one quota debit and terminal closeout. This proposal recovers that archived closeout through the existing TypeScript fence and exact ordinary-completion receipt, preserving task digest, claim/lease, validation, source and provider CAS checks.
Independent review of
12627eff8found that closeout could replace the accepted evidence while returning the original validation receipt. The revised archived branch rejects different supplied evidence. New archived-closeout receipts retain the accepted evidence for receipt-only recovery, so changed retries are also refused. Historical request fingerprints and older receipts remain compatible. Active completion and archive thresholds retain their behavior. Omitted or empty evidence can replay with a valid completion note; the existing CLI note/evidence requirement remains enforced.101 个 Todo 时,局部验证完成后可能先被自动归档。修订让原 Turn 通过既有 fence 和父 receipt 完成终结,同时拒绝首次终结和回执重试中的证据替换。原 evidence、validation receipt、完成时间和一次扣账保持稳定;整体 Goal 检查失败时,局部完成仍可终结,整体检查继续失败且不被重跑。
Author validation at
7ec8d19b9501cdf058a088bc509456e13dd65677against target main10f66ec5e5586453a5579e9943b189bba84698ca:Standard premerge passes five direct checks and 17 selected catalog, risk-profile and public-boundary checks, with no failures or manual holds. Goal policy leaves change-quality qualification disabled; this is not an independent review or a merge-readiness result.
The paired RFC retains the frozen failed large-state episodes, historical missing-PostgreSQL skips and the prior rejected head. The shared parent-receipt helper and local evidence predicate are the bounded refactor; the replay check adds no fresh authority read. Installed-host adoption, reviewed-repair monolithic-wheel readback, guard/parser cost, interruption/restart, split installation, full R0/V10/R1, M1, context/model composition and complete-cost outcomes remain open. I3 retains at least one minor release. Independent review of this exact revised head remains required. The public-boundary scanner emits an existing synthetic
Authorization: examplefixture marker; the changed lines were inspected separately and contain no credentials or private state.