Skip to content

Recheck the original Lark message before a recovered reply - #8845

Merged
huangruiteng merged 2 commits into
mainfrom
codex/restore-interrupted-steward-answer-20261116
Nov 16, 2026
Merged

huangruiteng merged 2 commits into
mainfrom
codex/restore-interrupted-steward-answer-20261116

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

A Steward can recover an answer by reviewing the original interrupted request or by reading a retained native result. A retained result can supply the missing first reply or follow an earlier failure notice. An edit or recall of the original Lark message during the final reply preview could still let any of those paths send the old answer.

Check the frozen input in the existing outbound source verification. The source proof joins the current binding, exact request, Session and Turn with the provider observation. An edit or recall holds delivery even after a successful preview. The same completed result can be sent once when the original source is observable again. The original Turn and any earlier failure notice remain available for history.

Author Declaration

Written by model_agent (OpenAI Codex). The recovery contract requires the original payload and independent per-attempt delivery readback.

Criterion Disposition Verification
Correlate a recovered answer with the admitted source through the final provider write Implemented Edited and recalled source coverage for interrupted answer review, a retained result used as the first reply, and a retained result sent after a failure notice.
Keep current App, audience and source proof for existing delivery and retries Implemented Lark source-authority and reply-context suites, plus preserved lost-acknowledgment, stopped, closed, historical and post-image recovery cases.

Scope And Continuation

The Lark transport applies one frozen-source matcher at recovery admission and outbound verification. Outbound verification reuses the current provider source read, and re-reads the exact Core request for a recovered answer. Only image attachment delivery supplies the optional text constraint to the generic source check. The private conversation module goes from 2,583 to 2,568 lines.

#8837 carries the independent old presentation-key fixture correction on main.

Validation

Tested 83c33d9033939b01a52ab8ae78bad5d0eb3e1da2 against main at f38fae05bb9a1c2cc54a2641359224cc253d32ac. The provider and native-host inputs are synthetic and exercise the persisted local Chat runtime.

Check kind Result Public-safe evidence
regression_parity passed Two interrupted-review cases sent the old answer on main. At the previous PR head e69186cd52, all four retained-result cases still sent it. The current head holds both mutations across all three paths, then verifies one delivery from the same result when the source matches.
real_entrypoint passed 100 source-checkout cases. The original source-authority group passes 27/27, including the nine cases held by an unused default keyword on main.
integration passed Built and verified the Chat bundle and wheel from this commit. All six source-edit and recall cases passed with the production transport and Core imported from the unpacked wheel.
integration passed 161 cases in the full interrupted-answer suite with #8837 at 9eb2bacaed applied locally.
static passed Ruff and standard diff premerge. Six direct checks and ten selected checks passed.

Hosted CI and independent review are pending on this head. Live Lark and an installed native host are unverified.

Frontend and Visual Evidence

UI impact none. Source verification holds the existing outbound Lark reply.

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Capability or extension

Shared-authority RFC fixture impact is N/A for this Lark transport change.

Boundary Checklist

  • Checked the diff and description for private state, raw evidence, secrets, internal links, and machine paths.
  • Verified the PR scope, paired RFC diff check, and DCO sign-off.

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 loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

评审提交 83c33d9033939b01a52ab8ae78bad5d0eb3e1da2,主干 f38fae05bb9a1c2cc54a2641359224cc253d32ac。

动机 / Motivation

在 Lark 里询问 Steward,并在工作进程恢复后等待原问题答案的用户。 主干在恢复准入时检查原消息。在最终发送预览期间编辑或撤回原消息,仍会发送依据旧输入生成的答案。

候选在最终写入前重读原消息。编辑或撤回的六个用例均零发送。原消息重新可验证后,复用同一完成结果只送达一次。 本次覆盖中断后核阅、保留结果的首次回复和失败通知后的补发。工作续跑仍由原 Core 请求拥有。

改动思路 / Approach

复用 Lark outbound 现有 verifier 及 Core 持久请求,避免新建第二份权限和生命周期。 将冻结来源匹配用于原恢复准入和现有最终发送确认。持久状态、执行范围和 provider receipt 继续从原 owner 读取。 只在恢复准入检查原消息仍会遗漏最终预览与发送之间的变化。保留现有写前 provider 读和回执,缩小改动范围。

具体改动 / Changes

完整差异 4 个文件,+134/−45。将原消息比较集中到原 transport,扩充恢复核阅、首次回复和失败通知后补发的六个时序反例。

