diff --git a/.github/workflows/codex-branch.sh b/.github/workflows/codex-branch.sh index f3845237be7d61..aac40e41e0950b 100755 --- a/.github/workflows/codex-branch.sh +++ b/.github/workflows/codex-branch.sh @@ -5265,6 +5265,19 @@ assemble_candidate () { "$candidate" "$state" "$require_automation" fi + if test -f "$state/unstable/topic-updates" + then + recovered=$(state_value "$state/unstable" base-oid) + git merge-base --is-ancestor "$base_oid" "$recovered" && + test "$(git rev-parse "$candidate^{tree}")" = \ + "$(git rev-parse "$recovered^{tree}")" && + codex_has_expected_integrations "$state" "$recovered" || + die "completed unstable recovery has a different stable base" + # Keep the exact base of the recovered graph after validating its + # tree and integrations against the freshly assembled candidate. + candidate=$recovered + fi + printf '%s\n' "$candidate" } diff --git a/t/t9905-codex-branch.sh b/t/t9905-codex-branch.sh index 064eb0a78375b9..5ab8dc55ba09cf 100755 --- a/t/t9905-codex-branch.sh +++ b/t/t9905-codex-branch.sh @@ -9394,6 +9394,7 @@ test_expect_success 'pinned merge chain preserves recoverable overlap state' ' sh "$codex_branch" continue --worktree "$private" \ >continue.out 2>continue.err && test_grep "source refs unchanged" continue.out && + test_tick && sh "$codex_branch" publish-topics --worktree resolution \ >publish.out 2>publish.err && test_grep "Pinned recovery session" publish.out && @@ -9401,6 +9402,7 @@ test_expect_success 'pinned merge chain preserves recoverable overlap state' ' session=$(sed -n \ "s/^Pinned recovery session: //p" publish.out) && test -n "$session" && + test_cmp "$state/unstable/base-oid" "$session/codex-candidate" && sh "$codex_branch" verify-output \ --inputs "$session/codex-inputs" \ --updates "$session/codex-updates" \