Skip to content

fix(chat): preserve original operator material in native turns - #7549

Merged
huangruiteng merged 1 commit into
loopx-project:mainfrom
steven-kid:roadmap-auto/20261028-chat-material-fidelity
Oct 28, 2026
Merged

huangruiteng merged 1 commit into
loopx-project:mainfrom
steven-kid:roadmap-auto/20261028-chat-material-fidelity

Conversation

@steven-kid

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Ordinary Codex Chat turns collapsed all whitespace before dispatch: pasted Python lost indentation, a b became a b, and paragraph breaks disappeared. The stored request could remain intact while the model received different material. Preserve the original operator text through send() and the existing prompt renderer, including leading/trailing whitespace; whitespace-only requests still fail before dispatch.

This independently useful input-fidelity repair supports the original-material requirement in the Controller/Executor RFC §5. It does not implement C6 or claim long-horizon/cost gains. #7445 fixed structured peer briefs and explicitly retained ordinary-conversation normalization; this proposal intentionally changes that remaining ordinary-input behavior. It does not duplicate #7430's contract work.

Base: loopx-project/loopx:main at 843be494266774b63b3de61d0adf5dd7f4f877a2.

Author Declaration

Written by: model_agent — OpenAI GPT-6 family, under the contributor's direction.

Implemented against the reproduced input-fidelity defect and the RFC's original-material requirement at the base above.

Criterion Disposition Implementation / evidence
Preserve supplied material at the actual native request boundary implemented CodexChatAgentSession.send, _turn_prompt; exact text assertions across ordinary, execution, structured and read-only review modes
Preserve blank-input rejection and read-only recovery restrictions implemented No native request for blank input; existing review instructions retained
Preserve material after durable queue restart implemented Real Chat store reopened, production queue/controller/adapter dispatch, original request compared with native input
Dual-session isolation, installed-host adoption and complete outcome/cost qualification out_of_scope Existing RFC program remains open

Scope And Continuation

Complete within this repair. The existing built-in native Chat Codex transport owns the change; no new capability, provider, schema, configuration, source store or authority is introduced. The adjacent simplification removes the special whitespace-normalization branch; peer input remains unchanged. No further helper or language migration is needed for this transport fix. Reverting the two production expressions and focused regressions rolls back this slice.

Validation

Tested head: db61b6935820669f232f77100453a9783c9d6bce. Input classes: synthetic, public_fixture. Local run state: finished; remote CI is separate.

Check kind Result Evidence / limitation
regression_parity passed Four new native-input cases failed on unchanged 843be4942; all four plus queue-restart integration pass after repair
integration passed 553 tests across test_chat_agent.py, test_chat_queue_preparation.py, test_chat_ordinary_project.py, test_chat_image_attachments.py and control_plane/test_original_conversation_peer.py
static passed Changed-file Ruff, configured mypy (17 files), control-plane TypeScript typecheck, compilation and diff hygiene
build passed Normal Chat TypeScript/Vite build and wheel build; isolated wheel installation passed all five fidelity checks with product imports verified against the wheel
static passed Public-boundary scan clean for all three changed files; two registry-availability warnings because no local registry was configured
static passed Final standard premerge on submitted head: direct checks, changed Python compilation and both selected catalog canaries; zero manual holds
manual not_run Installed App, live Codex inference, model comprehension and full-cost benchmark evaluation

The 553-test run and first installed-wheel check preceded removal of a nonfunctional comment. The initial standard premerge failed because that comment increased the already-capped chat_agent.py module by one line. The comment was removed; no budget or acceptance threshold was raised. Final focused checks, rebuilt wheel and its isolated-install five-case validation were rerun on the submitted source. Native transport responses in these tests are deterministic doubles; the queue/store/controller are real, but this is not a live-provider or installed-App qualification.

Frontend / Visual Evidence

UI impact: none. This changes material delivered to the existing executor, not displayed controls or layouts. No screenshot applies.

Boundary Checklist

  • Only product transport code and durable synthetic regressions; no private context, raw traces, credentials or local paths.
  • No benchmark jobs, model calls, scoring changes or authority changes.
  • No paired RFC changed.
  • DCO-signed commit; ordinary author proposal, no merge or deployment authority implied.

Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>

@loopx-agent loopx-agent 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 — gpt-6.1-sol / OpenAI; runtime_reported; reasoning_effort=max

APPROVE:限定为已有 native 传输层的原材料保真修复。 没有发现阻断本次切片的新增缺陷;完整用户输入逐字保真的上游边界见下文,不把它当作已完成。

动机 / Motivation

用户在普通 Codex 对话中粘贴代码、表格或带有双空格的字面值时会遇到这个问题。 例如存储的多行 Python 含缩进和字符串 a b,旧实现把它改成单行并合并字符串空格;新实现把收到的原文送入既有 native 请求。 原文已保存却被传输层改写,会让后续解释、修复和重试使用不同材料,用户需重复纠正。

独立真实 HTTP、持久化、controller、adapter 和子进程 JSON 输入链证明内部换行、缩进、双空格和不换行空格得到恢复。 本次 native 传输增量成立;HTTP admission 和现有 composer 仍会去掉输入首尾空白,完整用户入口逐字保真尚未完成。 这次不认证正式 App 采用、实际模型理解、双会话隔离或长程净收益。

改动思路 / Approach

输入原文由既有 Chat store/queue 持久化,生产 CodexAppServerAdapter 把它交给 CodexChatAgentSession.send;该层应适配 native 协议,不应重写材料。两处删除分别取消 send 的 split/join 和 renderer 末端 strip,仍在原位置用 text.strip() 判断空白请求。结构化模式、恢复时的只读 review 包装和普通模式共用原有调度与权限边界,没有增加配置或第二份原文存储。

决定性理由是已有 transport owner 能用直接控制流修复真实丢失,不需要设计新能力或单独 UI。已有 transport owner 能直接删除有损转换并恢复真实材料;新增协议/存储/能力没有依据。 已收到字符串到 native 输入的独立可用增量;HTTP/composer 首尾裁剪另保留原 owner。作为有界增量接受,完整 C6、双会话和正式安装不成为前置。源码导出的对照用下表表达,不附未经渲染检查的图。

同一输入 不可变 base 当前 head
六种已有 send 模式中的普通 plain 文本 完整帧不变 与 base 完整帧相同
多行代码、CRLF、tab、双空格、NBSP、表格/数学 12 组失去原格式 18/18 native 原文 suffix 保持
HTTP 多行代码、原 client id 重试 内部空白折叠 原文内部格式保持、重试仍只投递一次
HTTP 输入首尾空白 上游已 strip 相同上游裁剪仍存在

具体改动 / Changes

完整审阅 base 843be494266774b63b3de61d0adf5dd7f4f877a2 到 head db61b6935820669f232f77100453a9783c9d6bce:三个文件 +68/-2,生产代码仅 +2/-2;其余是 native 输入和 queue 重启的持久回归。没有新状态、协议版本、迁移、生成文件或 TS 决策 owner。Python 留在已有 native IO 适配层,删除有损转换就是本域内相称的简化。

依据 docs/architecture/rfcs/controller-executor-unified-contract-v0.md §5,spec_revision 843be494266774b63b3de61d0adf5dd7f4f877a2。该文件已接受设计,仍明确不是已交付双会话运行时;MAT 标签是原段落的映射,不新增要求。MAT-FORMAT implemented at native boundary:保留代码/数学/表格自然格式;MAT-AUTHORITY implemented:未把原文提高为工具权限,原 readonly/权限/dispatch gate 保持;MAT-DUAL-SESSION out_of_scope:完整双角色 session/generation/settlement 仍归原程序,不能从本 PR 推定资格。

