Skip to content

Link App replies in private Lark conversations to their original questions - #9024

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/steward-thread-mirror-source
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/steward-thread-mirror-source

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

App questions and answers can use the same Core Turn and still arrive in the original Lark private chat as independent posts. Repeated or interleaved questions then lack a direct path from an answer to its matching question.

New answer mirrors include the provider-supplied link to the verified App question in the same Turn. The link is retained with the answer before sending. The same attempt can be read back after a restart, including when the source lookup stops returning the link.

Author Declaration

Written by an OpenAI Codex model agent in the GPT-6 family.

Implemented against the App-to-Lark projection and recovery sections of the App Conversation and Async Inbox RFC.

Criterion Disposition Symbol / path Test or command
Identify a reply's same-Turn App question in the original private chat implemented manager_returns.prepare_app_mirror_text and the existing Web projection outbox Original, foreign-chat, and unavailable-link cases in test_app_messages_and_answers_reach_the_original_chat_once_without_new_execution
Preserve the frozen provider attempt and replay guards implemented manager_returns._verify_web_mirror test_web_result_adopts_original_mirror_and_recovers_readback_without_send and the unknown/revoked mirror cases
Deliver the full response and original role attribution implemented Existing Lark Markdown and multipart projection Short and long manager follow-up results, exact provider readback, and unchanged source Turn

Scope And Continuation

The reply worker takes the link from the exact verified App question mirror. A missing, deleted, or foreign-chat link leaves ordinary body delivery available. Multipart question lookup uses the original receipt's last concrete post. The verified delivery intent retains the complete result and optional link. Existing started attempts recover their recorded text.

Native Lark reply placement and installed end-to-end acceptance remain open.

Validation

Tested revision 9a0e7a5a2a7d27bfd3a2ee9bb8ba660f4c28631a against 07722b169a4edea313f6a17d12dd73819e3f8843. The public regression uses synthetic Lark and real isolated Core/HTTP entrypoints.

Check kind Result Public-safe evidence
regression_parity passed The same assertion fails on the clean target base because the answer never includes the question link. The candidate distinguishes the links for two same-text questions and sends each canonical message once.
integration passed Scoped App and Lark return suite, 69 passed. It covers the original conversation, foreign and unavailable links, long responses, missing and revoked receipts, and restart readback.
static passed uv run --extra test loopx canary premerge --from-git-diff --git-diff-base 07722b169a4edea313f6a17d12dd73819e3f8843. Standard gate, bilingual RFC, module ceiling, and public-boundary checks passed.
manual not_run New link presentation in an installed Lark client and native reply placement.

The module budget records the expanded return formatter and lookup in the same diff for review.

Frontend / Visual Evidence

UI impact none for LoopX. The existing Lark post renderer receives the Markdown link verified in the wire fixture.

Type of Change

  • Bug fix
  • Documentation update
  • Test update

LoopX Area

  • Capability or extension
  • Host or runtime integration

Technical Direction

Operator surface and IM integration.

Shared-authority RFC fixture impact

N/A.

Boundary Checklist

  • The PR contains public-safe code, documentation, and synthetic verification.
  • The RFC sections are updated in English and Chinese.
  • The commit includes its DCO Signed-off-by trailer.

@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.2-sol · OpenAI (runtime_reported, max)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

[P2] 可选分片定位失败时会中断正常答案投影

原 App 长提问已验证,恢复出的辅助分片记录仍有原 intent 和 provider receipt,但分片列表为空。候选会在可选定位时抛出 IndexError,答案未发出。精确 base 的同一用例会正常发送并回读一次。请把无法解析的最后分片当作链接不可用,继续既有的授权正文投影。 相关代码

动机 / Motivation

App 与原飞书私聊共用一条会话时,重复提问也需要从答案找到准确对应的那条消息。原实现按 canonical 顺序发送提问和答案。此 PR 从同一 Turn 的已验证提问获取 AppLink。普通和长提问的链接可用时,答案携带对应链接并保留原正文。链接缺失时应继续交付原答案。本轮复核现有私聊投影和回读。飞书正式客户端显示及 native reply/话题布局另有验收。

改动思路 / Approach

复用当前私聊投影 owner、原出站 attempt 和 Markdown sender。链接固定在 answer phase,回读沿用原正文及冻结链接。新增读取在现有 outbox lock 内,限定已验证的同一 Turn 提问、provider 消息及原私聊;将可选数据用于正文前缀。实际请求回读覆盖 multipart 真正尾帖、provider 删除和超时、授权撤回,以及可选分片引用恢复时不可读这一反例。

具体改动 / Changes

精确 head 9a0e7a5a2a7d27bfd3a2ee9bb8ba660f4c28631a,diff base 07722b169a4edea313f6a17d12dd73819e3f8843,7 个文件 +137/-13。逐项复核 same-turn-private-link、frozen-attempt、optional-link-fallback。验收约定

关键代码讲解

  • 同一 Turn 只取唯一已验证提问,长提问在实际私聊投影中选最后一条分片。正例回读 provider 的 post,确认 md 元素带原链接和完整答案。源码
  • 删除的提问和可选查询超时都保留原正文。查询期间撤回 binding 时,现有 source/grant 检查阻止发送。源码
  • 历史及新 attempt 沿用同一发送记录。长短答案、provider 不再返回链接及重启后只走原回读。源码
  • manager_returns 的模块预算从 443 调为 497,新增内容集中在链接选取、冻结和同一 formatter。标准 gate 核对了实际模块量与双语 RFC。源码

