Skip to content

fix(ci): rebase merge actualizations - #200

Merged
tarik02 merged 1 commit into
mainfrom
bootstrap/rebase-actualization-promotion
Sep 8, 2026
Merged

fix(ci): rebase merge actualizations#200
tarik02 merged 1 commit into
mainfrom
bootstrap/rebase-actualization-promotion

Conversation

@tarik02

@tarik02 tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

What Changed

  • Actualization PRs stay based on upstream/main while their rebuilt heads run CI.
  • Promotion verifies the recorded main and upstream/main SHAs, required checks, and candidate history.
  • Promotion pushes the first fork commit to a temporary branch, retargets the PR there, and rebase-merges the remaining commits through GitHub.
  • The complete staged result is force-pushed to main with a lease, then validated and cleaned up.
  • Sync and promotion share one non-canceling concurrency group.
  • Failed promotions leave their PR and staging branch visible for manual recovery.

Why

The old workflow force-pushed the reviewed head directly to main and closed the PR, so GitHub never recorded the actualization as merged. The temporary base lets GitHub perform a real rebase merge without exposing an incomplete history on main.

Verification

  • Formatter check
  • actionlint with shellcheck

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • UI evidence is not applicable

Implemented with GPT-5.6 Sol in T3 Code.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T16:01:40.220358Z b3482aa Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.6 KiB 13.6 KiB +32 B (+0.2%) 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.0 KiB −7 B (−0.1%) 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 6.6 KiB +39 B (+0.6%) 7.8 KiB
Codex Live turn WebSocket decoded 57.0 KiB 57.1 KiB +88 B (+0.2%) 66.4 KiB
Codex Live turn messages 8 10 +2 (+25.0%) 21
Claude Total thread wire 13.6 KiB 13.6 KiB +7 B (+0.1%) 15.1 KiB
Claude Thread snapshot wire 7.1 KiB 7.0 KiB −5 B (−0.1%) 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 6.5 KiB +12 B (+0.2%) 7.8 KiB
Claude Live turn WebSocket decoded 57.8 KiB 57.8 KiB 0 B (0.0%) 66.4 KiB
Claude Live turn messages 9 9 0 (0.0%) 21

Baseline: 788a32d · PR result: 69d9fb8 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb4e1208fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
}
trap rollback EXIT

git push --force-with-lease="refs/heads/main:$EXPECTED_MAIN_SHA" origin "$UPSTREAM_SHA:refs/heads/main"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid pushing the bare upstream tree to main

On every actualization this force-push exposes the bare UPSTREAM_SHA as main, so GitHub processes a real push against upstream's workflow tree before the rebase merge restores the fork CI layer. At the recorded upstream base 08c715ed, .github/workflows/deploy-relay.yml contains an unconditional push-to-main production deployment, whereas the fork replacement at .github/workflows/deploy-relay.yml:18-20 deliberately disables it; the GitHub App installation token used here does not suppress workflow-triggering events. An actualization can therefore enqueue fork-disabled production automation from the transient commit, and neither the subsequent merge nor rollback cancels those jobs. Avoid making the bare upstream tree observable at main, or explicitly prevent its workflows from running during this move.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 85de6ea. Promotion now moves main to the first fork automation commit, after verifying that it replaces upstream .github content and that later commits do not change .github. The bare upstream workflow tree is never exposed on main.

Comment thread .github/workflows/promote-history.yml Outdated
Comment on lines +237 to +239
if [[ "$base_moved" == true ]]; then
if git push --force-with-lease="refs/heads/main:$UPSTREAM_SHA" origin "$EXPECTED_MAIN_SHA:refs/heads/main"; then
gh pr ready "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --undo || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore draft state when the base move fails

If the leased push fails—for example, because another main update wins after the earlier SHA check—the PR has already been made ready, but base_moved is still false, so this trap skips gh pr ready --undo. The local gh pr ready --help documents that the command marks a PR ready and that --undo converts it back to draft; consequently another /promote is rejected by the draft guard at line 45 until someone manually converts the PR. Track readiness separately and undo it on every pre-merge failure.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 85de6ea. Readiness and the base move are tracked separately, so every failure after marking ready returns the PR to draft, including a leased base-push failure.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from fb4e120 to 85de6ea Compare September 7, 2026 13:54
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85de6ea704

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated

gh pr ready "$PR_NUMBER" --repo "$GITHUB_REPOSITORY"
ready_changed=true
git push --force-with-lease="refs/heads/main:$EXPECTED_MAIN_SHA" origin "$PROMOTION_BASE_SHA:refs/heads/main"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent deployments from the transient base push

When an actualization changes any mobile path, this force-push is itself a main push from the old fork tip to the first fork-only commit. The checked .github/workflows/mobile-eas-production.yml:55-74,237-285 handles that as a non-canceling production run which may schedule store builds or publish fingerprint-matched OTAs, even though this commit intentionally precedes the remaining reviewed fork commits. The subsequent rebase merge only queues another run; it cannot stop the first run from deploying the transient tree, so gate production workflows during promotion or avoid exposing the intermediate commit as a push.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3b9a7cc. The workflow now creates a synthetic commit with the reviewed first-fork tree, the upstream parent, and [skip ci] in its message. GitHub therefore skips push workflows for the transient base. A local seven-commit simulation dropped the equivalent first patch, rebased the remaining six commits, and produced the exact reviewed final tree.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 85de6ea to 3b9a7cc Compare September 7, 2026 14:20
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b9a7cc7a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +11 to +13
concurrency:
group: history-promotion
cancel-in-progress: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize promotion with upstream synchronization

Because this concurrency group differs from sync-upstream-main, a sync can start as soon as the merge API closes the actualization PR and the sync gate no longer sees an open PR. It can then advance upstream/main before lines 314-319 validate against that live ref, making a valid promotion fail, or replace actualization/incoming before line 347 deletes it, causing the promotion run to delete the next actualization head. Use a shared concurrency group or validate/delete immutable recorded SHAs with leases.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 83621c5. Sync and promotion now share the fork-history-mutation concurrency group, and both use cancel-in-progress: false. A sync cannot start until promotion finishes validation and deletes the old head, and it cannot cancel an active promotion.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 3b9a7cc to 83621c5 Compare September 7, 2026 14:27
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83621c5180

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
echo 'The first fork commit is not directly based on upstream/main.' >&2
exit 1
fi
if git diff --quiet "$UPSTREAM_SHA" "$first_fork_sha" -- .github; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Verify the upstream workflows are actually replaced

When upstream adds a push-to-main workflow and the rebuilt first fork commit leaves it intact while changing any other .github file, this test passes because it proves only that the aggregate .github diff is nonempty, not that upstream automation was replaced. The fresh evidence after the earlier fix is that the new guard still accepts such a partial delta, allowing the final, non-skipped rebase-merge push to run the retained upstream workflow; validate the intended fork workflow tree or required removals instead.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c160698. Promotion now requires the first fork commit to preserve the exact .github/workflows tree from the recorded pre-actualization main. This rejects both newly retained upstream workflows and same-name upstream workflow contents. Later .github changes remain forbidden.

- name: Prepare actualization PR head
if: steps.upstream.outputs.upstream_sha != steps.upstream.outputs.current_sha
run: git push --force origin "refs/remotes/origin/main:refs/heads/actualization/incoming"
run: git push --force origin "refs/remotes/upstream/main:refs/heads/actualization/incoming"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point the PR head at the selected upstream SHA

When workflow_dispatch supplies a target_sha older than the live upstream tip, the workflow updates the mirror and PR marker to that selected SHA but pushes refs/remotes/upstream/main, which line 62 populated from the live tip, into actualization/incoming. The resulting PR therefore starts from a different commit than its recorded validation base and may fail promotion or rebuild against the wrong upstream revision; push $UPSTREAM_SHA as the source instead.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c160698. The incoming head is now pushed from the selected UPSTREAM_SHA output, so a pinned target_sha and the PR marker/head cannot diverge from the fetched live tip.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 83621c5 to c160698 Compare September 7, 2026 14:36
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c160698960

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

