fix(codex): resolve the current turn from the rollout when the Stop payload carries no turn_id (#1534)
Codex added turn_id to StopCommandInput in rust-v0.117.0 (0.116.0-alpha.12), after the hooks engine shipped in rust-v0.114.0, so stable rust-v0.114.0, v0.115.0 and v0.116.0 fire the Stop hook with no turn_id at all. #1169 made resolveCodexStopPlan fail closed on that payload, which silently disabled plan review on those versions. When the payload omits the field, derive the turn from the rollout instead: the id of the last id-carrying turn_context/task_started marker, then the same first-marker-anchored scan, so mid-turn compaction safety and per-turn plan filtering are unchanged. A rollout with no turn markers still fails closed, and so does a payload that carries turn_id as a blank string (truncated or foreign, refused before the file is read). Using the fallback writes one line to stderr, unconditionally — stdout is the hook's JSON decision channel, and Codex only reads a Stop hook's stderr on exit code 2, which this hook never uses. Docs: minimum-Codex-version table in the Codex troubleshooting guide and a turn-resolution section in AGENTS.md.
M
Michael Ramos committed
bfb3a55dd0419ca511ff80affbef1d0d90e80dda
Parent: 1f9eb45
Committed by GitHub <noreply@github.com>
on 9/15/2026, 10:11:18 AM