对主干的风险 / Risks

独立对照均使用原 Core HTTP、私聊 outbox 和合成 provider。基线 5 项通过,候选 4 项通过并复现上述 fallback 回归。候选另有 116 项 manager-return 和 27 项 App/Lark 投影用例通过。标准预检 6 项直接与 14 项选中检查无阻塞,保留一项 base/head 相同的 interaction_contract advisory。

语义与 CI 对齐

RFC 要求可选链接不可用时保留原正文交付。provider 侧通过实际 post 的 md 元素核对格式,正式客户端尚未走验收。本次 RFC Lark CLI 链接实现 飞书消息格式

我的整体评价 / Verdict

请先让可选 multipart 读取对空或不可用的分片状态返回缺少链接,并用原 outbox 验证同一答案可以正常送达且只发一次。修复后可复用现有 provider 预览和回读。

English verdict: REQUEST_CHANGES. An unusable optional multipart question locator raises before the authorized answer can be sent. Preserve body delivery when the question link cannot be resolved.

@mergify

mergify Bot commented Nov 19, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

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 HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/steward-thread-mirror-source branch from 9a0e7a5 to b373013 Compare November 21, 2026 15:08
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 21, 2026

@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.2-sol · OpenAI (runtime_reported, xhigh)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审固定提交 b3730138c709b5f247b2d360da0b208d7209e976,merge base b422ace0ee2303094c3ba7e894f16d8fbe013fd7。与核对时 main d28ec76f424c7ae6095c2c4e486eb33b9e4a5b8e 三方整合无冲突。

[P2 · Blocking] 保留飞书 CLI 支持的负数消息位置

给同一私聊原提问的真实投影链提供 Lark CLI 支持的负数 position 时,最终发出的 Markdown post 只有完整回答,定位链接被静默省略。相同反例在当前 main 整合树复现。 用同一个校验器接受 provider 支持的带符号位置,保留 HTTPS 品牌域名和精确同一 chat 校验,并在实际私聊投影测试里增加负数位置以及重启后原 intent 读回。 候选位置

动机 / Motivation

从 App 继续原飞书私聊的用户需要在重复或交错问答中找回同一 Turn 的提问。 基线在原私聊中顺序投影原问答与完整正文,回复没有提问锚点。 候选将已核验的同一 Turn 的提问链接固化在回复 outbox,恢复时重读原发送尝试。

两条文本相同的 App 提问,经实际 Chat HTTP/Core→私聊 outbox→注入的 Lark provider runner。对照正数位置、异 chat 和无链接。 本地验证限实际 Chat HTTP/Core 和合成 provider。真实飞书客户端中的 AppLink 打开、原生回复位置及已安装桌面未验收。 现有交付规则

改动思路 / Approach

只有既有原私聊 App 镜像符合条件时才解析链接。没有原私聊镜像、原输入不可用或 provider 无可用锚点时沿既有正文路径。 原 Lark 私聊和 App Session 授权仍由现有 owner 核验。附加读取只选择一条已验证的原消息,链接不能变更接收方,重启不启动新的 Core Turn。 Lark CLI 的官方实现保留或生成 message_app_link,明确覆盖负数位置。本评审以其 chat/open 路径检验候选的 provider 边界。 Lark CLI #668

具体改动 / Changes

完整 diff 共 9 个文件,新增 247 行、删除 15 行。旧评审的空分片或缺少末分片导致正文不投影已闭环,三组末分片场景均送达一次。 上一轮评审

  • 同一私聊提问与原意图。按同一 Turn 的原已确认消息定位,重启保持发送身份和完整正文。

  • 同 chat 的官方位置格式。支持 provider 生成的同一私聊消息位置,兼容原正文回退。

  • _reconcile_web_projection。在已有 outbox 锁下按 Core 追加顺序取一条未完成的 App 消息。 精确代码

  • prepare_app_mirror_text。读取同 Turn 的唯一提问回执,并在首次 provider 预检前固化可用链接。 精确代码

  • _app_input_link。核验原已送达镜像的具体消息 ID、chat 和 sender type。长提问复用末分片的回执。 精确代码

  • _private_message_link。限定品牌域名、chat 路径、同一 chat 和消息位置。负数位置在这里被误丢弃。 精确代码

  • attachment_reply。损坏或缺少最后分片的记录抛出有界错误供可选定位回退。 精确代码

  • _verify_web_mirror。在恢复时按固化链接重建原正文并核验已确认的发送 identity。 精确代码

对主干的风险 / Risks

正位置、不同 chat、链接缺失、长文末分片、空或缺失分片以及恢复不重复发送均通过。精确头的定向套件 77 通过,精确 merge base 的旧问答镜像 1 通过。

旧镜像正常投影原提问和回答,未添加链接。 共用附件读者在空、缺少列表和缺少末分片尝试三种输入下都明确返回 ValueError,已存在的 App 输入反馈可以沿自己的回退分支继续。日常答复的角色归属和完整长正文在 provider wire 上已核对。

我的整体评价 / Verdict

REQUEST_CHANGES。 回归中分别检查发送前固化、恢复读回和正文降级,让负位置覆盖走真实 outbox。飞书客户端的实际跳转留在既有采用验收。

English verdict: REQUEST_CHANGES. The private App mirror drops provider-supported negative message positions. Accept the signed position while keeping the exact original chat check.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

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.

1 participant