Repository navigation
fix(agent): finish turns with undelivered Code Mode notifications - #6907
Merged
M4n5ter merged 6 commits intoNov 15, 2026
Merged
Conversation
After a successful FinishTurn, keep Cell notifications in history without treating them as pending delivery. Continue requiring Cell execution, child effects and final result acceptance to settle before the Run can close. Generated-by: OpenAI Codex
…x-agent-finish-cell-notices
6 of 8 tasks
Allow completed runs to retain cell notifications without blocking history forks. Cover engine completion, projection rebuild and fork selection, and align native CI fixtures with the tool closure and WebStatus contracts. Generated-by: OpenAI Codex
4 of 6 tasks
4 of 6 tasks
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.
Summary
A successful
FinishTurnstops the Agent from starting another model step. If a Code Mode cell finishes during shutdown, its final notification can still be queued for the next model step. The completion check treated that notification as unfinished work, so the run stayed active after the cell had settled.This happened during a proactive discovery run.
DiscoveryCompletesaved the report, but the scheduler was still waiting for the worker to finish. The report never reached the Bot, and subsequent investigations could not start.This change lets a run finish with undelivered notifications preserved in its records. The Agent still waits for the cells and their child tools to settle and accepts the final cell results before completing the run. Completed runs with retained notifications also remain eligible for session retirement and history forks.
Verification
run has pending Cell obligationsbefore the fix. It now passes and verifies that an active cell still blocks completion.All selected local CI workers passed at
6a6b42f9: tooling, root, bridge, packaging, product, native-ubuntu, native-macos and native-windows. Linux root archive replay passed 833 tests with 6 existing skips. Windows GUI tests ran in the logged-in console session, including all 29 desktop interaction tests.The branch is synchronized with
rust-previewthrough17613b5e(#6921). Two native fixtures now use the current tool-closure and WebStatus contracts, and the missing generic Input translation is registered so contracts type-checking passes.AI use
OpenAI Codex assisted with root cause analysis, implementation, and regression testing. The commit includes
Generated-by: OpenAI Codex.Checklist
Does this PR entail a change in behavior?
简体中文
摘要
FinishTurn成功后,Agent 会停止发起新的模型请求。如果 Code Mode 后台任务在收尾时结束,它的最终通知仍可能进入队列,等待下一次模型请求。旧的结束校验把这条通知当成未完成的工作,导致后台任务已经收尾,整轮运行却仍处于活跃状态。实际遇到这个问题的是一轮主动发现。
DiscoveryComplete已保存报告,但调度器仍在等待 Worker 结束,导致报告无法交给 Bot,后续调查也无法启动。修复后,未交付的通知会保留在本轮记录中,轮次可以正常结束。Agent 仍会等待后台任务及其子工具完成收尾,并接收后台任务的最终结果。保留通知的已完成轮次也可以正常退休和作为历史分叉来源。
验证
run has pending Cell obligations。修复后通过,并验证了仍在运行的后台任务会继续阻止轮次结束。6a6b42f9上本地选中的 tooling、root、bridge、packaging、product、native-ubuntu、native-macos、native-windows 全部通过。Linux root 归档回放通过 833 项,另有 6 项原有跳过;Windows GUI 测试在已登录 console 会话运行,29 项桌面交互全部通过。已同步
rust-preview至17613b5e(#6921)。两处 native fixture 已更新到当前的工具结束协议和 WebStatus 契约,另补齐了通用 Input 翻译,使 contracts 类型检查通过。AI 使用
OpenAI Codex 协助了根因分析、修复实现和回归测试。提交包含
Generated-by: OpenAI Codex。