Skip to content

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

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/steward-thread-mirror-source
Open

loopx-agent wants to merge 1 commit 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.

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.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.

if original.get("verified") is not True or not isinstance(original.get("attempt"), Mapping):
return None
try:
_, attempt = attachment_reply(project=transport.runtime_root, config_path=transport._inbox(row),

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.

独立用例先通过真实 outbox 验证长提问的多个分片,再让恢复的辅助记录保留同一 intent 和 provider receipt,分片列表为空。attachment_reply 的末分片读取抛 IndexError,这里的 fallback 没有接住,后面的正文投影未执行。精确 base 在完全相同的状态成功发送并验收一次。请校验可选定位的分片形状并回退到原正文。

@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

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

needs-rebase Mergify: the pull request has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant