Skip to content

Keep terminal returns pending until their message identity matches - #9222

Open
huangruiteng wants to merge 3 commits into
mainfrom
codex/terminal-return-receipt-20261121
Open

huangruiteng wants to merge 3 commits into
mainfrom
codex/terminal-return-receipt-20261121

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

The App request list and CLI unfinished-delegation agenda now verify that a terminal return receipt names the message derived from its request and result key. A missing or conflicting identifier puts the request in Return needs verification. The same row opens the original conversation.

For private Chat, the existing return worker reads the saved message from the original session. It checks the message identity, original Turn, exact result payload, and current source grant. It records a separate proof tied to the original receipt, result, and route. The original transcript and receipt stay intact. Missing or mismatching evidence keeps the request open. This recovery uses private Chat evidence. External returns and peer acknowledgements continue through their own evidence paths.

This addresses the independent review finding. The App inventory, CLI unfinished-delegation agenda, and manager-inbox status detail all read the same typed return projection. The CLI detail applies its existing Goal and audience checks before reading the resulting page. While proof is missing, the detail shows the pending verification state without a delivery timestamp. After confirmation, the detail and App show the timestamp of the original message.

Validation

  • The exact review of 550dcad found that CLI detail showed delivery while the App and CLI agenda still required verification. The extended regression reproduced this on both File and SQLite.
  • On current revision 7f5a657f768732d1afc2d49b5fd92335d2a09a69, both stores agreed across App HTTP, CLI agenda, and CLI detail while the wrong or absent receipt identifier was still unresolved. After the worker found the exact original message, App and detail reported its saved timestamp and the agenda cleared. Wrong Turn and result text stayed unverified. The original receipt and transcript bytes were preserved, and repeating the worker run performed zero additional deliveries.
  • The same scenario passed with an isolated wheel and its installed loopx executable in both stores. The packaged frontend asset bytes match 550dcad. Only the bundle manifest records the updated TypeScript source.
  • 233 Python tests, 86 TypeScript tests, the control plane typecheck, Ruff, the Chat build, and standard premerge passed.
  • An isolated source composition with #9204 at de5a83d passed 89 TypeScript tests and both File/SQLite cases. The composition reuses the prior three-file conflict resolution and adds the current patch. The branches are open for separate review.
  • The Windows job on 550dcad failed in the shared research fixture with WinError 10038. The fixture is byte-identical on that head, current head, and main. #9218 addresses that fixture and passed its native Windows check.
  • The hosted release artifact matches the integration tree for the current revision and passed 87 hosted browser cases. The wheel passed 233 Python tests after installation in a separate environment.
  • The source and installed CLI each completed five separately admitted and settled Codex App work turns on both File and SQLite. The same original delegation stayed in required context after its linked Todo was completed, while its reply was queued, and through two consecutive turns awaiting verification. The next turn omitted the delegation after the worker verified the original message.
  • A separate packaged Chat readback exercised File at 1440 px and SQLite at 390 px. The original conversation opened by keyboard in the narrow view. App and installed CLI detail agreed on the original delivery time, the neighboring queued return stayed pending, and a repeated drain processed zero results. The disposable browser fixture denied automatic session creation on startup and its no-write teardown assertion failed. The delegation interaction and the CLI assertions completed.
  • The follow-up used an ordinary registered Goal on File and SQLite with archived manager history. The packaged browser read all 16 pending records across two pages, opened the exact original conversation by keyboard, and recovered from an injected HTTP 503. During the outage the count was unknown. Verification moved the affected return to history and kept the queued neighbor pending. Both tests passed and the installed CLI reported the original delivery timestamp. The fixture returned HTTP 424 to the existing startup resume_latest request to model an unavailable archived executor. The delegation interactions made no writes, and the original session, transcript, and receipt were preserved.
  • The current Windows job reproduced four WinError 10038 failures in the same shared research fixture. GitHub review decisions still refer to older commits. Current-head independent review, remaining hosted checks, formally installed Desktop, and live Feishu qualification are open.

Visual evidence

