Skip to content

fix(adapter): 适配器专项——CoCo 双路径、Antigravity 不重试、Codex 信任框、TRAE 空回复、adopt 新格式 - #1007

Merged
deepcoldy merged 6 commits into
deepcoldy:masterfrom
ITcathyh:sprint-adapters
Aug 25, 2026
Merged

deepcoldy merged 6 commits into
deepcoldy:masterfrom
ITcathyh:sprint-adapters

Conversation

@ITcathyh

Copy link
Copy Markdown
Contributor

PR 3: sprint-adapters(CLI 适配器修复 5 项)

改了什么

来自「Botmux 交流群」近 7 天用户反馈的适配器专项,5 个修复:

  1. fix(adapter): coco 提交确认兼容 traecli 新历史路径

    • traecli 0.201.5 把会话记录从 ~/.cache/coco/history.jsonl 迁到 ~/.trae/cli/history.jsonl,CoCo 适配器仍查旧路径,消息已提交也持续误报 submit_unconfirmed。改为双路径轮询(旧路径 historyDeltaContains + 新路径 traexHistoryMatchDelta),任一命中即确认;HISTORY_PATH 改动态计算(兼容后设 TRAE_HOME)。
  2. fix(adapter): antigravity 提交不再重发 Enter

    • 首次 Enter 后 800ms 内未见 history 确认就补按 Enter(最多 4 次),agy history 写入慢时同一问题重复提交 5-6 次。改为单次 Enter + 3.2s 一次性轮询(总预算不变),超时走 worker 既有 20s deferred recheck 兜底(对齐 grok.ts 的 "Do not retry Enter" 模式)。
  3. fix(worker): 信任框 Enter 延迟 400ms 发送

  4. fix(traex): 识别助手侧 item_completed 与无 phase agent_message

  5. fix(adopt): rollout 标题提取兼容 codex 0.147 response_item 格式

    • Codex 0.147+ 用户消息只存 response_item/message role=user,adopt 磁盘扫描只认 event_msg/user_message,新会话不显示(issue fix(adopt): Codex 0.147 Desktop 会话未被磁盘恢复扫描器发现 #878)。parseRolloutTranscript 增加 fallback:取首个非合成 response_item role=user 消息为 title,跳过 environment_context/permissions 等合成 preamble 与 botmux 注入。

影响面

  • 跨 CLI:coco/antigravity 改动仅影响各自适配器;traex-transcript 仅影响 traex 会话;resumable-session-discovery 惠及 codex+traex 新格式会话
  • 共用路径:③改了所有 CLI 共用的 handleVisibleStartupInteraction——唯一调用方不 await trust 完成,Claude Code 信任框仅 dismiss 晚 400ms 无功能回归;Aiden 更新弹窗分支未触碰
  • 跨后端:antigravity 改动 PtyBackend/TmuxBackend 行为一致
  • 旧格式兼容:coco 旧路径保留(兼容旧 traecli);adopt 旧格式 event_msg/user_message 优先且早停逻辑不变

测试验证

  • pnpm build 通过
  • 新增/更新测试:write-input 141/141、antigravity-submit 16/16(含慢 history 只发 1 次 Enter)、trust-dialog-defer 5 新增 + backend-gate 21、traex-transcript 53/53(11 新增)、resumable-session-discovery 37/37(5 新增);另用 78 个真实 rollout 只读冒烟,2 个已知新格式文件 title 正确提取
  • pnpm test 全量:18171 passed;3 个失败(bwrap/dsh 沙箱环境问题)已在干净基线复现确认预存

huangyuhang.edu and others added 6 commits August 25, 2026 19:04
助手侧对称缺口:item_completed AgentMessage item 与丢 phase 方言的
agent_message 未被跟踪,task_complete 空 final 时无法恢复。新增
itemCompletedAgentText 与 recoverTraexEmptyFinal,候选按
lastFinalAnswer > AgentMessage item > 无 phase agent_message 优先级,
均经 traexTrailingSentinel 守卫区分 deliberate silence。

Co-Authored-By: Claude <[email protected]>
codex 0.147+ 不再写 event_msg/user_message,用户回合只存 response_item
role=user,导致 adopt 磁盘扫描 title 为空、会话被丢弃。无 event_msg 时
回退到首个非合成 response_item 用户消息,跳过 environment_context/
recommended_plugins/permissions/AGENTS.md 合成 preamble 与 botmux 注入。

Co-Authored-By: Claude <[email protected]>
traecli 0.201.5 已将 history 迁到 ~/.trae/cli/history.jsonl(尊重
TRAE_HOME),旧 ~/.cache/coco 路径不再写入,导致消息已提交也持续误报
submit_unconfirmed。writeInput 改双路径轮询:旧路径 historyDeltaContains
(mode+content 前缀匹配,兼容旧 traecli)与新路径 traexHistoryMatchDelta
({session_id,ts,text} 精确匹配)任一命中即确认;HISTORY_PATH 改为 submit
时动态计算以兼容后设的 TRAE_HOME。

Co-Authored-By: Claude <[email protected]>
首次 Enter 后 800ms 未见 history 确认就补按 Enter、最多 4 次的重试逻辑,
在 agy history 慢写入(冷启动/大 prompt)时会把重试 Enter 落在已提交输入
框,导致同一问题重复提交 5-6 次。改为单次 Enter 后只轮询 history 不重发
(对齐 grok 的 Do not retry Enter 模式),慢写入由 worker 的 deferred
recheck 兜底。

Co-Authored-By: Claude <[email protected]>
codex 0.149 按键处理器在信任框渲染瞬间尚未就绪,同步发出的 Enter 落进死
输入队列被静默丢弃(上游 openai/codex#39487),消息未提交直至 20s 后
submit_unconfirmed。trustHandled 仍同步置位防重入,Enter 改为 400ms 后
fire-and-forget 发送。handleVisibleStartupInteraction 为共用启动交互路径,
Claude Code 信任框仅 dismiss 晚 400ms,无功能回归。

Co-Authored-By: Claude <[email protected]>
review 修复:
- worker.ts 信任框 setTimeout 回调增加 backend/cliSpawnGeneration 围栏,
  400ms 内 respawn 时旧 timer 不向新会话发 Enter;回调加 try/catch 防
  tmux session 已退出时 unhandled 异常
- resumable-session-discovery 新格式 rollout 首个真实用户回合后早退
  (fallbackTitle 命中即停扫),避免每个文件扫满 5000 行
- isSyntheticPreamble 模式锚定行首,散文提及标签的真实 prompt 不被误杀
- 补 respawn 围栏测试与散文提及 preamble 标签阴性测试

Co-Authored-By: Claude <[email protected]>
@ITcathyh
ITcathyh requested a review from deepcoldy as a code owner August 25, 2026 12:21
@deepcoldy
deepcoldy merged commit cc009c1 into deepcoldy:master Aug 25, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🚀 Released in v3.18.0

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.

2 participants