--repo "$GITHUB_REPOSITORY" \
--draft \
--base upstream/main \
--base main \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep conflicted actualizations eligible for CI

When an upstream update conflicts with a maintained fork patch, the rebuilt head is based on the new upstream history while main remains on the old history, so this --base main PR can remain merge-conflicted even after the rebase conflicts were resolved. GitHub does not run pull_request workflows for conflicted PRs; the inspected .github/workflows/ci.yml and .github/workflows/history-validation.yml use that event, while .github/workflows/promote-history.yml:152-172 refuses promotion without successful head checks and only moves main afterward. Such actualizations therefore cannot reach the rebase-merge step; run validation independently of PR mergeability or retarget to main only after the checks.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f664d45. Actualization PRs remain based on upstream/main for review and CI. Only after all checks and history validation pass does promotion mark the PR ready, retarget it to main, move main to the safe base, and rebase merge.

Comment thread .github/workflows/promote-history.yml Outdated
status=$?
trap - EXIT
if [[ "$base_moved" == true ]]; then
if ! git push --force-with-lease="refs/heads/main:$PROMOTION_BASE_SHA" origin "$EXPECTED_MAIN_SHA:refs/heads/main"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Suppress production workflows on the rollback push

When the merge API fails after base_moved becomes true, this force-push restores the old main commit, whose message lacks [skip ci]. Fresh evidence after the earlier transient-base fix is this second push: the current fork stack differs from the workflow-safe first commit across apps/mobile, packages/client-runtime, and packages/contracts, so .github/workflows/mobile-eas-production.yml:55-74 treats the rollback as a non-canceling production push and may schedule store builds or OTAs even though promotion failed. Gate production automation during rollback rather than suppressing only the forward base move.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f664d45. Rollback now force-pushes a replacement commit with the exact previous-main tree and parent plus [skip ci], so rollback cannot trigger production workflows. It restores the upstream PR base and draft state, then updates the recorded main SHA for retry.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from c160698 to f664d45 Compare September 7, 2026 14:51
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f664d45c80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +337 to +340
response="$(
gh api --method PUT "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/merge" \
-f merge_method=rebase \
-f sha="$HEAD_SHA"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard the base SHA through the rebase merge

If another feature merge or manual update reaches main after the leased push on line 335 but before this request, promotion can rebase onto that unexpected commit: the REST endpoint's sha field guards only the pull request head, not the base (GitHub: Merge a pull request). The shared workflow concurrency group does not serialize ordinary merges, and the subsequent validator accepts additional linear fork commits, so this can complete with history other than the reviewed stack; pin or recheck main == $PROMOTION_BASE_SHA at the merge boundary.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cbaa718. Promotion waits until both the PR base SHA and remote main equal the synthetic safe base, then rechecks remote main immediately before calling the merge endpoint. Any mismatch enters the workflow-safe rollback path.

Comment thread .github/workflows/promote-history.yml Outdated
Comment on lines +353 to +357
- name: Verify promoted actualization history
if: steps.pr.outputs.kind == 'actualization'
run: |
set -euo pipefail
git fetch --force --no-tags origin \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve finalization after the merge succeeds

If this post-merge fetch or validation fails transiently, the merge has already closed the PR and line 350 has disabled rollback, but GitHub Actions skips the later finalization step; the temporary head is therefore left behind and no promotion comment is posted. Rerunning the job cannot recover because it restarts at the draft guard and rejects the already-merged PR, so cleanup should run independently after a successful merge.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cbaa718. The finalization step now uses always() after a successful merge, reports the post-merge validation outcome, and deletes the temporary head even when that validation step fails.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from f664d45 to cbaa718 Compare September 7, 2026 15:02
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbaa718ccc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
trap - EXIT
rollback_main_succeeded=false
if [[ "$base_moved" == true ]]; then
if git push --force-with-lease="refs/heads/main:$PROMOTION_BASE_SHA" origin "$ROLLBACK_SHA:refs/heads/main"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Serialize all main writers before moving the base

When a normal PR merge or allowed manual update advances main after the synthetic-base push, the Rebase merge actualization guard can detect the change and exit, but this rollback is then guaranteed to fail because --force-with-lease="refs/heads/main:$PROMOTION_BASE_SHA" requires the remote ref to remain at that exact SHA (git push -h: “require old value of ref to be at this value”). The competing commit is based on only the first fork commit, so main remains on an incomplete actualization and that competing push can run production workflows; the concurrency group serializes sync and promotion workflows but not ordinary GitHub merges, so all main writers must be excluded during this interval or the rollback must safely preserve the concurrent update.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 794e7bf by removing the intermediate main update entirely. The safe base now lives on actualization/base-; GitHub rebase-merges there first, and only the complete staged result is force-pushed to main with the recorded-main lease. A concurrent main writer therefore causes a clean lease failure while main remains complete, and the staged result is preserved.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from cbaa718 to 794e7bf Compare September 7, 2026 15:13
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 794e7bf63e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
fi
promoted_sha="$(jq -r .sha <<<"$response")"
merged_to_staging=true
git push --force-with-lease="refs/heads/main:$EXPECTED_MAIN_SHA" origin "$promoted_sha:refs/heads/main"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fetch the rebased commit before pushing it

After every successful rebase merge, GitHub creates the resulting commits on the remote staging branch with new SHAs, so promoted_sha is not present in this checkout; a push refspec's source must resolve in the local repository (Git push documentation). Consequently this command fails with an unknown-source/refspec error, leaving main unchanged and every actualization requiring manual recovery. Fetch $staging_ref, verify its tip equals $promoted_sha, and then push the fetched commit.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3b7d849. After GitHub rebase-merges, promotion fetches the staging branch into a remote-tracking ref, verifies its fetched tip equals the merge API SHA, and pushes that local commit to main with the recorded-main lease.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 794e7bf to 3b7d849 Compare September 7, 2026 15:19
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b7d849ad5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

VALIDATION_OUTCOME: ${{ steps.actualization_validation.outcome }}
run: |
set -euo pipefail
gh pr comment "$PR_NUMBER" --body "Promoted as $PROMOTED_SHA (actualization, rebase merge; post-merge validation: $VALIDATION_OUTCOME)."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run branch cleanup before the fallible comment

If posting the promotion comment fails transiently, set -e exits this finalization step before either DELETE runs, leaving both temporary branches behind. Because the PR has already been merged, rerunning /promote is rejected by the draft guard, so the workflow cannot repair the cleanup even though the maintenance contract requires both branches to be removed; perform cleanup before the comment or guarantee it with a trap.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c86f485. Finalization now attempts both branch deletions before posting the comment, reports a failure if either cleanup call fails, and cannot leave branches behind because comment creation failed.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 3b7d849 to c86f485 Compare September 7, 2026 15:26
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c86f485771

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
git diff --name-status "$EXPECTED_MAIN_SHA" "$first_fork_sha" -- .github/workflows >&2
exit 1
fi
if ! git diff --quiet "$first_fork_sha" "$HEAD_SHA" -- .github; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Inspect each commit for later .github changes

When a later fork commit changes a .github file and a subsequent commit reverts it, this endpoint-tree comparison reports no difference and permits promotion even though .github changes were not consolidated into the first fork commit as required by the actualization history contract. Inspect the per-commit changes in first_fork_sha..HEAD rather than comparing only the two final trees.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 757a1af. Promotion now lists .github paths changed by every commit after the first fork commit and rejects any result, so a later change hidden by a subsequent revert is still detected.

Comment on lines +331 to +335
response="$(
gh api --method PUT "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/merge" \
-f merge_method=rebase \
-f sha="$HEAD_SHA"
)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconcile merge status before deleting staging

If GitHub completes the rebase merge but the connection drops before gh api returns its response, set -e invokes the trap while merged_to_staging is still false. The rollback then deletes the staging branch containing the completed rebased history, while the PR is already merged and cannot be retried because the initial draft guard rejects it. Before taking the destructive rollback path after a merge attempt, query the PR's merge state or otherwise preserve staging when the outcome is uncertain.

AGENTS.md reference: AGENTS.md:L1-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 757a1af. Once a merge request begins, the trap queries the PR before cleanup. A confirmed merge preserves staging; an unavailable PR state is treated as uncertain and also preserves staging and PR state. Destructive rollback runs only after GitHub confirms the PR is still unmerged.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from c86f485 to 757a1af Compare September 7, 2026 15:33
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 757a1af9f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
Comment on lines +307 to +308
elif [[ "$preserve_staging" == true ]]; then
gh pr comment "$PR_NUMBER" --body "The rebase merge result could not be confirmed. The staging branch and PR state are preserved for recovery." || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Block sync while an uncertain staging PR remains open

When the merge outcome cannot be fetched, this path leaves the PR open, ready, and based on actualization/base-*. The checked sync gate at .github/workflows/sync-upstream-main.yml:43 uses gh pr list --base upstream/main (gh pr list --help: “Filter by base branch”), so it will not detect this recovery PR after the shared concurrency lock is released. For the normal actualization/incoming head, the next upstream change can therefore advance the mirror and force-push that branch at line 112, replacing the reviewed head while the merge outcome remains unknown; gate on every open actualization PR, regardless of its temporary base.

AGENTS.md reference: AGENTS.md:L3-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5ef2c98. Sync now gates on every open PR carrying the actualization label, independent of its base branch, so an uncertain staging or recovery PR continues to freeze both the mirror and incoming head.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 757a1af to 5ef2c98 Compare September 7, 2026 15:41
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ef2c98f9f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
Comment on lines +329 to +331
gh api --method PATCH "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" \
-f base="$staging_ref" >/dev/null
base_changed=true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconcile an uncertain base retarget before cleanup

If GitHub applies this base change but the response is lost or times out, base_changed remains false, so the EXIT trap skips restoring upstream/main and then deletes the staging branch. This can leave the actualization PR targeting a deleted base (or cause GitHub to close it), despite the maintenance contract requiring failed promotion to restore the original PR state. Mark the retarget as attempted before the request or query the PR state before destructive cleanup.

AGENTS.md reference: AGENTS.md:L3-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 376fc9f. The staging-created, ready-changed, and base-changed flags are now set before their respective remote mutations. A lost response therefore takes the conservative cleanup path and restores the upstream base/draft state instead of deleting a possibly active staging base.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 5ef2c98 to 376fc9f Compare September 7, 2026 15:48
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 376fc9fb2c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/promote-history.yml Outdated
Comment on lines +310 to +312
if [[ "$base_changed" == true ]]; then
gh api --method PATCH "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" \
-f base=upstream/main >/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve staging until the PR base is restored

When a pre-merge failure enters rollback after the PR was retargeted, a transient or permission failure from this PATCH is discarded by || true, and rollback still deletes $staging_ref at line 318. The PR can then remain based on a deleted branch, making /promote ineligible and violating the failed-promotion guarantee to restore upstream/main; confirm the original base was restored, or preserve staging for recovery when restoration fails.

AGENTS.md reference: AGENTS.md:L3-L3

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b3482aa. Rollback now tracks whether both the original base and draft state were restored. It deletes staging only after both operations succeed; any restoration failure preserves staging and posts a recovery comment.

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from 376fc9f to b3482aa Compare September 7, 2026 15:56
@tarik02

tarik02 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: b3482aad88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tarik02
tarik02 force-pushed the bootstrap/rebase-actualization-promotion branch from b3482aa to 69d9fb8 Compare September 7, 2026 16:03
@tarik02
tarik02 merged commit 0553b42 into main Sep 8, 2026
27 checks passed
@tarik02
tarik02 deleted the bootstrap/rebase-actualization-promotion branch September 8, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant