Skip to content

fix(chat): preserve original context in historical answers - #8220

Merged
loopx-agent merged 1 commit into
mainfrom
codex/history-answer-context-20261107
Nov 6, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/history-answer-context-20261107

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

Historical follow-up questions such as “implement those four” could be answered from a later review's native history instead of the original conversation. Each historical answer now gets an isolated restricted context containing up to twelve complete Core messages before the original source timestamp, with explicit coverage and size limits.

The original service can issue one context correction for a completed, delivery-verified, action-free legacy partial review. It retains the original Turn and delivery receipts, uses the existing read-only client suffix and queue, and adopts the same reservation after a lost acknowledgement. Stop, revocation, live work and unknown business effects keep their existing holds; a context correction does not complete the underlying work.

Validation: original-antecedent wire regression, before/after-queue acknowledgement failures, completion-before-adoption, Stop/revocation, newer-complete-answer starvation, bounded Unicode input and unread attachments; TypeScript contract checks and control-plane typecheck passed. At exact head 3d1c1c4: 638 relevant Python tests, 65 TypeScript tests, control-plane typecheck, Ruff, and the source premerge gate (6 direct and 11 selected checks) passed. Remote CI was not queried under the configured no-wait policy. Installed model behavior remains a separate adoption check.

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 (Codex); OpenAI; self_reported (runtime observation unavailable).

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

动机 / Motivation

原私聊管家的用户在追问“把上面四项落地”时,可能收到另一条较新问题的四项解释。此前“上面四项”可借用较新补答的上下文;现在只从原消息时点之前的完整 Core 消息解析指代,旧版部分补答可由原服务更正。真实 Core 到 native wire 的回归中,原先的四项正文进入输入,较新四项被排除;纠正沿原 reply worker 返回且保留原 Turn。本 PR 不重新执行原业务、不扩大读写授权,也不证明所有历史任务已完成或真实模型一定理解正确。部署后的真实模型纠正与原消息独立读回仍需原服务验收;其他未执行业务和原失败继续保留。

改动思路 / Approach

资格仍由 typed Core 判断,provider 只提供来源事实,派发与原回复沿既有 owner;没有第二套业务重放路径。同一原请求的上下文正确交付、一次只读纠正及其崩溃接续;真实业务执行和部署验收继续独立。只改 prompt 但不提供原证据,或只创建空白模型会话,都不能恢复“上面”的含义。沿已有 source fence 预留、原队列派发和原 reply worker 返回,是比增加重放服务更小的完整路径。Core 写入 context qualifier 和上一条只读答复关联,表达一次不可逆预留事实;provider 的 pending 只是发现提示,没有权限把未知业务重新执行。

原消息 → 完整原来源核对 → typed Core 资格 → 原队列的一次只读纠正 → 原会话独立读回。Stop、撤权、忙队列或仍持有背景工作的 adapter 都停留在原门禁;缺失证据继续显示缺口。这里的流程是源码解释,测试证据另列。

具体改动 / Changes

规范依据为 docs/architecture/rfcs/app-conversation-and-async-inbox-v0.md,spec_revision 7f521ff4505fa916a98a7401032922189eef414a;按变更前已接受的契约判断,新增文档不是自己的验收依据。逐项映射:answer-only review 限制原业务重做;fresh original-owner/message readback 保留原身份、清单、闲置队列及 Stop/New 核验;lost queue acknowledgement 采用同一预留;independent readback 使用原回复 owner;explicit gaps 保留原业务待办。五项均由当前原入口回归覆盖。

关键代码讲解

  1. admit_history_answer 在原来源 fence 内检验 binding/Session。只有已完成、已送达、无动作且带 gate 的旧历史答复能产生纠正;新 child 先有预留再入队,ACK 丢失采用既有 client,旧 Turn 不改写。
  2. history_answer_context 从原 Session 读取严格早于来源时点的至多十二条完整消息,明确 Core 覆盖并非 provider 全历史。超过 64 KiB 整体标记缺口,附件只报告未读,不切句冒充完整上下文。
  3. planBoundConversationRequest 继续单独拥有资格判断;discovery 仅返回 pending。失败、完整、普通业务、外来 Session、未核验投递和已升级上下文都不能被分类成新的可执行恢复。
  4. _ensure_adapter_locked 对每条历史补答重新建立受限模型上下文,仍沿原 Session、账户政策和 terminal/background inventory;不是更换 Bot 或另开消费者。

对主干的风险 / Risks

主要风险是把“纠正答案”误当成“重新执行业务”,以及预留后崩溃造成重复回复或丢失接续。测试经过真实 Core File、typed Node、原队列、native RPC wire 和原回复 owner;模型及 provider 为合成 peer,因此它证明输入和效果边界,不能证明模型理解。原先 wire 探针在不可变 base 上因缺原指代正文失败;最终 head 保留该断言并通过。before/after-queue ACK 丢失、child 已完成但 source 尚未采用、Stop 和撤权均已覆盖;加入较新完整答复仍能处理较早部分答复。

PASS:最终 head 的五个相关 Python 模块 638 项、两组 TS 65 项、control-plane typecheck、Ruff、premerge 6 项 direct 与 11 项 selected,双语 RFC 和公开边界扫描通过。配置 wait_for_ci=false,未查询或等待 CI。首次未发布候选采用 review-2,被实际旧 reader 不能识别的反例否定;现沿用 review-1,仅推进该请求预留版本,旧 reader 仍识别只读角色。被取消的候选测试不算通过。降级不保证新的原上下文质量;未发现当前阻塞问题。

语义与 CI 对齐

复用既有 request、reservation、只读 review、queue 和原消息回传词汇,不增加 Goal、调度器、权限或业务重试语义。semantic vocabulary 与维护性检查均通过;Core 保持决定 owner,Lark 承担原身份读取和投递,qualification 不由可见状态或措辞推断。

我的整体评价 / Verdict

这是 justified_increment:long_horizon 与 user_experience 在已验证的输入、一次纠正和崩溃接续路径上 improved,用户无需重新提交已知问题;不是全部旧业务完成。资格仍由 typed Core 判断,provider 只提供来源事实,派发与原回复沿既有 owner;没有第二套业务重放路径。同一原请求的上下文正确交付、一次只读纠正及其崩溃接续;真实业务执行和部署验收继续独立。部署后的真实模型纠正与原消息独立读回仍需原服务验收;其他未执行业务和原失败继续保留。本改动不改变渲染组件、布局或视觉展示;视觉验收不适用。未验证范围为部署后真实模型正文与原受众读回,保留在采用验收中。审查对象为 exact head 3d1c1c4a1d9d88536d25c1bb50dfb688f8084111;旧只读结果与未完成工作继续保留。

English verdict: APPROVE the bounded original-context repair at this exact head; installed model correction and remaining business work require separate acceptance.

@loopx-agent
loopx-agent merged commit 9d276f6 into main Nov 6, 2026
21 of 29 checks passed
@loopx-agent
loopx-agent deleted the codex/history-answer-context-20261107 branch November 6, 2026 22:39
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