Preserve resumed session ids after transient Codex failures#38
Conversation
|
补充一次新的真实触发场景后,我把这个 PR 从「启动错误文案白名单」扩展成了更通用的 session invalidation 策略。 这次不是依赖缺失或 hooks 配置错误,而是 Windows 上 resumed Codex 在运行中以 因此这个问题的核心是:resumed run 非 0 退出不能直接等价于 session id 无效。现在的补充提交会在 captured session 仍存在时保留 |
|
Thanks for the detailed follow-up and the concrete repro. I agree with the root cause and the repair direction here: a non-zero exit from a resumed Codex process is not enough evidence that the persisted The public repo is currently behind the newer private source, so this may not be mergeable as-is against the latest implementation. I’ll use this issue/PR as the reference when migrating the fix into the current codebase. Thanks for documenting the Windows crash/resource-pressure case and the regression-test direction. |
Summary
This PR fixes a session recovery edge case where Hive can clear
last_session_idafter a resumed CLI exits non-zero, even when the underlying Codex session still exists.The original failure was observed with Codex startup/configuration errors, but a later Windows runtime crash showed the same root cause:
0xC0000409during image generation under low virtual memory pressure..codex/sessions/**/*.jsonlfile still existed and contained the detailed history.The important distinction is that a non-zero resumed process exit is not enough evidence that the persisted session id is stale.
Changes
Verification
vitest run tests/unit/claude-session-resume-failure.test.tspassed: 7 tests.biome checkpassed for the changed files.Notes
The goal is not to hide real stale-session failures. It is to avoid treating transient CLI failures, dependency/configuration errors, or native crashes as proof that the saved session id is invalid.