关键代码讲解

  • recovery_source_matches。对比原文本或 post 与原 Core 记录,撤回及未知输入拒绝。 过期输入不进入最终发送。 代码
  • LarkPrivateConversations._source_message。最终回读当前 App binding、原请求的五个绑定字段和最新 provider 消息。 精确恢复候选沿既有出站 verifier 使用。 代码
  • LarkPrivateConversations._deliver。图片回复才给普通 verifier 额外文本参数,文本恢复用同一最终来源核验。 送达继续由现有 Inbox phase 与 provider receipt 验证。 代码

docs/reference/protocols/manager-evidence-and-continuity-v0.md 在 f38fae05bb9a1c2cc54a2641359224cc253d32ac 的 Original payload 与 Independent delivery readback。前者核对已冻结输入、当前 App binding 和原请求,后者要求对同一尝试验证送达。两项均在三条恢复路径读回。 契约

对主干的风险 / Risks

同一合成用例主干 6 失败、候选源码与 wheel 各 6 通过。源鉴权与历史上下文的邻接组 43 通过。lost ACK、Stop、晚到问题和 post 图片的定向组 26 通过。 补发测试保留已有失败通知,恢复源后从同一结果送达一次。现有 App 撤销、目标不匹配和原源被替换时零写入。 恢复反例

6 项直接和 10 项选定的本地 premerge 检查通过。完整候选套件 699 通过。12 个历史 Codex 回复呈现 fixture 在主干和候选有相同的旧 phase key 错误。#8837 仍是独立未合入的修复。 独立修复 #8837

我的整体评价 / Verdict

APPROVE。 已验证冻结的原问题与恢复答复在实际发送前保持关联,现有回执仍支持后续恢复。本轮未见阻断发现。变更在 Lark 传输送达条件,用户可观察回复与否,界面渲染沿用原路径。 真实 Lark、在线 provider 网络行为和已安装的原生宿主待验。 远端 CI 未查询。

English verdict: APPROVE at 83c33d9. All recovered reply paths recheck the original message before delivery and preserve a once-only return when the source can be verified again.

@huangruiteng huangruiteng 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 · Codex · OpenAI · self_reported

动机 / Motivation

中断后的管家答复可能从已保留的原 Turn 重新投递。若用户在原请求预览后、最终发送前编辑或撤回 Lark 消息,旧实现仍可能把已完成的答复发到一个不再有效的来源。恢复必须只复用结果,不能绕过来源仍有效的条件。

改动思路 / Approach

保留原有 Turn 和 native-result recovery,不做模型重放;在最终发送前用同一个冻结来源身份重新读取 Lark 消息,并要求内容、撤回状态、聊天气泡和发送目标仍一致。预览后发生变化时记录待恢复状态并停止发送,来源恢复后仍可沿原回执完成一次投递。

具体改动 / Changes

当前 head 83c33d9033939b01a52ab8ae78bad5d0eb3e1da2 在 private_conversations.py 与 private_ingress.py 中统一最终来源校验,覆盖 worker recovery、interrupted answer 两条保留结果路径。测试新增 source-edited-at-send 和 source-recalled-at-send,验证最终发送前变化会拒绝投递、不会新增 provider write,随后重试也保持 pending;原消息恢复后仍只发送一次且不创建新 Turn。

对主干的风险 / Risks

无阻断发现。新增检查位于实际 Lark 送达边界,普通发送和已验证的历史恢复继续走原路径;失败会保留恢复状态而非丢弃结果,因此 provider 短暂不可用或来源稍后恢复时仍可继续同一次投递。验证包含 160 个相关用例通过,以及 6 个针对发送前编辑或撤回的定向变体全部通过;真实在线 Lark、provider 网络行为和安装态宿主未在本地环境验证。

我的整体评价 / Verdict

APPROVE。该改动把“恢复已完成答复”与“来源仍然有效”重新绑定,阻止发送到已编辑或已撤回的消息,同时保留一次恢复和原 Turn 身份。

English verdict: APPROVE at 83c33d9. Both retained-answer paths recheck the original source before delivery, late edit/recall cannot write, and the frozen source can recover exactly once without replaying the model.

@huangruiteng
huangruiteng merged commit e567e31 into main Nov 16, 2026
39 of 49 checks passed
@huangruiteng
huangruiteng deleted the codex/restore-interrupted-steward-answer-20261116 branch November 16, 2026 05:06
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