fix(codex): don't record a deadline-truncated turn as success - #7
Draft
09473ZH wants to merge 2 commits into
Draft
fix(codex): don't record a deadline-truncated turn as success#709473ZH wants to merge 2 commits into
09473ZH wants to merge 2 commits into
Conversation
The turn-deadline fallback accepted result.final_text as the terminal response whenever ANY assistant message had completed earlier in the turn. A turn truncated mid-flow (hour-scale script or wait cut off by the ceiling) therefore surfaced as a clean success carrying stale narration text, and cron recorded last_status=ok for an incomplete run (2026-08-18 premarket plan: news merge cut at the 4200s ceiling, recorded ok, downstream plan consumed a nonexistent news terminal state). Track the last meaningful signal (text / tool_start / tool_done / activity) and accept the fallback only when the assistant text is the LAST thing codex produced — the original protocol-quirk case. Any other trailing signal now yields the timeout error path (interrupt + should_retire), with the last signal named in the error for diagnosis. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
保留本 PR 的权衡记录(供未来追溯)它防的剩余暴露面(在 Harness#106 的 2h turn 上限 + 1800s post-tool quiet watchdog 之后依然存在):
不合它的合理理由(已评估):
结论:合并本 PR,同步推动上游收编以消除 fork 负担。 |
09473ZH
marked this pull request as draft
August 19, 2026 08:12
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.
Root cause (2026-08-18 premarket plan incident)
codex_app_server_session.py的 turn-deadline 兜底会在"本 turn 中出现过任何一条已完成的助手消息"时,把超时静默转成成功:中途叙述文本被当成最终回复,cron 记last_status=ok。08-18 盘前 plan 的新闻归并在 4200s 上限处被截断,终态记成功,下游 plan 消费了一个不存在的新闻终态。Fix
跟踪 turn 内最后一个有效信号(
text | tool_start | tool_done | activity),deadline 兜底只在助手文本是 codex 最后产出的东西时接受(即该兜底原本要修的 turn/completed 丢失 quirk);其余情况一律走超时错误路径(interrupt + should_retire),错误信息带上 last signal 便于诊断。Verification
tests/run_agent/test_codex_app_server_integration.py+test_codex_app_server_lifecycle.py:36 passedHERMES_CODEX_TURN_TIMEOUT_SECONDS4200→7200 并 bumphermes.lock.yaml到本 PR 合并后的 commit🤖 Generated with Claude Code