关键代码讲解

  1. CodexChatAgentSession.send 用原字符串建立输入,保留空白拒绝、只读原请求 review 包装和结构化 Turn 的 mode 检查。图片附件仍作为独立 image item 添加,权限/model/effort 仍走原请求字段。
  2. _turn_prompt 在原全部指导之后拼接完整 user_message;上下文、protected action、source reading 和完整回复义务没有被压缩或省略。比较六类模式的完整 plain 帧、原 guidance 与权限 metadata,均保持一致。
  3. CodexAppServerAdapter.start_turn 及附件分支仍调用原 send,没有旁路 transport。真实 queue 重开测试沿原 store/controller/adapter 到输入;另用真实 HTTP 与本地合成 app-server 子进程确认实际 JSON stdin,而非只让 mock 返回“已保留”。

对主干的风险 / Risks

原有边界提醒:不要把本次 native 保真写成完整 App 逐字保真。 loopx/chat_server.py:801 在 HTTP admission 仍 .strip(),当前 composer 的 sendMessage 在 personal-workspace-page.tsx:2385 也先 trim。独立 HTTP 发送 print('a b') 加末尾空行,当前 native 得到 print('a b'),存储也已去首尾;不可变 base 同样先裁剪,另将内部双空格折叠。这是原有上游缺口,未由本次两表达式引入。它不否定 native 层和多行材料内部格式的实证增量,但后续应沿原 HTTP/composer owner 保留文本、仅用 trim 判空,并谨慎保持 retry 身份语义;不需要新建并行机制。

语义与 CI 对齐

新的默认是“保留收到的文本”,不是可选功能,因此没有虚报 default-off 隔离;原 peer 规则/structured 和普通权限条件保持。原文含控制词不自动授权动作,typed output schema、approvalPolicy、permissions、只读恢复限制和 write fence 未改变。JSON 序列化会转义传输字符并正确还原,不改材料语义;未以这些测试证明模型一定遵从指导。没有新增 vocabulary、领域专用义务或把硬 gate 改称建议。

独立本地 553 PASS,覆盖五个完整原模块;同不可变 owner/source 输入的 18+18 native 序列化对照,六个 plain 全帧相同,12 个旧格式反例在 head 恢复。真实 loopback HTTP/store/controller/adapter/native 子进程两版各三请求,空白拒绝后正常工作、原 client id 重试零重复 native Turn;source fingerprint/命令保留,只有临时 cwd 作规范化,输入和指导未规范化。Ruff、配置 mypy 17 文件、control-plane typecheck、standard premerge 6 direct + 2 selected、0 hold 均 PASS;当前精确 scope 的 CQR 已重新记录。最初 HTTP 探针遗漏显式 runtime route 的失败属于夹具,修正隔离后两版均通过;没有改写失败或借用作者验证。按配置未取远端 CI。

我的整体评价 / Verdict

problem_context 为 justified_increment:真实传输缺陷已修复,完整用户入口首尾保真仍有具名上游 owner。long_horizon 在原队列重开、重试和空白拒绝恢复路径保持;user_experience 的已证改善是原内部格式到 native 的保持,没有额外用户准备或确认轮次。没有声称独立长期净收益或真实模型理解。

APPROVE 当前三文件切片,架构保持原 owner,删除重复转换相称,无需再抽 helper 或保留兼容分支。视觉检查不适用:检查的 send/renderer/HTTP/composer 路径无本次渲染改动;正式 App 视觉/安装采用、真实 provider 和完整成本/长期效果未验,原首尾裁剪明确保留。本结论不授予 merge、install 或发布权限,后续 closeout 与 merge readiness 单独读回。

English verdict: APPROVE at db61b6935820669f232f77100453a9783c9d6bce for the bounded native material-fidelity repair. Paired serialized inputs and real HTTP/native-child delivery confirm preserved interior formatting; pre-existing HTTP/composer outer trimming and live-model qualification remain outside this approval.

@huangruiteng
huangruiteng merged commit 6f8f476 into loopx-project:main Oct 28, 2026
31 of 37 checks passed
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.

3 participants