Skip to content

ci: add hermetic backend merge gate - #10024

Merged
Git-on-my-level merged 2 commits into
mainfrom
codex/require-hermetic-merge-gate
Jul 21, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
codex/require-hermetic-merge-gate

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 19, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Start the backend hermetic workflow for every pull request and merge-queue batch.
  • Calculate backend scope inside the workflow: backend, lockfile, and workflow changes run the hermetic E2E harness plus both emulator gauntlets; other changes still report one explicit successful gate.
  • Add a fail-closed final Backend Hermetic Merge Gate, static wiring contracts, and contributor documentation.

Refs #10021

Guard rationale

PR #10000 added the durable-finalization emulator gauntlet, but path-filtered workflows can leave a required check pending or let a later workflow edit silently decouple that coverage from the merge decision. This workflow-local gate is the narrow owner of those three existing jobs: it requires every selected job to succeed and accepts skipped jobs only when the scope job explicitly proves the pull request is out of scope. The static tests are tripwires; the actual hermetic behavior is exercised by the existing E2E harness and emulator gauntlets in CI.

Follow-through after merge

#10021 remains open until this workflow is merged, Backend Hermetic Merge Gate is configured as a strict required check on main, admin bypass is disabled, and the live branch-protection API confirms both settings.

Verification

  • cd backend && BACKEND_PYTEST_WORKERS=4 bash test.sh (675 isolated unit test files)
  • cd backend && .venv/bin/python -m pytest -q tests/unit/test_listen_pusher_stack_ci_wiring.py tests/unit/test_sync_cloud_tasks_stack_ci_wiring.py (3 passed)
  • actionlint -shellcheck='' .github/workflows/backend-hermetic-e2e.yml
  • Extracted and executed the workflow scope and final-gate shell scripts for selected, out-of-scope, and selected-child-failure cases.
  • Independent implementation review approved the workflow semantics.

Review in cubic

@mintlify

mintlify Bot commented Jul 19, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
omi 🟢 Ready View Preview Jul 19, 2026, 7:47 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@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: 446f5a9d63

ℹ️ 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".

exit 1
fi

changed_files="$(git diff --name-only "$base_sha"...HEAD)"

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 Use the actual PR merge base for scope

For pull_request runs on a PR that has been open while main advanced, github.event.pull_request.base.sha can still be the base SHA recorded for the PR while checkout HEAD is the current PR merge ref. This three-dot diff then includes unrelated files that landed on main after the PR opened; a docs-only PR will set applies=true whenever those intervening changes touched backend/, the lockfiles, or this workflow, so the required gate runs or blocks on heavy backend gauntlets instead of reporting the promised out-of-scope success. Diff against the current PR merge base/merge-commit parents for the scope decision instead.

Useful? React with 👍 / 👎.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Reviewed the Codex P2 comment on backend-hermetic-e2e.yml:56 (scope job's base.sha...HEAD diff).

No code change — the concern does not hold as stated. GitHub's pull_request event sets github.event.pull_request.base.sha to the base branch (main) HEAD at event-delivery time, not the original branch point. actions/checkout (no explicit ref) checks out refs/pull/N/merge, which GitHub maintains as the merge of that current base with the PR head. The three-dot diff base.sha...HEAD therefore resolves merge-base(base.sha, HEAD) = base.sha, so only the PR's own changes are counted — unrelated commits that landed on main in the meantime are excluded.

Verified locally with a docs-only PR branch where main advanced with backend/ changes underneath it: git diff <base.sha>...HEAD yielded only the PR's docs file, never backend/. This also matches the repo convention — backend-unit-tests.yml, desktop-swift-ci.yml, desktop-backend-image-checks.yml, and repo-checks.yml all scope on the same ${{ github.event.pull_request.base.sha }}...HEAD pattern.

Check status at review time: Backend Hermetic Merge Gate, Hermetic Backend E2E, Listen Pusher Stack Gauntlet, and Sync Cloud Tasks Stack Gauntlet all SUCCESS. No actionable failing checks.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Backend hermetic merge-gate CI. Approve-only — touches .github CI supply chain (abuse-sensitive); Nik to review.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run summary — no code change required this pass.

PR state at review: OPEN, MERGEABLE, mergeStateStatus: CLEAN, reviewDecision: APPROVED.

Verification:

  • gh pr checks 10024 — all checks pass or skipping (Docs/Backend/Desktop/Mobile scope detection worked as designed). The CANCELLED Detect Changes / Hygiene / Formatting entries from the earlier run were superseded; the latest run is fully green, including Backend Hermetic Merge Gate, Hermetic Backend E2E, Listen Pusher Stack Gauntlet, and Sync Cloud Tasks Stack Gauntlet all SUCCESS.
  • Trusted review threads: one Codex P2 on .github/workflows/backend-hermetic-e2e.yml:56 (merge-base scoping). Already addressed by the prior top-level rejection (comment 5015338032) — no code change warranted, thread left unresolved intentionally since the concern does not hold as stated.

No eligible code work this run; PR remains merge-ready.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

@cursor address merge conflict

@cursor

cursor Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Resolved the merge conflict with main and pushed the fix.

Conflict: backend/tests/unit/test_listen_pusher_stack_ci_wiring.py — both branches had extended this file in different ways.

Resolution: Combined both sides:

  • Kept this PR’s test_backend_hermetic_gate_is_always_reported_and_fails_closed (merge gate wiring contract)
  • Kept main’s listen-pusher gauntlet assertions: --state-dir retention, failure log step, and test(listen): cover durable finalization recovery through Cloud Tasks #10000 REST admission/restart tripwires
  • Dropped main’s obsolete package.json / package-lock.json path-filter checks (replaced by the scope job’s grep in this PR)

.github/workflows/backend-hermetic-e2e.yml auto-merged cleanly (including main’s listen gauntlet failure-log step).

Verification: All 3 wiring contract tests pass.

Commit: 3c94c736f5 on codex/require-hermetic-merge-gate — pushed to origin. PR #10024 should be mergeable once CI re-runs.

Open in Web Open in Cursor 

Combine the merge-gate wiring contract from this branch with main's
listen-pusher gauntlet assertions (state-dir retention, failure logs,
and #10000 REST admission/restart tripwires). Drop main's obsolete
package.json path-filter checks superseded by the scope job.

Verification: backend/.venv/bin/python -m pytest -q \
  tests/unit/test_listen_pusher_stack_ci_wiring.py \
  tests/unit/test_sync_cloud_tasks_stack_ci_wiring.py (3 passed)

Co-authored-by: David Zhang <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 9253d44 into main Jul 21, 2026
34 of 35 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/require-hermetic-merge-gate branch July 21, 2026 02:11

This branch was successfully deployed

1 active deployment
staging - docs — 3c94c736 Deployed Jul 21, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants