fix(codex): keep Stop plan review in the current turn (#1169)
* fix(codex): keep Stop plans in the current turn * fix(codex): anchor the Stop turn on its first rollout marker Mid-turn compaction re-emits a `turn_context` line carrying the same turn id as the in-flight turn (Codex `Session::replace_compacted_history`), so locating the turn by its LAST matching marker started the scan after the compaction point and lost a plan the turn had already produced. Anchor on the FIRST marker instead, covered by fixtures that place a plan item and an assistant <proposed_plan> ahead of a `compacted` line. Also on the Stop path: - resolveCodexStopPlan answers "which plan" and "why none" from a single parse; getCodexStopSkipReason read the whole rollout and then getLatestCodexPlan read it again. The turn-id check still runs before the file is touched, so a Stop payload without one still loads no content. - Drop the `!existsSync(rolloutPath)` re-check (the path already came from a `.find(existsSync)`) and the turn-id guards downstream of the gate that can no longer be false. - Drop the unused findCodexRolloutByThreadId import. - Fold the single-consumer plan-normalization module back into codex-session.ts. - Refresh the two comments that still described the old degrade-to-last-turn-in-file fallback, which no longer exists. --------- Co-authored-by: Michael Ramos <mdramos8@gmail.com>
R
Raúl committed
551b9080e4b809fd498dd9fa8ed7984871d35d3f
Parent: cd8642c
Committed by GitHub <noreply@github.com>
on 9/15/2026, 2:49:44 AM