Skip to content

fix(lark): retain quoted source in native Chat replies - #6744

Merged
loopx-agent merged 2 commits into
mainfrom
codex/lark-native-reply-context-20261017
Oct 17, 2026
Merged

loopx-agent merged 2 commits into
mainfrom
codex/lark-native-reply-context-20261017

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

A concise native Lark reply could quote the exact Bot message while Core received only the follow-up text. The existing legacy Goal Topic path retained that reference, but native private/group conversations bypassed it. This connects native ordinary replies to the same bounded TypeScript projection: the referenced observation reaches the model together with the current request.

Author Declaration

Written by: model_agent — GPT-6 family / OpenAI (Codex).

Implemented against semantic handoff §5.11, revision c7061d7acec7e87b049a567788b8070bde4895fd; intended base: main.

Criterion Disposition Implementation / evidence
Retain exact references, distinguish unavailable context, bound observations implemented Existing enrichment and conversation_reply_context; native provider/protocol regressions and an authorized read-only live-provider probe
Quotes grant no instructions or authority; preserve original audience and immutable accepted requests implemented Current-message command selection, authenticated ancestry, fresh Core binding fences, frozen new input and legacy replay coverage

Scope And Continuation

The Lark adapter checks the authenticated source envelope and reuses the shared projector. The enrichment helper accepts this invocation's already-read current envelope, avoiding a redundant lookup. Deleted quoted content is omitted through the common text extractor. There is no approval-keyword classifier or new approval owner.

New ordinary quoted input is frozen before Core admission. Parent edits cannot change its replay representation; already accepted older requests retain their original message. Controls and unquoted input keep their existing path. Tests retain group isolation, media, queued progress and stop behavior; the synthetic host's wait trigger now evaluates the current input rather than quoted history.

This completes the source-context transport repair. Installed model interpretation, a new user approval's actual application and deployment/rollback qualification remain on the existing native Chat delivery path. No old completed Turn is replayed to compensate for its missing context.

Validation

Tested revision: 7bfa5df9e1c7b9c5d755feece7a5fe3c9ba34bc7. Run state: finished. Input classes: synthetic, public_fixture, authorized_private_read_only.

Check kind Result Evidence / limitation
regression_parity passed Failing-before native reply retains only the short answer; repaired source carries the exact reference.
integration passed 339 broad regressions passed at 1809cc074a5fbcdb9c486cae298486bc1d3b71b9; the final head adds two recovery tests and preserves all production, docs, fixture blobs and existing test bodies. All 15 native reference tests pass with those additions. Real Chat store/protocol subprocess and synthetic host/provider responses.
real_backend passed Read-only live Lark App verification and exact source/parent lookup recover the referenced scope through the candidate adapter/projector. No live send, model run or approval execution.
static passed Ruff, configured Mypy (17 declared modules), semantic advisory and public boundary scan. An extra adapter-wide strict Mypy run fails identically on base/head: 4,898 existing normalized diagnostics, zero introduced; full adapter typing is not claimed.
integration passed Exact-head standard premerge: 6 direct checks and 11 selected checks pass. Goal change-quality policy is disabled; no quality receipt is claimed.
manual not_run Installed-model interpretation and packaged frontend adoption remain separate qualifications.

Frontend / Visual Evidence

Existing rendering, layout and controls are unchanged; the native conversation's model input now includes the reference projection. No new UI or settings surface. This source/provider validation does not certify installed frontend behavior.

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 family · OpenAI · self_reported (exact build unavailable)

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

动机

受影响的是通过飞书私聊或已绑定群话题回复 Bot 的用户。用户引用预览通知后只答“Approved”,旧入口只把短句交给模型;新入口同时提供受限引用和当前请求。已验证模型输入能保留准确引用,原会话、命令分流和既有授权保持不变。本次不新增批准执行器,不重跑旧 Turn,也不扩大个人或群聊权限。安装后的模型理解、实际业务操作和完整 App 体验仍需按既有交付链路验收。

改动思路

保留一个共享引用语义 owner;新增部分只负责原生飞书来源核验与已有回执中的不可变输入快照。当前 PR 完成原生入口到模型输入的引用传递和重试保护;安装、模型理解与完整 App 呈现继续沿既有原生 Chat 交付路径验收。不改动时,提示词无法凭空补回已经丢失的引用;单独新增批准分类器又会重复现有语义。当前实现把真实来源读取留给 Lark,把引用范围、截断与上下文含义继续交给共享 TypeScript 投影,Core 继续负责授权、队列与执行回执。

触发 原路径 此版本
普通引用回复 只传当前短句 核验原消息并冻结受限引用与当前请求
当前控制/无引用/旧受理请求 既有输入与身份 原路径保留;引用中的命令不触发控制

该表来自 7bfa5df9e1c7b9c5d755feece7a5fe3c9ba34bc7 的源码与实际入口测试;它不代表已安装模型一定正确理解。原飞书消息和回传位置保持不变;原生执行记录会包含已披露的上下文投影,完整 App 呈现仍属于现有交付验收。

具体改动

规范依据是 docs/architecture/rfcs/capable-manager-semantic-handoff-v0.md,接受版本 c7061d7acec7e87b049a567788b8070bde4895fd。两项均映射 5.11:首段的明确引用/真实 ancestry/引用不授权,以及后段的 immutable inbox/共享投影/原请求和返回 owner。当前头都落实到真实调用者和回归中,没有修改规范来迁就实现。

关键代码讲解

  • LarkPrivateConversations.admit 先用本条来源正文决定控制命令,只有普通输入进入新分支;原命令、权限与 Core admission fence 仍负责实际效果。
  • _reply_context_message 校验真实 App 下的消息、会话、发送者及父/根关系,再调用共享投影。首次 Core 受理前即冻结原文和模型输入;重复事件不能因父消息编辑而重新绑定含义,已受理旧请求也不会被重写。
  • enrich_lark_event_reply_context 复用本次已认证的 current envelope,避免再读同一来源;移除事件自带的伪上下文,父消息仍须同会话。删除内容和回调载荷不充当可读引用,缺失/截断保持明确。
  • 文档说明旧默认到新默认的变化。新增测试补齐私聊/群话题、post/card、越界、撤权、控制、旧请求重投、受理前中断与恢复。既有群 fixture 的等待标记只属于当前输入,避免把引用历史误当测试宿主命令;这不是生产关键词规则。

对主干的风险

未发现阻塞本次源码修复的实现问题。最强反例不是一次成功读取,而是在第一次 Core 记录出现前中断、随后父消息内容变化;新增用例证明重试仍消费首次冻结的来源。错误 ancestry 恢复后,也实际走到同一来源的一次完成和原 App 回传。跨会话、伪造事件引用、删除内容和读取中的撤权均不会得到越权文字或新 Session。

不可变基线与相同原生入口 fixture 对照:两项引用保留断言在基线失败,控制、无引用与旧请求三项保持通过;修复后五项全过。最终头的15项原生引用用例全过;339项较广回归来自 1809cc074a5fbcdb9c486cae298486bc1d3b71b9,已逐项核对生产/文档/共享 fixture blob 和既有测试 AST 均未改变。最终头的6项 direct+11项 selected premerge、Ruff、配置中的17文件 Mypy 均通过。

额外的 adapter 严格 Mypy 在基线和对应生产源码上都有4,898条诊断,完整归一化诊断多重集相同,非仅比较数量;它属于现有、非配置门禁的类型覆盖缺口。CI 按当前 Goal 策略不查询、不等待;质量资格策略 disabled,不声称有质量 receipt。真实 Lark 只读探针仅证明 App/原消息/引用和投影可读,不证明模型理解、批准执行或生产时延。新输入快照增加有界 IO 和存储;安装及降级前须沿既有回滚流程核对并结清新捕获请求,不重放效果未知的旧执行。

语义与 CI 对齐

这是 reuse_existing:共享引用选择与状态仍由原 TypeScript owner 决定,新字段是 Lark 本地不可变来源/派生输入快照,未新增共享批准词汇、actor 生命周期、Goal、配额规则或执行权限。当前语义 advisory/维护性与公开边界检查通过;模型采用和完整已安装旅程保持未验证。

我的整体评价

按 justified_increment 认可这个可独立回退的来源传递修复:long_horizon 在首次受理前后的不可变恢复得到改善,user_experience 在源信息已知时不新增设置、复制或确认轮次;实际已安装模型的交互改善仍不作推断。保留一个共享引用语义 owner;新增部分只负责原生飞书来源核验与已有回执中的不可变输入快照。当前 PR 完成原生入口到模型输入的引用传递和重试保护;安装、模型理解与完整 App 呈现继续沿既有原生 Chat 交付路径验收。兼容分支服务于真实旧请求和受理前捕获,不能简单从尚不存在的 Core 记录重建;此次已复用共享 owner 与本次读取,未引入平行审批服务。保留部署/模型理解/完整 App 验收风险;源码检查通过不代表原用户业务已经执行完。

English verdict: APPROVE — 7bfa5df; native replies retain bounded authenticated references with command/authority/replay isolation. Final 15-case native coverage and exact-head premerge pass; broader evidence is reused only after production/fixture/AST invalidation checks. Installed model behavior remains unqualified.

@loopx-agent
loopx-agent merged commit c7dbe35 into main Oct 17, 2026
14 of 29 checks passed
@loopx-agent
loopx-agent deleted the codex/lark-native-reply-context-20261017 branch October 17, 2026 13:12
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