fix(adapters): apply_patch post-merge prompt 微修 + README 更新(Move 空 hunk / Begin Patch first-line / 多 provider 真机验证)#240
Merged
Conversation
…MERGE) 仅用于 PR #236 merge 后回归测试 + DeepSeek / Grok / 其他 provider 验证。 4 个 stage 全量落盘到 ~/.codex-app-transfer/logs/apply-patch-debug/: - inbound: Codex Desktop → adapter (Responses API JSON) - outbound: adapter → upstream (provider Chat JSON) - upstream_raw: upstream raw SSE - downstream_emit: adapter 转换后 SSE → Codex Desktop 无业务逻辑改动,仅 forward.rs 加 90 行 DEBUG ONLY block + 4 处 dump 调用。 Trade-off:延迟微增(每 stream chunk 多 1 次 memcpy)。 **绝不 merge**:完成回归测试后 close PR(不删 branch 以便复用)。 Refs #235
…ine(round 7 Kimi 实证) post-PR #236 真机 round 7 Kimi 回归(27 turn / 4.9 min / 14 个 apply_patch) 出现 2 个 generation-quality fail,捕获后修 prompt 让其他 provider 不再撞: (1) t0002: 漏写 `*** Begin Patch`,直接以 `*** Add File:` 开头 报 `invalid patch: The first line of the patch must be '*** Begin Patch'` Kimi t0003 一句话自校正:"我忘了加 *** Begin Patch,需要重新调用"。 (2) t0020: `*** Update File: <old>` + `*** Move to: <new>` 不带 hunk(纯重命名) 报 `invalid hunk at line 2, Update file hunk for path '<old>' is empty` Kimi t0021 多段推理后摸索出"包含至少一行内容"的 workaround。 prompt 加固 - `tools.rs::APPLY_PATCH_TOOL_DESCRIPTION_FOR_CHAT`: * 顶部加 "MUST start with `*** Begin Patch` as the literal first line" * `Update File: optionally followed by Move to` 加注 "STILL requires at least one hunk — see RENAME / MOVE FILE section" * 新增 RENAME / MOVE FILE 章节:Move to 必须配 ≥1 hunk;纯重命名用 Delete + Add File 替代方案(复制原内容加 `+` 前缀);Update+Move 用 于 rename WITH content change * chat-path gotcha 加第 6 / 7 条:Begin Patch first-line 强调 + Move 非空 hunk - `APPLY_PATCH_INPUT_DESCRIPTION_FOR_CHAT`:紧凑版同步上述 2 条 - `request.rs::APPLY_PATCH_CHAT_PATH_SYSTEM_GUIDANCE`:gotcha 加第 8 / 9 条 回归测试加 5 条断言(guidance 3 + outer 3)覆盖新规则。 PR #240 改定位:从纯 debug-only 转为业务修复 PR(WIP),capture instrumentation 仍保留作为多 provider 调试基础设施,后续轮次发现的 prompt gap / generation quality 问题继续在本 PR 收敛。本 PR 验证完整后 merge 时单独 commit revert capture。 510 tests pass。 Refs #235
中文版用户主导改动(已合并) - 顶部段落合并 + Codex CLI → Codex APP(全大写,用户定稿术语) - 快速开始 6 步 → 3 步(去掉 Full access 切换段 + 桌面窗口兜底段,因为 v2 默认配置 + apply 流程已自动完成) - 常见问题"curl 提权"段重写(明示 macOS 无法触发提权选择 → 默认 full-access 写入) - 免责声明加 "除反馈功能外不涉及第三方联网行为" + "存在封号风险" - 致谢简化(删 Apache-2.0 / verbatim bullet 等详细描述,完整版在 ACKNOWLEDGEMENTS.md) - "日志去哪了" → "日志" 我的补充 - 顶部 [!IMPORTANT] 红字公告:Kimi For Coding + Xiaomi MiMo (Token Plan) 端到端 实测覆盖;其他 chat-completions 兼容 provider(DeepSeek / Kimi 月之暗面 / MiMo Pay for Token / 智谱 GLM / 阿里云百炼 / MiniMax)未做长期真机回归; QQ 3216202644 / 邮箱征集 API key 测试,承诺仅测试用即销毁 - macOS 签名提示加 Apple Developer ID + Apple 公证 (Notarization) + Gatekeeper 术语 + 「右键 → 打开」绕过方式 - 版本号 v2.1.6 → v2.1.12(对齐最新 Latest release) - Codex CLI 0.126 binary 版本引用保留(指特定 binary,非用户视角的 Codex App) 英文版同步 - 顶部 [!IMPORTANT] block 完整翻译 - 段落合并 + 快速开始 3 步 + curl Q&A 段 + 致谢简化 + 免责声明 + Logs 标题 - 英文 product name 用 Codex App(英文 capitalization convention,而非 ALL CAPS) - macOS 签名提示术语对应英文(Apple Developer ID / Notarized / Gatekeeper)
This was referenced May 21, 2026
…-merge cleanup) Round 7-9 真机 capture 调研已完成,PR 已收敛全部 prompt 微修。 按 memory rule"debug 代码不进 main",在 merge 前 revert forward.rs 回 origin/main 状态。 被 revert 的 commit:6080558 (debug(proxy): inject apply_patch I/O capture instrumentation) - 104 行 DEBUG_APPLY_PATCH_SEQ / debug_apply_patch_dump / DebugTeeStream - 4 个 stage dump 调用(inbound / outbound / upstream_raw / downstream_emit) PR #240 现在剩下的真业务改动: - 0d2306a: prompt 修 Move 空 hunk + Begin Patch first-line (round 7 Kimi 实证) - 6d1b9d1: README 用户定稿同步 + 顶部测试覆盖红字 + macOS 签名提示 510 tests pass + cargo check -p codex-app-transfer-proxy 干净。 Refs #235
This was referenced May 21, 2026
Cmochance
added a commit
that referenced
this pull request
May 21, 2026
Cmochance
added a commit
that referenced
this pull request
May 21, 2026
模板照 v2.1.7(单 ### 主题 + bullets + 验证段),中英双版本同步。 主题:apply_patch diff UI 在 chat-completions provider 上工作(close #235)。 内容覆盖: - wire 层 custom_tool_call SSE 桥接 + 多轮历史回放(PR #236) - prompt 修复 7 条(V4A @@ 单端 / EMPTY LINE / minimal Update / Add File + / prefix 无空格 / Begin Patch first-line / Move 非空 hunk)(PR #236 + #240) - envelope status 一致 + guidance dedup(Devin pre-merge review 2 个 BUG fix) - README 顶部红字 + macOS 签名提示 验证段含三 provider 真机数据(Kimi 12/14 / MiMo 用户反馈 / DeepSeek 9/9)+ 510 tests pass。 搭车 PR #241(docs scope)。
Cmochance
added a commit
that referenced
this pull request
May 21, 2026
…E 红字公告 followup #39 - 新建 docs/followup/39-shell-to-apply-patch-normalize-fallback.md - 含义:issue #235 通过 PR #236+#240 prompt-only 已修复,PR #239 server-side normalize 不需要主路径化;**若未来某 provider 模型完全无视 prompt 走 shell file-write 再 cherry-pick PR #239 复活** - frontmatter status: active(P3 conditional),触发激活信号写明 ≥3 次用户报告 / 协议升级 / 真机日志统计三个场景 - 实施起点直接指 PR #239 closed branch 的 commits(GitHub 仍可访问) - followup-tracker.md Active 段加索引行 README 红字公告精简 - 删 "测试结束后立即销毁,绝不挪作他用" 两句(用户反馈"有点蠢") - 中英文同步,核心承诺只保留 "API key 仅用于本项目实际测试"
Cmochance
added a commit
that referenced
this pull request
May 21, 2026
模板照 v2.1.7(单 ### 主题 + bullets + 验证段),中英双版本同步。 主题:apply_patch diff UI 在 chat-completions provider 上工作(close #235)。 内容覆盖: - wire 层 custom_tool_call SSE 桥接 + 多轮历史回放(PR #236) - prompt 修复 7 条(V4A @@ 单端 / EMPTY LINE / minimal Update / Add File + / prefix 无空格 / Begin Patch first-line / Move 非空 hunk)(PR #236 + #240) - envelope status 一致 + guidance dedup(Devin pre-merge review 2 个 BUG fix) - README 顶部红字 + macOS 签名提示 验证段含三 provider 真机数据(Kimi 12/14 / MiMo 用户反馈 / DeepSeek 9/9)+ 510 tests pass。 搭车 PR #241(docs scope)。
Cmochance
added a commit
that referenced
this pull request
May 21, 2026
…e + release-notes v2.1.13 (#241) post-PR #240 收尾 batch: - followup #39 conditional active(PR #239 server-side normalize 兜底,等 prompt-only 失效再激活) - README 顶部红字精简(删 "立即销毁,绝不挪作他用") - apply_patch prompt 加强 normative:ALWAYS use apply_patch / NEVER shell `>` redirect 写文件内容 + 全文 rewrite 用 Delete + Add(用户实测反馈 2026-05-22) - prompt rule 5 / gotcha 3 carve-out:`printf '\n' > <path>` seed 空文件是 apply_patch 预备步骤,不算 bypass(Devin pre-merge review fix × 2) - docs/release-notes/v2.1.13.md 起草 + 精简到 [2500, 3200] 区间(memory rule) - Cargo.lock sync v2.1.13(PR #242 漏 commit 补上) Refs #235
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
post-PR #236 multi-provider regression PR。capture instrumentation 已 revert,只剩真业务改动。
Scope
prompt 微修(commit 0d2306a · round 7 Kimi 实证)
README(commit 6d1b9d1)
多 provider 真机验证结果
PR #236 merge 后 round 7-9 真机 capture(本地 capture instrumentation 调试,已 revert):
Round 7 的 2 个 generation-quality fail 已通过本 PR commit 0d2306a 修复,Kimi 自校正 1 turn 内恢复。Round 9 DeepSeek reasoning 零 self-correction,逐字引用 prompt 规则。
CI
✓ 510 tests pass (`cargo test -p codex-app-transfer-adapters --lib`)
✓ `cargo check` workspace 干净
PR #238 / #239 已 close(内容被吸收 / 替代方案更优)。
Refs #235