Packaged Chat in Chromium with a synthetic SQLite workspace, 17 pending delegations, and mixed pending, queued, and verified history. At 1440 px the conflict has its own status. At 390 px the affected row wraps, and the original conversation shows the exact question and result once. The verified row moved to history and the neighboring queued return stayed pending. The disposable fixture declined browser session creation during startup on both versions.

Before at 1440 px (0c2fb28)

Before at 1440 px (0c2fb28)

After at 1440 px (550dcad)

After at 1440 px (550dcad)

Before at 390 px (0c2fb28)

Before at 390 px (0c2fb28)

After at 390 px (550dcad)

After at 390 px (550dcad)

Original conversation at 390 px (550dcad)

Original conversation at 390 px (550dcad)

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 终态回执冲突被投影成仍在等待发送。 File 与 SQLite 的私有原会话中,匹配原请求和 Turn 的真实回复仍在。终态回执缺标识或标识指向另一回复时,四个准确头对照均留在 await_return_delivery。现有返回 worker 每组处理 0 条,回执字节和消息均不变,App 继续显示待处理。 复用已有证据恢复分支,明确标出终态回执的身份冲突及可走的原会话验真路径。仅在匹配原消息、请求、Turn 和结果时重新确认原证明,保留原回执和实际结果,避免重发。 读取位置 返回 worker

动机 / Motivation

已在原会话收到结论的操作者,以及需要依据 CLI 未完成事项决定下一步的 Agent。 主干只看存储的 delivered 标志,错误或缺失的消息标识会让事项从两处消失。 File 与 SQLite 的私有原会话中,匹配原请求和 Turn 的真实回复仍在。终态回执缺标识或标识指向另一回复时,四个准确头对照均留在 await_return_delivery。现有返回 worker 每组处理 0 条,回执字节和消息均不变,App 继续显示待处理。 回执冲突应使两处都保持 pending,指向可验证的原会话恢复路径,并避免重复发送。 本轮验证原会话结果的终态回执、App 请求清单和 CLI Agenda。正式安装、Feishu 与远端 CI 各自保留验收。

改动思路 / Approach

同一个 TypeScript 读取器为 App 和 CLI 生成结果状态。返回 worker 持有发送和确认的所有权,发现终态冲突需要从这条边界给出一致处理。 保留现有回执身份和返回 worker,只调整本 PR 涉及的冲突状态及恢复提示,沿用原消息可核验条件。 错误标识已经不会被展示成已送达。用现有证据恢复分类表达冲突,保持只读入口与发送分离。

具体改动 / Changes

评审当前提交 0c2fb28 与当前主干 b4e1ded。6 个文件,新增 106 行、删除 24 行。 核对两个读面共用状态、原生 worker 的终态规则、消息身份和 peer 结果边界。#9204 的已批准范围是 Inbox 返回读取预算,分别验收。 #9204

关键代码讲解

A6 的现有身份和 peer 路径保留。A8 和 A28 的恢复与明确行动仍有缺口。A10 更广的 Feishu 和打包 App 仍待验证。 接受规范

对主干的风险 / Risks

真实 HTTP 请求、CLI Agenda 和返回 worker 对照覆盖 File 与 SQLite。精确头的正常终态无滞留,错误或缺失标识确实重新显露;主干同样四个反例均将请求隐藏。99 项定向 Python 与 84 项 TypeScript 检查通过。 quick premerge 的 4 项直接检查、Python 编译和 2 项目录检查通过。源头与当前主干可无冲突合并。 File 与 SQLite 的私有原会话中,匹配原请求和 Turn 的真实回复仍在。终态回执缺标识或标识指向另一回复时,四个准确头对照均留在 await_return_delivery。现有返回 worker 每组处理 0 条,回执字节和消息均不变,App 继续显示待处理。

语义与 CI 对齐

当前读面已修复错误的已送达状态。同一原消息存在时,重复唤醒现有 worker 仍无法完成该项。没有发送副作用,两个存储的回执和消息保持原样。未查询远端 CI,也未运行已正式安装 App 或真实 Feishu。

我的整体评价 / Verdict

请求修改。保留当前对错误消息身份的保护,并让 Agenda 指向真实的修复路径。复用已有证据恢复分支,明确标出终态回执的身份冲突及可走的原会话验真路径。仅在匹配原消息、请求、Turn 和结果时重新确认原证明,保留原回执和实际结果,避免重发。 本次更改服务端状态与 Agenda。现有界面样式及打包视觉未做复验。

English verdict: REQUEST_CHANGES at 0c2fb28. The new view restores visibility but queues the operator to await a delivery the existing worker skips as terminal, even when the original reply is still present. Expose scoped evidence recovery without duplicating the original send.

|| error !== null && (typeof error !== "string" || !DELIVERY_ERRORS.has(error))) {
status = "explicit_unverified"; error = "delivery_state_unreadable";
}
if (status === "delivered" && phase === "conclusion" && row.source_kind !== "peer"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 终态回执冲突被投影成仍在等待发送。File 与 SQLite 的私有原会话中,匹配原请求和 Turn 的真实回复仍在。终态回执缺标识或标识指向另一回复时,四个准确头对照均留在 await_return_delivery。现有返回 worker 每组处理 0 条,回执字节和消息均不变,App 继续显示待处理。 复用已有证据恢复分支,明确标出终态回执的身份冲突及可走的原会话验真路径。仅在匹配原消息、请求、Turn 和结果时重新确认原证明,保留原回执和实际结果,避免重发。

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] CLI 详情在原会话回执核对前显示已送达。 四组 File/SQLite 对照中,App 和 CLI 待办仍显示回传待核对时,manager-inbox status 已报告 delivered。 操作者从待办打开详情后会得到相反结论,可能提前停止跟进。让详情在完成原有作用域检查后读取和 App、CLI 待办相同的 TypeScript 回执投影,并给三个正常入口加入同一组核对前后断言。 投影分支 详情读取

动机 / Motivation

在原会话等待委派结论的用户,以及通过 CLI 查询该委派是否仍需跟进的操作者。 旧提交能看出回执的消息标识有问题,但待办把它归为等待发送,返回进程也不会再核对这条终态回执。 当回执没有原消息标识或指向另一条消息时,原会话里已有结果仍可核对。修复后,App 和 CLI 待办会保留这项工作,直到从原会话确认已有消息,然后自动结束待办。 同一请求的清单、待办和详情在核对前应都提示待核对,确认后都显示已送达,用户只收到一次结论。 本次修复覆盖私有 Chat 中已留存的终态结论、App 委派界面与 CLI 读回。外部提供方和 peer 消费仍走原路径。

改动思路 / Approach

返回进程在原会话和当前授权下验证已保存的消息,读取端消费同一份验证事实。 保留独立核对证明与现有返回事务,在本 PR 内接齐已暴露给操作者的详情读面。 当前实现把原回执、结果正文和返回路由绑定到一条独立证明。原会话匹配后,worker 保存证明,让 App 和 CLI 待办重新计算状态。把同一读取结果接到 CLI 详情,可以解决报错前后的不一致,也能沿用原有授权范围。

具体改动 / Changes

评审提交 550dcad7da45fa0320b4a0d462fc2064fef95404,对照合并基点 b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab 和上一评审提交 0c2fb28ccfc0ff6b3dc80d8cda89b1024fbeee6a。12 个文件新增 319 行、删除 40 行。生产变更涉及返回事务和回执证明、App 与 CLI 的读取适配,以及委派界面的状态和原会话详情。作者给出了与 #9204 的源码组合验证,提到三处文件重叠。组合结论沿用作者证据,本次独立测试在 #9222 单独提交上完成。 RFC 接受标准 #9204

