fix(codex): 修复提交重试和告警锚点#443
Draft
deepcoldy wants to merge 5 commits into
Draft
Conversation
…iew-pr-443-claude-review
…iew-pr-443-claude-review
Owner
Author
Codex + Claude 二次 review 补充已在原修复上补齐重连自愈、告警路由与回归测试,并合入最新 修复补强
影响面
实际验证
二次 reviewClaude 完整 review 后给出 P0 无、P1 无、P2 1 项(恢复间隙重复提交窗口);P2 已通过 second-attempt 前 recheck + 真门槛测试处理。Claude delta 复核结论:通过,无阻塞项,可合并。 |
Owner
Author
实测重复提交问题:根因与修复申晗 live 验证发现首次消息会重复进入 Codex。真实 session 证据显示:第一次 Enter 已被 Codex 接受,但 修复提交:
验证:
影响面:paste/viewport/Enter 逻辑仍封装在 Codex adapter;公共层只新增可选 |
deepcoldy
added a commit
that referenced
this pull request
Jul 13, 2026
P1-1 fresh 首轮双执行窗口(已接受但 ack 丢/延迟 → 自动 paste 重发,同 #443) → 严格三态,exactly-once 优先,不靠 schema 幂等: - engine `sendFirstTurn()` → 'accepted' | 'not-sent' | 'ambiguous'。首轮 timeout non-fatal(engine 保活);`onDispatch` 在 ws.send 成功后置位区分帧是否发出。 - 'not-sent'(帧未 dispatch,ws 未开/send 抛)→ 唯一允许 paste fallback 恰好一次。 - 'accepted'(ack 到 **或** rollout 内匹配本轮 user_message)→ engaged,绝不重发。 正证据用 `drainCodexRollout().events` 的 `kind==='user'` + prompt 内容匹配 (`rolloutUserTurnMatches`),排除 thread/start 只建 session_meta 的空 rollout。 - 'ambiguous'(帧已发出后 timeout/断连且无正证据)→ engaged、0 auto-paste、0 queue、 1 notify;viewer resume 该 thread 自然恢复(真落地用户就能看到)。**绝不靠超时把 ambiguous 降级 not-landed**(negative evidence 不安全,stop 防不了已发生副作用)。 - 控制流锁:ambiguous 走正常成功 init(不 throw/不 restart),daemon 不拿原 prompt 重新 init;worker restart IPC 两处均 prompt:''(已核)。原 prompt 绝不进 pendingMessages/inflightInputs。 P1-2 marker ABA(旧 engine 迟到 child-exit 删掉新 engine marker → 孤儿不可 reap) → `removeMarkerIfOwned`:删前校验 marker 的 pid+wsUrl 仍等于本 engine,不匹配不删。 P2 update watcher:命中 update menu → **user_notify**(仍绝不自动 Enter,默认可能是 Update now);抽纯 `decideStartupDialogAction`(update 优先级高于 press-enter)。 worker 编排门槛可测:`orchestrateCodexRpcInit` engage 改三态 enum、`shouldQueueInitialPrompt` 纯函数锁入队 wiring(ambiguous engine-active+queuePrompt=false → 不入队)。 测试:engine 三态(not-sent/accepted-via-rollout/ambiguous)+ marker ABA(旧 exit 不删他人 marker);lifecycle orchestrator 三态分支 + shouldQueueInitialPrompt 入队 wiring + rolloutUserTurnMatches + decideStartupDialogAction。build 绿,468 定向测试绿。
deepcoldy
added a commit
that referenced
this pull request
Jul 20, 2026
P1-1 fresh 首轮双执行窗口(已接受但 ack 丢/延迟 → 自动 paste 重发,同 #443) → 严格三态,exactly-once 优先,不靠 schema 幂等: - engine `sendFirstTurn()` → 'accepted' | 'not-sent' | 'ambiguous'。首轮 timeout non-fatal(engine 保活);`onDispatch` 在 ws.send 成功后置位区分帧是否发出。 - 'not-sent'(帧未 dispatch,ws 未开/send 抛)→ 唯一允许 paste fallback 恰好一次。 - 'accepted'(ack 到 **或** rollout 内匹配本轮 user_message)→ engaged,绝不重发。 正证据用 `drainCodexRollout().events` 的 `kind==='user'` + prompt 内容匹配 (`rolloutUserTurnMatches`),排除 thread/start 只建 session_meta 的空 rollout。 - 'ambiguous'(帧已发出后 timeout/断连且无正证据)→ engaged、0 auto-paste、0 queue、 1 notify;viewer resume 该 thread 自然恢复(真落地用户就能看到)。**绝不靠超时把 ambiguous 降级 not-landed**(negative evidence 不安全,stop 防不了已发生副作用)。 - 控制流锁:ambiguous 走正常成功 init(不 throw/不 restart),daemon 不拿原 prompt 重新 init;worker restart IPC 两处均 prompt:''(已核)。原 prompt 绝不进 pendingMessages/inflightInputs。 P1-2 marker ABA(旧 engine 迟到 child-exit 删掉新 engine marker → 孤儿不可 reap) → `removeMarkerIfOwned`:删前校验 marker 的 pid+wsUrl 仍等于本 engine,不匹配不删。 P2 update watcher:命中 update menu → **user_notify**(仍绝不自动 Enter,默认可能是 Update now);抽纯 `decideStartupDialogAction`(update 优先级高于 press-enter)。 worker 编排门槛可测:`orchestrateCodexRpcInit` engage 改三态 enum、`shouldQueueInitialPrompt` 纯函数锁入队 wiring(ambiguous engine-active+queuePrompt=false → 不入队)。 测试:engine 三态(not-sent/accepted-via-rollout/ambiguous)+ marker ABA(旧 exit 不删他人 marker);lifecycle orchestrator 三态分支 + shouldQueueInitialPrompt 入队 wiring + rolloutUserTurnMatches + decideStartupDialogAction。build 绿,468 定向测试绿。
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.
变更
writeInput增加一次硬失败自愈:首次提交未被history.jsonl确认时,先清空 composer,再重新粘贴并再次提交。user_notify的 deferred warning 现在冻结当次 submit 的 turnId,避免后来的消息把失败卡漂到别的 turn 上。根因
currentBotmuxTurnId发送 deferred 告警,turn 在队列继续推进后会漂移。验证
pnpm buildpnpm vitest run test/write-input.test.tspnpm vitest run test/session-lifecycle-hooks.test.ts