关键代码讲解

  • scanPrivateReadback 只把符合私有原会话条件、尚无匹配证明的终态结论交给原返回事务。普通排队和已有提供方凭证走保留分支。 worker 扫描
  • _deliver_return 通过已授权路由和确定性的消息 ID 读取原会话,再经现有事务写入证明。这个分支不会追加会话消息,也不会调用外部发送器。 原会话恢复
  • observeTerminalReturn 校验原 Turn、消息身份、角色、来源、正文和时间。证明绑定回执、结果和路由,对其中任一记录的替换会要求重新核对。 证明契约
  • replyStatuses 消费证明并向 App 和 CLI 待办提供 explicit_unverified 或 delivered。CLI 详情还从旧回执读取裸状态。 共享读取 CLI 详情
  • returnNeedsVerification 用现有 recover_evidence 和 manager_return_payload_conflict 显示「回传待核对」,普通读取失败依旧使用原文案。 界面状态

规范映射。 A6 在本差异内保留既有请求、结果和 peer 消费身份。A7 的重复执行保护通过本地回执和消息字节对照,本轮覆盖该分支。A8 的私有原会话核对已实现。A10 的已授权读取状态一致性和 A28 的 CLI 原始详情同状态要求还有上述缺口。A10/A28 中的真实 Feishu、打包键盘及更广规模验证待验。

对主干的风险 / Risks

PASS 211 项定向 Python、83 项 TypeScript、控制平面类型检查和本地 quick premerge 通过。 普通已核验终态、正常排队、原会话正确回传、peer 消费与授权限制的定向检查通过。 四组均只核对一次,第二次处理零项,原回执字节和会话消息不变。原消息 Turn 或文本不符的仓库测试也保持待核对。

FAIL 四组 File/SQLite 对照中,App 和 CLI 待办仍显示回传待核对时,manager-inbox status 已报告 delivered。 在旧提交中,详情已沿用原始 delivered,旧待办停在 await_return_delivery。本提交修好了待办和 worker,因而有了可执行的核对路径,详情却仍跳过它。核对成功后,App 的送达时间来自原会话消息,详情仍显示旧回执时间。

UNVERIFIED 截图来自合成 SQLite 工作区,本次独立执行覆盖 HTTP、CLI 和本地返回进程,打包交互、键盘流程、真实 Feishu 与远端 CI 未独立验证。

语义与 CI 对齐

这条新分支按结构化身份和现有状态启用,没有新增设置、激活入口或命令。新增的私有核对记录带本地 schema,投影继续沿用注册的交付状态、错误和待办步骤。File 和 SQLite 都通过了原消息不匹配的保护、一次性核对和无外部发送检查。远端 CI 本轮未查询,本地检查和远端状态分别作为证据。

我的整体评价 / Verdict

请求修改。长期执行方面,旧问题已关闭,返回进程现在能核对原结果并恢复推进。用户体验方面,从待办进入详情会在核对尚未完成时看见已送达。让详情在完成原有作用域检查后读取和 App、CLI 待办相同的 TypeScript 回执投影,并给三个正常入口加入同一组核对前后断言。 复审时按同一请求核对顺序检查三个读面,同时保留事务的一次性验证和原会话权限边界。

对比了作者提交的前后打包截图。冲突行从「待送达」变为「回传待核对」,相邻状态与分页仍可辨认,窄屏展开能看到原问题及一条结论。 截图来自合成 SQLite 工作区,本次独立执行覆盖 HTTP、CLI 和本地返回进程,打包交互、键盘流程、真实 Feishu 与远端 CI 未独立验证。 桌面截图 窄屏截图

English verdict: REQUEST_CHANGES at 550dcad. Private return recovery works without resend. Four File/SQLite checks show detailed CLI status reports delivery before the shared projection verifies the receipt. Read the same typed projection in the detailed CLI path.

deliveredAt = confirmedTerminalReturn(readback.value as JsonObject, state, reply, route);
}
} catch (failure) { if (!recordFailure(failure)) throw failure; }
return {...identity, status: deliveredAt === null ? "explicit_unverified" : "delivered",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] CLI 详情在原会话回执核对前显示已送达。四组 File/SQLite 对照中,App 和 CLI 待办仍显示回传待核对时,manager-inbox status 已报告 delivered。 当前详情读取。让详情在完成原有作用域检查后读取和 App、CLI 待办相同的 TypeScript 回执投影,并给三个正常入口加入同一组核对前后断言。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants